Move to grunt for building all distribution files.
* canonical version number of jasmine-core is now is package.json * `grunt buildDistribution` builds jasmine.js, jasmine-html.js, jasmine.css and outputs them to the dist dir * `grunt buildStandaloneDist` builds the example spec runner files and compresses them to dist/jasmine-VERSION.zip * `grunt compass` compiles jasmine.css * jasmine.Env handling of version is backwards compatible, but uses the version string directly (and nicely deprecated) * Ruby/thor tasks that did the above deleted
This commit is contained in:
@@ -1,33 +0,0 @@
|
||||
require 'spec_helper.rb'
|
||||
|
||||
describe "Build Jasmine task" do
|
||||
|
||||
let(:jasmine_core_dir) { "#{Dir.tmpdir}/jasmine-core" }
|
||||
let(:jasmine_dev) { JasmineDev.new }
|
||||
|
||||
before do
|
||||
reset_dir jasmine_core_dir
|
||||
@output = capture_output { jasmine_dev.build_distribution jasmine_core_dir }
|
||||
end
|
||||
|
||||
it "should say that JSHint is running" do
|
||||
@output.should match(/Running JSHint/)
|
||||
@output.should match(/Jasmine JSHint PASSED/)
|
||||
end
|
||||
|
||||
it "should tell the developer it is building the distribution" do
|
||||
@output.should match(/Building Jasmine distribution/)
|
||||
end
|
||||
|
||||
it "should build jasmine.js in the destination directory" do
|
||||
File.exist?("#{jasmine_core_dir}/jasmine.js").should be_true
|
||||
end
|
||||
|
||||
it "should build jasmine-html.js in the destination directory" do
|
||||
File.exist?("#{jasmine_core_dir}/jasmine-html.js").should be_true
|
||||
end
|
||||
|
||||
it "should build jasmine.css" do
|
||||
File.exist?("#{jasmine_core_dir}/jasmine.css").should be_true
|
||||
end
|
||||
end
|
||||
@@ -1,109 +0,0 @@
|
||||
require 'spec_helper.rb'
|
||||
|
||||
describe "Standalone Distribution tasks" do
|
||||
|
||||
let(:jasmine_dev) { JasmineDev.new }
|
||||
let(:standalone_temp_dir) { File.join(Dir.tmpdir, 'jasmine_test') }
|
||||
let(:download_dir) { File.join(standalone_temp_dir, 'download')}
|
||||
|
||||
describe "build_standalone_distribution" do
|
||||
before do
|
||||
reset_dir standalone_temp_dir
|
||||
reset_dir download_dir
|
||||
|
||||
Dir.should_receive(:tmpdir).any_number_of_times.and_return(standalone_temp_dir)
|
||||
|
||||
@standalone_staging_dir = File.join(standalone_temp_dir, 'jasmine_standalone')
|
||||
|
||||
@version_dir = File.join(@standalone_staging_dir, "jasmine-standalone-#{jasmine_version}")
|
||||
@lib_dir = File.join(@version_dir, 'lib')
|
||||
@source_dir = File.join(@version_dir, 'src')
|
||||
@spec_dir = File.join(@version_dir, 'spec')
|
||||
|
||||
@output = capture_output { jasmine_dev.build_standalone_distribution download_dir }
|
||||
end
|
||||
|
||||
it "should build the distribution" do
|
||||
@output.should match(/Building Jasmine distribution/)
|
||||
end
|
||||
|
||||
it "should tell the developer the task has started" do
|
||||
@output.should match(/Building standalone distribution/)
|
||||
end
|
||||
|
||||
it "should copy the lib directory to the staging directory, under a versioned directory" do
|
||||
lib_dir_files = Dir.glob(File.join(standalone_temp_dir, 'jasmine_standalone', '**', '*'))
|
||||
|
||||
staged_lib_files = %w{ jasmine.js jasmine-html.js jasmine.css MIT.LICENSE }
|
||||
staged_lib_files.each do |filename|
|
||||
lib_dir_files.should include(File.join(@lib_dir, "jasmine-#{jasmine_version}", filename))
|
||||
end
|
||||
end
|
||||
|
||||
it "should copy the sample project source to the staging directory" do
|
||||
File.exist?(File.join(@source_dir, 'Player.js')).should be_true
|
||||
File.exist?(File.join(@source_dir, 'Song.js')).should be_true
|
||||
end
|
||||
|
||||
it "should copy the sample project specs to the staging directory" do
|
||||
File.exist?(File.join(@spec_dir, 'PlayerSpec.js')).should be_true
|
||||
File.exist?(File.join(@spec_dir, 'SpecHelper.js')).should be_true
|
||||
end
|
||||
|
||||
it "should copy a build SpecRunner.html to the staging directory" do
|
||||
File.exist?(File.join(@version_dir, 'SpecRunner.html')).should be_true
|
||||
end
|
||||
|
||||
it "should zip up the contents of the staging directory" do
|
||||
File.exist?(File.join(@standalone_staging_dir, "jasmine-standalone-#{jasmine_version}.zip")).should be_true
|
||||
end
|
||||
|
||||
it "should copy the zip file to the pages sub directory" do
|
||||
File.exist?(File.join(download_dir, "jasmine-standalone-#{jasmine_version}.zip")).should be_true
|
||||
end
|
||||
|
||||
describe "when the zip file is unzipped" do
|
||||
before do
|
||||
@out_directory = File.join(standalone_temp_dir, 'unzip')
|
||||
reset_dir @out_directory
|
||||
|
||||
FileUtils.cp File.join(@standalone_staging_dir, "jasmine-standalone-#{jasmine_version}.zip"),
|
||||
@out_directory
|
||||
|
||||
Dir.chdir @out_directory do
|
||||
system("unzip -qq jasmine-standalone-#{jasmine_version}.zip")
|
||||
end
|
||||
end
|
||||
|
||||
describe "the distirbution" do
|
||||
before do
|
||||
Dir.chdir @out_directory do
|
||||
@files = Dir.glob(File.join('**', '*'))
|
||||
end
|
||||
end
|
||||
|
||||
it "should include the correct root files" do
|
||||
@files.should include('SpecRunner.html')
|
||||
end
|
||||
|
||||
it "should include the correct lib files" do
|
||||
%w{ jasmine.js jasmine-html.js jasmine.css MIT.LICENSE }.each do |file|
|
||||
@files.should include(File.join('lib', "jasmine-#{jasmine_version}", file))
|
||||
end
|
||||
end
|
||||
|
||||
it "should include the correct src files" do
|
||||
%w{Player.js Song.js}.each do |file|
|
||||
@files.should include(File.join('src', file))
|
||||
end
|
||||
end
|
||||
|
||||
it "should include the correct spec files" do
|
||||
%w{PlayerSpec.js SpecHelper.js}.each do |file|
|
||||
@files.should include(File.join('spec', file))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,63 +0,0 @@
|
||||
require 'spec_helper.rb'
|
||||
|
||||
describe "Build Standalone runner HTML task" do
|
||||
|
||||
let(:jasmine_dev) { JasmineDev.new }
|
||||
let(:standalone_temp_dir) { "#{Dir.tmpdir}/jasmine_test" }
|
||||
|
||||
describe "build_standalone_runner" do
|
||||
before do
|
||||
reset_dir standalone_temp_dir
|
||||
Dir.should_receive(:tmpdir).any_number_of_times.and_return(standalone_temp_dir)
|
||||
|
||||
@standalone_staging_dir = File.join(standalone_temp_dir, 'jasmine_standalone')
|
||||
|
||||
@version_dir = File.join(@standalone_staging_dir, "jasmine-standalone-#{jasmine_version}")
|
||||
|
||||
@output = capture_output { jasmine_dev.build_standalone_runner }
|
||||
end
|
||||
|
||||
it "should tell the developer the task has started" do
|
||||
@output.should match(/Building standalone runner HTML/)
|
||||
end
|
||||
|
||||
it "should copy a build SpecRunner.html to the staging directory" do
|
||||
File.exist?(File.join(@version_dir, 'SpecRunner.html')).should be_true
|
||||
end
|
||||
|
||||
describe "should build the file that has HTML that" do
|
||||
before do
|
||||
html = File.read(File.join(@version_dir, 'SpecRunner.html'))
|
||||
@runner = Nokogiri(html)
|
||||
end
|
||||
|
||||
it "should have the favicon tag" do
|
||||
favicon_tag = @runner.css('link')[0]
|
||||
favicon_tag['href'].should match("lib/jasmine-#{jasmine_version}/jasmine_favicon.png")
|
||||
end
|
||||
|
||||
it "should have the stylesheet" do
|
||||
css_tag = @runner.css('link')[1]
|
||||
css_tag['href'].should match("lib/jasmine-#{jasmine_version}/jasmine.css")
|
||||
end
|
||||
|
||||
it "should have the jasmine script tags" do
|
||||
script_sources = @runner.css('script').collect {|tag| tag['src']}
|
||||
script_sources.should include("lib/jasmine-#{jasmine_version}/jasmine.js")
|
||||
script_sources.should include("lib/jasmine-#{jasmine_version}/jasmine-html.js")
|
||||
end
|
||||
|
||||
it "should have the example source files" do
|
||||
script_sources = @runner.css('script').collect {|tag| tag['src']}
|
||||
script_sources.should include('src/Player.js')
|
||||
script_sources.should include('src/Song.js')
|
||||
end
|
||||
|
||||
it "should have the example source files" do
|
||||
script_sources = @runner.css('script').collect {|tag| tag['src']}
|
||||
script_sources.should include('spec/SpecHelper.js')
|
||||
script_sources.should include('spec/PlayerSpec.js')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,55 +0,0 @@
|
||||
require 'spec_helper.rb'
|
||||
|
||||
describe "Version tasks" do
|
||||
|
||||
let(:jasmine_dev) { JasmineDev.new }
|
||||
|
||||
describe "write_version_files" do
|
||||
|
||||
before do
|
||||
@output = capture_output { jasmine_dev.write_version_files }
|
||||
end
|
||||
|
||||
it "should tell the user that the task has started" do
|
||||
@output.should match(/Building version files/)
|
||||
end
|
||||
|
||||
it "should build the version.js file" do
|
||||
js_version = File.read(File.join(project_root, 'src', 'version.js'))
|
||||
js_version.should match(%Q{"build": #{jasmine_version_object["build"]}})
|
||||
js_version.should match(%Q{"minor": #{jasmine_version_object["minor"]}})
|
||||
js_version.should match(%Q{"build": #{jasmine_version_object["build"]}})
|
||||
|
||||
if jasmine_version_object["release_candidate"]
|
||||
js_version.should match(%Q{"release_candidate": #{jasmine_version_object["release_candidate"]}})
|
||||
end
|
||||
|
||||
js_version.should match(/"revision": \d+/)
|
||||
end
|
||||
|
||||
it "should build the jasmine-core ruby gem version" do
|
||||
ruby_version = File.read(File.join(project_root, 'lib', 'jasmine-core', 'version.rb'))
|
||||
ruby_version.should match(%Q{VERSION = "#{jasmine_version}"})
|
||||
end
|
||||
end
|
||||
|
||||
describe "display_version" do
|
||||
describe "when Node.js is not present" do
|
||||
before do
|
||||
@output = capture_output { jasmine_dev.display_version }
|
||||
end
|
||||
|
||||
it "should display a version header" do
|
||||
@output.should match(/Current version/)
|
||||
end
|
||||
|
||||
it "should display the current version Object" do
|
||||
@output.should match(/Display version: \e\[33m\d+\.\d+\.\d+/)
|
||||
end
|
||||
|
||||
it "should display the current version string" do
|
||||
@output.should match(/\{ "major": \d+, "minor": \d+, "build": \d+/)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user