Files
jasmine/tasks/jasmine_dev/build_distribution.rb
Dan Hansen and Davis W. Frank cf7bb0269b Added grunt to project.
Move from embedded "fork" of jsHint to using grunt's jsHint module.
Cleaned ALL jsHint errors.
Added jasmine.util.isUndefined as alternative to extra careful protection against undefined clobbering
2013-03-01 14:28:18 -08:00

51 lines
1.4 KiB
Ruby

class JasmineDev < Thor
desc "build_distribution", "Build Jasmine js & css files"
def build_distribution(directory = "./lib/jasmine-core")
say JasmineDev.spacer
say "Building Jasmine distribution from source into #{directory}", :cyan
say 'Building JavaScript...', :yellow
inside directory do
create_file "jasmine.js",
concat_contents_of(jasmine_js_paths),
:force => true
create_file "jasmine-html.js",
concat_contents_of(jasmine_html_js_paths),
:force => true
end
say 'Building CSS...', :yellow
run "compass compile", :capture => true
copy_file File.join("#{JasmineDev.project_root}", 'src', 'html', 'jasmine.css'),
File.join(directory, 'jasmine.css')
end
no_tasks do
def jasmine_js_paths
paths = JasmineDev::JASMINE_SOURCES[:core].collect do |f|
File.join(JasmineDev.project_root, 'src', 'core', f)
end
paths << File.join(JasmineDev.project_root, 'src', 'version.js')
paths
end
def jasmine_html_js_paths
JasmineDev::JASMINE_SOURCES[:html].collect do |f|
File.join(JasmineDev.project_root, 'src', 'html', f)
end
end
def concat_contents_of(paths)
paths.inject("") do |string, path|
string << File.read(path)
string
end
end
end
end