mirror of
https://github.com/konvajs/konva.git
synced 2025-06-28 05:01:41 +08:00
Change the Rakefile for a Thorfile.
This commit is contained in:
parent
3c140ca762
commit
286b726823
4
Gemfile
4
Gemfile
@ -1,5 +1,5 @@
|
|||||||
source :rubygems
|
source :rubygems
|
||||||
|
|
||||||
gem 'json-pure'
|
gem 'json_pure'
|
||||||
gem 'rake'
|
gem 'thor'
|
||||||
gem 'uglifier'
|
gem 'uglifier'
|
||||||
|
@ -3,8 +3,9 @@ GEM
|
|||||||
specs:
|
specs:
|
||||||
execjs (1.3.0)
|
execjs (1.3.0)
|
||||||
multi_json (~> 1.0)
|
multi_json (~> 1.0)
|
||||||
|
json_pure (1.6.5)
|
||||||
multi_json (1.1.0)
|
multi_json (1.1.0)
|
||||||
rake (0.9.2.2)
|
thor (0.14.6)
|
||||||
uglifier (1.2.3)
|
uglifier (1.2.3)
|
||||||
execjs (>= 0.3.0)
|
execjs (>= 0.3.0)
|
||||||
multi_json (>= 1.0.2)
|
multi_json (>= 1.0.2)
|
||||||
@ -13,5 +14,6 @@ PLATFORMS
|
|||||||
ruby
|
ruby
|
||||||
|
|
||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
rake
|
json_pure
|
||||||
|
thor
|
||||||
uglifier
|
uglifier
|
||||||
|
@ -12,7 +12,7 @@ Check out the official [KineticJS Tutorials](http://www.html5canvastutorials.com
|
|||||||
# Building the library
|
# 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 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`.
|
To build a development version of the library, run `thor build:dev`. To build a minify version of the library, run `thor build:prod`.
|
||||||
|
|
||||||
# Adding a new file in the src directory
|
# Adding a new file in the src directory
|
||||||
If you add a file in the src directory, add into the array in the Rakefile.
|
If you add a file in the src directory, add into the array in the Thorfile.
|
||||||
|
40
Rakefile
40
Rakefile
@ -1,40 +0,0 @@
|
|||||||
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
|
|
52
Thorfile
Normal file
52
Thorfile
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
require 'json/pure'
|
||||||
|
|
||||||
|
class Build < Thor
|
||||||
|
include Thor::Actions
|
||||||
|
# include Thor::Shell::Basic
|
||||||
|
|
||||||
|
# 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"
|
||||||
|
]
|
||||||
|
|
||||||
|
desc "dev", "Concatenate all the js files into /dist/kinetic.js."
|
||||||
|
def dev
|
||||||
|
puts ":: Building the file /dist/kinetic.js..."
|
||||||
|
File.open("dist/kinetic.js", "w") do |file|
|
||||||
|
file.puts concatenate()
|
||||||
|
end
|
||||||
|
puts " -> Done!"
|
||||||
|
end
|
||||||
|
|
||||||
|
desc "prod", "Concatenate all the js files in into /dist/kinetic.min.js and minify it."
|
||||||
|
def prod
|
||||||
|
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
|
||||||
|
|
||||||
|
desc "all", "Build the development and the production files."
|
||||||
|
def all
|
||||||
|
invoke :dev
|
||||||
|
invoke :prod
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def concatenate
|
||||||
|
content = ""
|
||||||
|
FILES.each do |file|
|
||||||
|
content << IO.read(File.expand_path(file)) << "\n"
|
||||||
|
end
|
||||||
|
|
||||||
|
return content
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user