From 75bb56f294c40ab70d021e655a9bd6db39de9e04 Mon Sep 17 00:00:00 2001 From: ragaskar Date: Thu, 15 Oct 2009 00:27:46 -0700 Subject: [PATCH] Loads an optional second command line var to monkey patch jasminehelper --- bin/jasmine | 9 ++++++--- lib/jasmine-ruby/jasmine_helper.rb | 6 +++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/bin/jasmine b/bin/jasmine index f11ad93..9c00079 100755 --- a/bin/jasmine +++ b/bin/jasmine @@ -1,16 +1,19 @@ #!/usr/bin/env ruby require File.expand_path(File.join(File.dirname(__FILE__), "..", "lib", "jasmine-ruby", "jasmine_helper.rb")) +if ARGV[1] + require File.expand_path(File.join(Dir.pwd, ARGV[1])) +end if ARGV[0] == 'server' require 'rubygems' - require File.expand_path(File.join(JasmineHelper.jasmine_root, "contrib/ruby/jasmine_spec_builder")) + require File.expand_path(File.join(__FILE__, "../../jasmine/contrib/ruby/jasmine_spec_builder")) puts "your tests are here:" puts " http://localhost:8888/run.html" - JASMINE_SPEC_DIR = ARGV[1] || File.join(`pwd`.chomp, "spec") + JASMINE_SPEC_DIR = ARGV[1] || File.join(Dir.pwd, "spec") Jasmine::SimpleServer.start(8888, - lambda { JasmineHelper.spec_file_urls }, + lambda { JasmineHelper.specs }, JasmineHelper.dir_mappings) end # diff --git a/lib/jasmine-ruby/jasmine_helper.rb b/lib/jasmine-ruby/jasmine_helper.rb index 552f251..e4609ec 100755 --- a/lib/jasmine-ruby/jasmine_helper.rb +++ b/lib/jasmine-ruby/jasmine_helper.rb @@ -29,12 +29,12 @@ class JasmineHelper end end - def self.raw_spec_files + def self.spec_files Dir.glob(File.join(jasmine_spec_dir, "**/*[Ss]pec.js")) end - def self.spec_file_urls - raw_spec_files.collect {|f| f.sub(jasmine_spec_dir, "/spec")} + def self.specs + spec_files.collect {|f| f.sub(jasmine_spec_dir, "/spec")} end def self.dir_mappings