-
Notifications
You must be signed in to change notification settings - Fork 96
/
Rakefile
69 lines (54 loc) · 2.16 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
58
59
60
61
62
63
64
65
66
67
68
69
#!/usr/bin/env rake
require "bundler/gem_tasks"
namespace :twitter do
desc "Pulls Twitter's Bootstrap Scss"
task :pull do
if !system "git pull -s subtree twitter twb2"
abort "Have to add twitter scss remote `git remote add -f twitter git@github.com:yury/bootstrap.git`"
end
end
TW_IMGS = FileList["vendor/twitter/img/*.*"]
ASSETS_IMGS = TW_IMGS.pathmap("vendor/assets/images/twitter/%f")
ASSETS_IMGS.zip(TW_IMGS).each do |target, source|
file target => [source] { cp source, target, verbose: true }
end
TW_JS = FileList["vendor/twitter/js/*.*"]
ASSETS_JS = TW_JS.pathmap("vendor/assets/javascripts/twitter/bootstrap/%{bootstrap-,}f")
ASSETS_JS.zip(TW_JS).each do |target, source|
file target => [source] { cp source, target, verbose: true }
end
TW_SCSS = FileList["vendor/twitter/scss/*.*"]
ASSETS_SCSS = TW_SCSS.pathmap("vendor/frameworks/twitter/bootstrap/%f")
ASSETS_SCSS.zip(TW_SCSS).each do |target, source|
file target => [source] { cp source, target, verbose: true }
end
desc "Update Twitter's Bootstrap Images"
task :imgs => ASSETS_IMGS
desc "Update Twitter's Bootstrap JS"
task :js => ASSETS_JS do
js = {}
ASSETS_JS.pathmap("%f").each do |f|
js[f] = 1
end
# dependencies
js["transition.js"] = 0
js["tooltip.js"] = 2
js["popover.js"] = 3
list = js.to_a.sort {|a,b| a[1] <=> b[1]}.map{|p| p[0]}
File.write "vendor/assets/javascripts/twitter/bootstrap.js", list.map {|f| "//= require twitter/bootstrap/#{f}"}.join("\n")
end
desc "Update Twitter's Bootstrap SCSS"
task :scss => ASSETS_SCSS do
File.write "vendor/frameworks/twitter/bootstrap.scss", '@import "bootstrap/bootstrap.scss";'
File.write "vendor/assets/stylesheets/twitter/bootstrap.scss", '@import "twitter/bootstrap/bootstrap.scss";'
File.write "vendor/assets/stylesheets/twitter/bootstrap-responsive.scss", '@import "twitter/bootstrap/responsive.scss";'
end
desc "Update Twitter's Bootstrap Assets"
task :assets => [:pull, :imgs, :scss, :js]
end
require 'rake/testtask'
Rake::TestTask.new do |t|
t.libs << "test"
t.test_files = FileList['test/*_test.rb']
t.verbose = true
end