Loads an optional second command line var to monkey patch jasminehelper
This commit is contained in:
parent
add3e1ee7a
commit
75bb56f294
@ -1,16 +1,19 @@
|
|||||||
#!/usr/bin/env ruby
|
#!/usr/bin/env ruby
|
||||||
require File.expand_path(File.join(File.dirname(__FILE__), "..", "lib", "jasmine-ruby", "jasmine_helper.rb"))
|
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'
|
if ARGV[0] == 'server'
|
||||||
require 'rubygems'
|
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 "your tests are here:"
|
||||||
puts " http://localhost:8888/run.html"
|
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,
|
Jasmine::SimpleServer.start(8888,
|
||||||
lambda { JasmineHelper.spec_file_urls },
|
lambda { JasmineHelper.specs },
|
||||||
JasmineHelper.dir_mappings)
|
JasmineHelper.dir_mappings)
|
||||||
end
|
end
|
||||||
#
|
#
|
||||||
|
@ -29,12 +29,12 @@ class JasmineHelper
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.raw_spec_files
|
def self.spec_files
|
||||||
Dir.glob(File.join(jasmine_spec_dir, "**/*[Ss]pec.js"))
|
Dir.glob(File.join(jasmine_spec_dir, "**/*[Ss]pec.js"))
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.spec_file_urls
|
def self.specs
|
||||||
raw_spec_files.collect {|f| f.sub(jasmine_spec_dir, "/spec")}
|
spec_files.collect {|f| f.sub(jasmine_spec_dir, "/spec")}
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.dir_mappings
|
def self.dir_mappings
|
||||||
|
Loading…
Reference in New Issue
Block a user