forked from seyhunak/twitter-bootstrap-rails
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
44 lines (34 loc) · 1.2 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
#!/usr/bin/env rake
require 'bundler'
require 'rspec/core/rake_task'
Bundler::GemHelper.install_tasks
desc "Bundle the gem"
task :bundle => [:bundle_install, :build_static_stylesheets] do
sh 'gem build *.gemspec'
sh 'gem install *.gem'
sh 'rm *.gem'
end
desc "Runs bundle install"
task :bundle_install do
sh('bundle install')
end
desc "Build the static precompiled stylesheets from Less sources"
task :build_static_stylesheets do
require 'less'
toolkit_path = File.join('vendor', 'toolkit')
parser = Less::Parser.new :paths => [toolkit_path]
target_directory = File.expand_path('app/assets/stylesheets/twitter-bootstrap-static')
sh "rm -rf #{target_directory}"
sh "mkdir -p #{target_directory}"
Dir['vendor/static-source/*.less'].each do |source_file|
puts "Compiling #{source_file}"
target_file = File.join(target_directory, File.basename(source_file, '.less')+'.css.erb')
tree = parser.parse(File.read(source_file))
File.open(target_file, 'w') {|f| f.puts tree.to_css(:compress => true) }
end
end
task(:default).clear
task :default => :bundle
RSpec::Core::RakeTask.new do |task|
task.rspec_opts = ['--color', '--format', 'doc']
end