added init task
This commit is contained in:
parent
546604fdc8
commit
391c42533f
18
bin/jasmine
18
bin/jasmine
@ -1,18 +1,26 @@
|
|||||||
#!/usr/bin/env ruby
|
#!/usr/bin/env ruby
|
||||||
require File.expand_path(File.join(File.dirname(__FILE__), "..", "lib", "jasmine-ruby", "jasmine_helper.rb"))
|
require 'rubygems'
|
||||||
|
cwd = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
||||||
|
p cwd
|
||||||
|
require File.expand_path(File.join(cwd, "lib", "jasmine-ruby", "jasmine_helper.rb"))
|
||||||
|
|
||||||
|
#to load JasmineHelper overrides
|
||||||
if ARGV[1]
|
if ARGV[1]
|
||||||
require File.expand_path(File.join(Dir.pwd, ARGV[1]))
|
require File.expand_path(File.join(Dir.pwd, ARGV[1]))
|
||||||
end
|
end
|
||||||
|
|
||||||
if ARGV[0] == 'server'
|
if ARGV[0] == 'server'
|
||||||
require 'rubygems'
|
require File.expand_path(File.join(cwd, "jasmine/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(Dir.pwd, "spec")
|
|
||||||
Jasmine::SimpleServer.start(8888,
|
Jasmine::SimpleServer.start(8888,
|
||||||
lambda { JasmineHelper.specs },
|
lambda { JasmineHelper.specs },
|
||||||
JasmineHelper.dir_mappings)
|
JasmineHelper.dir_mappings)
|
||||||
|
end
|
||||||
|
|
||||||
|
if ARGV[0] == 'init'
|
||||||
|
require 'ftools'
|
||||||
|
File.makedirs('spec')
|
||||||
|
dest_dir = File.expand_path(File.join(Dir.pwd, 'spec'))
|
||||||
|
File.copy(File.expand_path(File.join(cwd, 'templates/example_spec.js')), dest_dir)
|
||||||
end
|
end
|
@ -22,10 +22,10 @@ class JasmineHelper
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.jasmine_spec_dir
|
def self.jasmine_spec_dir
|
||||||
if defined? JASMINE_SPEC_DIR
|
if defined? rails_root
|
||||||
File.expand_path(File.join(JASMINE_SPEC_DIR))
|
|
||||||
else
|
|
||||||
File.expand_path(File.join(rails_root, "spec", "javascript"))
|
File.expand_path(File.join(rails_root, "spec", "javascript"))
|
||||||
|
else
|
||||||
|
File.expand_path('spec')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
11
templates/example_spec.js
Normal file
11
templates/example_spec.js
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
describe('ExampleSuite', function () {
|
||||||
|
it('should have a passing test', function() {
|
||||||
|
expect(true).toEqual(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('Nested Describe', function () {
|
||||||
|
it('should also have a passing test', function () {
|
||||||
|
expect(true).toEqual(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in New Issue
Block a user