diff --git a/Gemfile b/Gemfile deleted file mode 100644 index 080b3646..00000000 --- a/Gemfile +++ /dev/null @@ -1,5 +0,0 @@ -source :rubygems - -gem 'json_pure' -gem 'thor' -gem 'uglifier' diff --git a/Gemfile.lock b/Gemfile.lock deleted file mode 100644 index 48ef0240..00000000 --- a/Gemfile.lock +++ /dev/null @@ -1,19 +0,0 @@ -GEM - remote: http://rubygems.org/ - specs: - execjs (1.3.0) - multi_json (~> 1.0) - json_pure (1.6.5) - multi_json (1.1.0) - thor (0.14.6) - uglifier (1.2.3) - execjs (>= 0.3.0) - multi_json (>= 1.0.2) - -PLATFORMS - ruby - -DEPENDENCIES - json_pure - thor - uglifier diff --git a/README.md b/README.md index 4b056f43..c13bda1d 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,14 @@ #Building the KineticJS Framework -To build the framework, you need to have Grunt.js installed. After that, run `gem install thor`, `gem install json_pure`, and `gem install uglifier` to install the dependencies. +To build the framework, you need to have node and grunt installed. After that, run `npm install` to install the node module dependencies. -To build a development version of the framework, run `thor build:dev VERSION`, where VERSION is a string that can be anything you like. For example, using `thor build:dev current` will produce `kinetic-vcurrent.js`. To build a minified version of the framework, run `thor build:prod VERSION`. +To build a development version of the framework, run `grunt dev`, To run a full build, which also produces the minified version and the individually minified modules for the custom build, run `grunt full`. -If you add a file in the src directory, be sure to add the filename to the filename array in the Thorfile. +If you add a file in the src directory, be sure to add the filename to the sourceFiles array variable in Gruntfile.js. #Testing ### Getting the tests up and running -Currently, KineticJS has unit, functional, performance, manual, and special test suites. To build the unit tests, you'll need to build the `unitTests.js` file by running `thor build:test` and then opening `unitTests.html`. Open `tests/html/index.html` to navigate to different test suites. +Currently, KineticJS has unit, functional, performance, manual, and special test suites. To build the unit tests, you'll need to build the `unitTests.js` file by running `grunt test` and then opening `unitTests.html`. Open `tests/html/index.html` to navigate to different test suites. ### Running the tests Unit, functional, and performance tests output the results to the console via `console.log()` so be sure to have it open. diff --git a/Thorfile b/Thorfile deleted file mode 100644 index fb596b7a..00000000 --- a/Thorfile +++ /dev/null @@ -1,160 +0,0 @@ -require 'json/pure' -require 'uglifier' - -class Build < Thor - # This is the list of files to concatenate. The first file will appear at the top of the final file. All files are relative to the lib directory. - FILES = [ - "src/Global.js", "src/Util.js", "src/Canvas.js", - "src/Node.js", "src/Animation.js", "src/Tween.js", "src/DragAndDrop.js", "src/Container.js", "src/Shape.js", "src/Stage.js", "src/Layer.js", "src/Group.js", - "src/shapes/Rect.js", "src/shapes/Circle.js", "src/shapes/Wedge.js", "src/shapes/Image.js", "src/shapes/Polygon.js", "src/shapes/Text.js", "src/shapes/Line.js", "src/shapes/Spline.js", "src/shapes/Blob.js", "src/shapes/Sprite.js", - "src/plugins/Path.js", "src/plugins/TextPath.js", "src/plugins/RegularPolygon.js", "src/plugins/Star.js", "src/plugins/Label.js", - "src/filters/Grayscale.js", "src/filters/Brighten.js", "src/filters/Invert.js", "src/filters/Blur.js", "src/filters/Mask.js" - ] - - UNIT_TESTS = [ - "tests/js/unit/animationTests.js", - "tests/js/unit/tweenTests.js", - "tests/js/unit/globalTests.js", - "tests/js/unit/utilTests.js", - "tests/js/unit/nodeTests.js", - "tests/js/unit/stageTests.js", - "tests/js/unit/containerTests.js", - "tests/js/unit/layerTests.js", - "tests/js/unit/shapeTests.js", - "tests/js/unit/ddTests.js", - "tests/js/unit/shapes/rectTests.js", - "tests/js/unit/shapes/circleTests.js", - "tests/js/unit/shapes/wedgeTests.js", - "tests/js/unit/shapes/imageTests.js", - "tests/js/unit/shapes/polygonTests.js", - "tests/js/unit/shapes/lineTests.js", - "tests/js/unit/shapes/splineTests.js", - "tests/js/unit/shapes/blobTests.js", - "tests/js/unit/shapes/textTests.js", - "tests/js/unit/shapes/spriteTests.js", - - "tests/js/unit/plugins/pathTests.js", - "tests/js/unit/plugins/regularPolygonTests.js", - "tests/js/unit/plugins/starTests.js", - "tests/js/unit/plugins/textPathTests.js", - "tests/js/unit/plugins/labelTests.js" - ] - - if !File.directory?("dist") - puts ":: Creating dist directory..." - Dir.mkdir("dist") - end - - # dev build - desc "dev", "Concatenate all the js files into /dist/kinetic-vVERSION.js." - def dev(version) - - - file_name = "dist/kinetic-v#{version}.js" - - puts ":: Deleting other development files..." - Dir.foreach("dist") do |file| - if file.match(/.*[^(min)]\.js/) - File.delete("dist/" + file) - end - end - - puts ":: Building full source file /#{file_name}..." - File.open(file_name, "w") do |file| - file.puts replace_tokens(concatenate, version) - end - - puts " -> Done!" - end - - # test build - desc "test", "Concatenate all the unit test js files into tests/js/unitTests.js" - def test() - - file_name = "tests/js/unitTests.js" - - puts ":: Deleting old unitTests.js..." - if File.file?("tests/js/unitTests.js") - File.delete("tests/js/unitTests.js") - end - - puts ":: Building new unitTests.js..." - File.open(file_name, "w") do |file| - file.puts concatenateUnitTests - end - - puts " -> Done!" - end - - #prod build - desc "prod", "Concatenate all the js files in into /dist/kinetic-vVERSION.min.js and minify it." - def prod(version) - file_name = "dist/kinetic-v#{version}.min.js" - - puts ":: Deleting other prod files..." - Dir.foreach("dist") do |file| - if file.match(/.*min\.js/) - File.delete("dist/" + file) - end - end - - puts ":: Building full prod file /#{file_name}..." - - - #build full minfiied prod file - File.open(file_name, "w") do |file| - uglify = Uglifier.compile(concatenate()) - uglify.sub!(/\*\/ .+ \*\//xm, "*/") - file.puts replace_tokens(uglify, version) - end - - #build modular minified files - puts ":: Building minified modules..." - FILES.each do |file| - content = IO.read(File.expand_path(file)) << "\n" - mod = File.basename(file) - mod[".js"] = "" - module_filename = "dist/kinetic-#{mod}-v#{version}.min.js" - File.open(module_filename, "w") do |file2| - uglify = Uglifier.compile(content, :copyright => mod == "Global") - file2.puts replace_tokens(uglify, version) - end - end - - puts " -> Done!" - end - - private - - def concatenate() - content = "" - FILES.each do |file| - content << IO.read(File.expand_path(file)) << "\n" - end - - return content - end - - def concatenateUnitTests() - content = "" - UNIT_TESTS.each do |file| - content << IO.read(File.expand_path(file)) << "\n" - end - - return content - end - - def replace_tokens(content, version) - date = Time.now.strftime("%b %d %Y") - - content.gsub!("{{version}}", version) - content.sub!("{{date}}", date) - content.gsub!("{{NodeParams}}", IO.read("configParams/NodeParams.txt")) - content.gsub!("{{ContainerParams}}", IO.read("configParams/ContainerParams.txt")) - content.gsub!("{{ShapeParams}}", IO.read("configParams/ShapeParams.txt")) - - return content - end - -end - diff --git a/tests/js/unit/utilTests.js b/tests/js/unit/utilTests.js deleted file mode 100644 index aea24f88..00000000 --- a/tests/js/unit/utilTests.js +++ /dev/null @@ -1,34 +0,0 @@ -Test.Modules.UTIL = { - 'getRGB()': function() { - var rgb = {}; - - // color strings - rgb = Kinetic.Util.getRGB('red'); - test(rgb.r === 255, 'color string r should be 255'); - test(rgb.g === 0, 'color string g should be 0'); - test(rgb.b === 0, 'color string b should be 0'); - - rgb = Kinetic.Util.getRGB('pink'); - test(rgb.r === 255, 'color string r should be 255'); - test(rgb.g === 192, 'color string g should be 192'); - test(rgb.b === 203, 'color string b should be 203'); - - // hex - rgb = Kinetic.Util.getRGB('#00ff00'); - test(rgb.r === 0, 'hex r should be 0'); - test(rgb.g === 255, 'hex g should be 255'); - test(rgb.b === 0, 'hex b should be 0'); - - // rgb color string - rgb = Kinetic.Util.getRGB('rgb(255, 192, 203)'); - test(rgb.r === 255, 'rgb string r should be 255'); - test(rgb.g === 192, 'rgb string g should be 192'); - test(rgb.b === 203, 'rgb string b should be 203'); - - // default - rgb = Kinetic.Util.getRGB('not a color'); - test(rgb.r === 0, 'default r should be 0'); - test(rgb.g === 0, 'default g should be 0'); - test(rgb.b === 0, 'default b should be 0'); - } -}; \ No newline at end of file