start of file listing

This commit is contained in:
John Bintz 2011-08-22 13:26:48 -04:00
parent ac5b8a4c98
commit d039aba84b
3 changed files with 29 additions and 3 deletions

View File

@ -13,8 +13,19 @@ require 'jasmine/headless/runner'
require 'jasmine/headless/options' require 'jasmine/headless/options'
begin begin
options = Jasmine::Headless::Options.from_command_line
runner = Jasmine::Headless::Runner.new(options)
if options[:do_list]
files_list = Jasmine::FilesList.new(
:config => runner.jasmine_config
)
files_list.files.each { |file| puts file }
else
puts "Running Jasmine specs...".color(:white) puts "Running Jasmine specs...".color(:white)
exit Jasmine::Headless::Runner.run(Jasmine::Headless::Options.from_command_line) exit runner.run
end
rescue CoffeeScript::CompilationError rescue CoffeeScript::CompilationError
exit 1 exit 1
rescue StandardError => e rescue StandardError => e

View File

@ -13,6 +13,7 @@ module Jasmine
:remove_html_file => true, :remove_html_file => true,
:jasmine_config => 'spec/javascripts/support/jasmine.yml', :jasmine_config => 'spec/javascripts/support/jasmine.yml',
:report => false, :report => false,
:do_list => false,
:full_run => true, :full_run => true,
:files => [] :files => []
} }
@ -48,6 +49,8 @@ module Jasmine
@options[:jasmine_config] = arg @options[:jasmine_config] = arg
when '--no-full-run' when '--no-full-run'
@options[:full_run] = false @options[:full_run] = false
when '--list', '-l'
@options[:do_list] = true
end end
end end
@ -66,7 +69,8 @@ module Jasmine
[ '--keep', GetoptLong::NO_ARGUMENT ], [ '--keep', GetoptLong::NO_ARGUMENT ],
[ '--report', GetoptLong::REQUIRED_ARGUMENT ], [ '--report', GetoptLong::REQUIRED_ARGUMENT ],
[ '--jasmine-config', '-j', GetoptLong::REQUIRED_ARGUMENT ], [ '--jasmine-config', '-j', GetoptLong::REQUIRED_ARGUMENT ],
[ '--no-full-run', GetoptLong::NO_ARGUMENT ] [ '--no-full-run', GetoptLong::NO_ARGUMENT ],
[ '--list', '-l', GetoptLong::NO_ARGUMENT ]
) )
command_line_args.each { |*args| process_option(*args) } command_line_args.each { |*args| process_option(*args) }

View File

@ -118,5 +118,16 @@ describe "jasmine-headless-webkit" do
end end
end end
end end
describe 'files' do
it 'should list all the files that will be found' do
files = %x{bin/jasmine-headless-webkit -l -j spec/jasmine/success/success.yml}
p files
$?.exitstatus.should == 0
files.lines.to_a.should include("./spec/jasmine/success/success.js\n")
files.lines.to_a.should include("./spec/jasmine/success/success_spec.js\n")
end
end
end end