From d039aba84bc71a72b5569d6c01f852912087fbdb Mon Sep 17 00:00:00 2001 From: John Bintz Date: Mon, 22 Aug 2011 13:26:48 -0400 Subject: [PATCH] start of file listing --- bin/jasmine-headless-webkit | 15 +++++++++++++-- lib/jasmine/headless/options.rb | 6 +++++- spec/bin/jasmine-headless-webkit_spec.rb | 11 +++++++++++ 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/bin/jasmine-headless-webkit b/bin/jasmine-headless-webkit index 98c1998..a38610d 100755 --- a/bin/jasmine-headless-webkit +++ b/bin/jasmine-headless-webkit @@ -13,8 +13,19 @@ require 'jasmine/headless/runner' require 'jasmine/headless/options' begin - puts "Running Jasmine specs...".color(:white) - exit Jasmine::Headless::Runner.run(Jasmine::Headless::Options.from_command_line) + 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) + exit runner.run + end rescue CoffeeScript::CompilationError exit 1 rescue StandardError => e diff --git a/lib/jasmine/headless/options.rb b/lib/jasmine/headless/options.rb index 51cf5cd..5017eb4 100644 --- a/lib/jasmine/headless/options.rb +++ b/lib/jasmine/headless/options.rb @@ -13,6 +13,7 @@ module Jasmine :remove_html_file => true, :jasmine_config => 'spec/javascripts/support/jasmine.yml', :report => false, + :do_list => false, :full_run => true, :files => [] } @@ -48,6 +49,8 @@ module Jasmine @options[:jasmine_config] = arg when '--no-full-run' @options[:full_run] = false + when '--list', '-l' + @options[:do_list] = true end end @@ -66,7 +69,8 @@ module Jasmine [ '--keep', GetoptLong::NO_ARGUMENT ], [ '--report', 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) } diff --git a/spec/bin/jasmine-headless-webkit_spec.rb b/spec/bin/jasmine-headless-webkit_spec.rb index ebe627d..f351337 100644 --- a/spec/bin/jasmine-headless-webkit_spec.rb +++ b/spec/bin/jasmine-headless-webkit_spec.rb @@ -118,5 +118,16 @@ describe "jasmine-headless-webkit" do 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