Skip to content

Commit

Permalink
Merged ac80261
Browse files Browse the repository at this point in the history
removed lib directory and used src instead.  Moved license.js outside of the source directory.  Created a geometries directory inside src.  Also had problems getting the Ruby rake file to build a minified file with uglifiy, so after a bit of searching I found that many people suggested to include the json-pure gem, so I added it to the Gemfile
  • Loading branch information
ericdrowell committed Mar 7, 2012
2 parents 5679cbf + ac80261 commit 3c140ca
Show file tree
Hide file tree
Showing 7 changed files with 2,363 additions and 20 deletions.
5 changes: 5 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
source :rubygems

gem 'json-pure'
gem 'rake'
gem 'uglifier'
17 changes: 17 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
GEM
remote: http://rubygems.org/
specs:
execjs (1.3.0)
multi_json (~> 1.0)
multi_json (1.1.0)
rake (0.9.2.2)
uglifier (1.2.3)
execjs (>= 0.3.0)
multi_json (>= 1.0.2)

PLATFORMS
ruby

DEPENDENCIES
rake
uglifier
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,11 @@ You can draw your own shapes or images using the existing canvas API, add event

# Tutorials
Check out the official [KineticJS Tutorials](http://www.html5canvastutorials.com/kineticjs/html5-canvas-events-tutorials-introduction-with-kineticjs/) hosted on [HTML5 Canvas Tutorials](http://www.html5canvastutorials.com/).

# Building the library
To build the library, you need to have Ruby and Rubygems installed. After that, install the dependencies by running `bundle install`.

To build a development version of the library, run `rake build:dev`. To build a minify version of the library, run `rake build:prod`.

# Adding a new file in the src directory
If you add a file in the src directory, add into the array in the Rakefile.
40 changes: 40 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
require 'json/pure'

# 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 = [
"license.js", "src/GlobalObject.js", "src/Node.js", "src/Container.js", "src/Stage.js",
"src/Layer.js", "src/Group.js", "src/geometries/Shape.js", "src/geometries/Rect.js", "src/geometries/Circle.js", "src/geometries/Image.js",
"src/geometries/Polygon.js", "src/geometries/RegularPolygon.js", "src/geometries/Star.js", "src/geometries/Text.js"
]

def concatenate
content = ""
FILES.each do |file|
content << IO.read(File.expand_path(file)) << "\n"
end

return content
end

namespace :build do
desc "Concatenate all the js files into /dist/kinetic.js."
task :dev do
puts ":: Building the file /dist/kinetic.js..."
File.open("dist/kinetic.js", "w") do |file|
file.puts concatenate()
end
puts " -> Done!"
end

desc "Concatenate all the js files in into /dist/kinetic.min.js and minify it."
task :prod do
puts ":: Building the file /dist/kinetic.min.js..."
require 'json/pure'
require 'uglifier'
File.open("dist/kinetic.min.js", "w") do |file|
file.puts Uglifier.compile(concatenate())
end
puts ":: Minifying the file /dist/kinetic.min.js..."
puts " -> Done!"
end
end
Loading

0 comments on commit 3c140ca

Please sign in to comment.