Skip to content

Commit 3c140ca

Browse files
committed
Merged ac80261
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
2 parents 5679cbf + ac80261 commit 3c140ca

File tree

7 files changed

+2363
-20
lines changed

7 files changed

+2363
-20
lines changed

Gemfile

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
source :rubygems
2+
3+
gem 'json-pure'
4+
gem 'rake'
5+
gem 'uglifier'

Gemfile.lock

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
GEM
2+
remote: http://rubygems.org/
3+
specs:
4+
execjs (1.3.0)
5+
multi_json (~> 1.0)
6+
multi_json (1.1.0)
7+
rake (0.9.2.2)
8+
uglifier (1.2.3)
9+
execjs (>= 0.3.0)
10+
multi_json (>= 1.0.2)
11+
12+
PLATFORMS
13+
ruby
14+
15+
DEPENDENCIES
16+
rake
17+
uglifier

README.md

+8
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,11 @@ You can draw your own shapes or images using the existing canvas API, add event
88

99
# Tutorials
1010
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/).
11+
12+
# Building the library
13+
To build the library, you need to have Ruby and Rubygems installed. After that, install the dependencies by running `bundle install`.
14+
15+
To build a development version of the library, run `rake build:dev`. To build a minify version of the library, run `rake build:prod`.
16+
17+
# Adding a new file in the src directory
18+
If you add a file in the src directory, add into the array in the Rakefile.

Rakefile

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
require 'json/pure'
2+
3+
# 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.
4+
FILES = [
5+
"license.js", "src/GlobalObject.js", "src/Node.js", "src/Container.js", "src/Stage.js",
6+
"src/Layer.js", "src/Group.js", "src/geometries/Shape.js", "src/geometries/Rect.js", "src/geometries/Circle.js", "src/geometries/Image.js",
7+
"src/geometries/Polygon.js", "src/geometries/RegularPolygon.js", "src/geometries/Star.js", "src/geometries/Text.js"
8+
]
9+
10+
def concatenate
11+
content = ""
12+
FILES.each do |file|
13+
content << IO.read(File.expand_path(file)) << "\n"
14+
end
15+
16+
return content
17+
end
18+
19+
namespace :build do
20+
desc "Concatenate all the js files into /dist/kinetic.js."
21+
task :dev do
22+
puts ":: Building the file /dist/kinetic.js..."
23+
File.open("dist/kinetic.js", "w") do |file|
24+
file.puts concatenate()
25+
end
26+
puts " -> Done!"
27+
end
28+
29+
desc "Concatenate all the js files in into /dist/kinetic.min.js and minify it."
30+
task :prod do
31+
puts ":: Building the file /dist/kinetic.min.js..."
32+
require 'json/pure'
33+
require 'uglifier'
34+
File.open("dist/kinetic.min.js", "w") do |file|
35+
file.puts Uglifier.compile(concatenate())
36+
end
37+
puts ":: Minifying the file /dist/kinetic.min.js..."
38+
puts " -> Done!"
39+
end
40+
end

0 commit comments

Comments
 (0)