-
Notifications
You must be signed in to change notification settings - Fork 11
/
Rakefile
57 lines (49 loc) · 2.28 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
task :environment do
require './app'
require 'pry'
require 'luca'
end
stylesheets = ["luca-ui-bootstrap.css","luca-ui-development-tools.css","sandbox.css"]
scripts = ["dependencies.js","sandbox.js"]
namespace :release do
desc "Zip up the assets"
task :zip => :environment do
`cp vendor/assets/javascripts/luca-development.min.js vendor/assets/javascripts/luca.min.js vendor/assets/javascripts/luca-dependencies.min.js vendor/assets/stylesheets/luca-ui.css .`
`zip downloads/luca-#{ Luca::Version }.zip luca.min.js luca-dependencies.min.js luca-development.min.js luca-ui.css`
`cp luca-development.min.js luca-ui.css luca.min.js luca-dependencies.min.js downloads`
`mv luca-development.min.js luca.min.js luca-dependencies.min.js site/source/app/assets/javascripts/vendor`
`rm -f luca-ui.css`
end
desc "Compile and Minify"
task :all => [:assets,:minify,:zip]
desc "Compile all the assets"
task :assets => :environment do
File.open( File.join(App.root,'vendor','assets','stylesheets','luca-development.css'), 'w+' ) do |fh|
fh.puts(App.sprockets["luca/development.css"].to_s)
end
File.open( File.join(App.root,'vendor','assets','stylesheets','luca-components.css'), 'w+' ) do |fh|
fh.puts(App.sprockets["luca.css"].to_s)
end
File.open( File.join(App.root,'tmp','luca.js'), 'w+' ) do |fh|
fh.puts(App.sprockets["luca.js"].to_s + "\n\n\nLuca.VERSION='#{ Luca::Version }';")
end
File.open( File.join(App.root,'tmp','luca-development.js'), 'w+' ) do |fh|
fh.puts(App.sprockets["luca/development.js"].to_s)
end
File.open( File.join(App.root,'tmp','luca-dependencies.js'), 'w+' ) do |fh|
fh.puts(App.sprockets["luca/dependencies.js"].to_s)
end
end
desc "Minify the assets"
task :minify do
`uglifyjs tmp/luca.js > vendor/assets/javascripts/luca.min.js`
`uglifyjs tmp/luca-development.js > vendor/assets/javascripts/luca-development.min.js`
`uglifyjs tmp/luca-dependencies.js > vendor/assets/javascripts/luca-dependencies.min.js`
`cat vendor/assets/javascripts/luca-dependencies.min.js vendor/assets/javascripts/luca.min.js > vendor/assets/javascripts/luca.full.min.js`
`rm tmp/*.js`
end
desc "Build the gem"
task :gem => [:assets,:minify,:zip] do
`gem build luca.gemspec`
end
end