2012-05-06 19:50:46 +01:00
|
|
|
require 'rake/testtask'
|
|
|
|
Rake::TestTask.new do |t|
|
|
|
|
t.libs << "test"
|
|
|
|
t.test_files = FileList['test/*_test.rb']
|
2013-08-18 20:34:36 +02:00
|
|
|
t.verbose = true
|
2012-05-06 19:50:46 +01:00
|
|
|
end
|
|
|
|
|
2012-05-12 08:24:22 +01:00
|
|
|
desc 'Dumps output to a CSS file for testing'
|
|
|
|
task :debug do
|
|
|
|
require 'sass'
|
2013-03-21 13:06:19 -04:00
|
|
|
require './lib/bootstrap-sass/sass_functions'
|
2013-11-14 18:26:08 +01:00
|
|
|
path = Bootstrap.stylesheets_path
|
2013-04-13 15:59:28 +01:00
|
|
|
%w(bootstrap).each do |file|
|
2013-01-20 14:48:46 +00:00
|
|
|
engine = Sass::Engine.for_file("#{path}/#{file}.scss", syntax: :scss, load_paths: [path])
|
2012-06-04 11:34:57 +01:00
|
|
|
File.open("./#{file}.css", 'w') { |f| f.write(engine.render) }
|
|
|
|
end
|
2012-05-12 08:24:22 +01:00
|
|
|
end
|
|
|
|
|
2013-05-23 14:51:56 -07:00
|
|
|
desc 'Convert bootstrap to bootstrap-sass'
|
|
|
|
task :convert, :branch do |t, args|
|
|
|
|
require './tasks/converter'
|
2013-12-20 23:16:03 +01:00
|
|
|
Converter.new(branch: args[:branch]).process_bootstrap
|
|
|
|
end
|
|
|
|
|
|
|
|
desc 'LESS to stdin -> Sass to stdout'
|
|
|
|
task :less_to_scss, :branch do |t, args|
|
|
|
|
require './tasks/converter'
|
|
|
|
puts Converter.new(branch: args[:branch]).convert_less(STDIN.read)
|
2013-05-23 14:51:56 -07:00
|
|
|
end
|
|
|
|
|
2013-08-18 20:34:36 +02:00
|
|
|
desc 'Compile bootstrap-sass to tmp/ (or first arg)'
|
|
|
|
task :compile, :css_path do |t, args|
|
|
|
|
lib_path = File.join(File.dirname(__FILE__), 'lib')
|
|
|
|
$:.unshift(lib_path) unless $:.include?(lib_path)
|
|
|
|
require 'sass'
|
|
|
|
require 'bootstrap-sass/sass_functions'
|
|
|
|
require 'term/ansicolor'
|
|
|
|
|
|
|
|
path = 'vendor/assets/stylesheets'
|
2014-03-19 21:53:27 -04:00
|
|
|
css_path = args.with_defaults(css_path: 'tmp')[:css_path]
|
2013-08-18 20:34:36 +02:00
|
|
|
puts Term::ANSIColor.bold "Compiling SCSS in #{path}"
|
2014-03-19 21:53:27 -04:00
|
|
|
Dir.mkdir(css_path) unless File.directory?(css_path)
|
2013-08-18 20:34:36 +02:00
|
|
|
%w(bootstrap bootstrap/_theme).each do |file|
|
2014-03-19 21:53:27 -04:00
|
|
|
save_path = "#{css_path}/#{file.sub(/(^|\/)?_+/, '\1').sub('/', '-')}.css"
|
2013-08-18 20:34:36 +02:00
|
|
|
puts Term::ANSIColor.cyan(" #{save_path}") + '...'
|
|
|
|
engine = Sass::Engine.for_file("#{path}/#{file}.scss", syntax: :scss, load_paths: [path])
|
|
|
|
css = engine.render
|
|
|
|
File.open(save_path, 'w') { |f| f.write css }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2013-05-23 14:51:56 -07:00
|
|
|
task default: :test
|