-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathRakefile
More file actions
61 lines (51 loc) · 1.75 KB
/
Copy pathRakefile
File metadata and controls
61 lines (51 loc) · 1.75 KB
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
desc "Start console for app"
task :console do
exec('bundle exec irb -I. -rapplication')
end
desc "Run tests"
task :test do
exec 'rspec spec'
end
# from https://github.com/gudleik/twitter-bootstrapped
namespace :bootstrap do
# desc "One time bootstrap setup"
task :init do
system "mkdir -p vendor; git submodule add -f https://github.com/twitter/bootstrap.git vendor/twitter-bootstrap"
end
# desc 'Initialize the twitter bootstrap submodule'
task :setup do
`git submodule --quiet update`
end
# desc 'Sync twitter bootstrap repo'
task :update_repo => :setup do
`cd vendor/twitter-bootstrap; git checkout --quiet master; git pull --quiet origin master`
end
# desc 'Compile the assets. Requires lessc and uglifyjs'
# To install: npm install -g less uglify-js
task :make => [:update_repo] do
`cd vendor/twitter-bootstrap; make`
end
def command_exists?(cmd)
`which #{cmd} 2> /dev/null`
$?.success?
end
# desc 'Compile assets if possible or use prebuilt one that twitter includes'
task :find_or_create_zip do
if command_exists?('lessc') && command_exists?('uglifyjs')
puts "Compiling bootstrap.zip from latest source..."
Rake::Task['bootstrap:make'].invoke
else
puts "Using latest prebuilt bootstrap.zip..."
Rake::Task['bootstrap:update_repo'].invoke
end
end
# desc 'Install and cleanup after compile'
task :install => :find_or_create_zip do
`unzip -d public/ vendor/twitter-bootstrap/docs/assets/bootstrap.zip`
`cd vendor/twitter-bootstrap; git co -- .`
`cp vendor/twitter-bootstrap/docs/assets/js/jquery.js public/bootstrap/js/`
end
desc 'Fetch latest version, compile if possible and install assets into the app'
task :update => :install
end
task :default => :test