more hacking

This commit is contained in:
John Bintz 2012-03-08 10:14:29 -05:00
parent fe51eda8a3
commit e9212c6743
6 changed files with 35 additions and 8 deletions

View File

@ -8,12 +8,14 @@ class Flowerbox::CLI < Thor
method_options :pwd => :string method_options :pwd => :string
method_options :runners => :string method_options :runners => :string
method_options :verbose => false method_options :verbose => false
def test(dir) def test(dir = "spec/javascripts")
Dir.chdir(pwd) do Dir.chdir(pwd) do
exit Flowerbox.run(dir, options) exit Flowerbox.run(dir, options)
end end
end end
default_task :test
no_tasks do no_tasks do
def pwd def pwd
options[:pwd] || Dir.pwd options[:pwd] || Dir.pwd
@ -26,3 +28,4 @@ class Flowerbox::CLI < Thor
end end
Flowerbox::CLI.start Flowerbox::CLI.start

View File

@ -82,6 +82,8 @@ module Flowerbox
result_set = ResultSet.new result_set = ResultSet.new
Flowerbox.runner_environment.each do |env| Flowerbox.runner_environment.each do |env|
env.ensure_configured!
result_set << env.run(build_sprockets_for(dir), spec_files_for(dir), options) result_set << env.run(build_sprockets_for(dir), spec_files_for(dir), options)
end end

View File

@ -24,10 +24,6 @@ module Flowerbox
end end
empty_post '/results' do empty_post '/results' do
p "made it"
p data
runner.finish!(data.flatten.first) runner.finish!(data.flatten.first)
end end

View File

@ -26,6 +26,20 @@ module Flowerbox
@results @results
end end
def configured?
true
end
def configure
end
def ensure_configured!
if !configured?
puts "#{console_name} is not configured for this project, configuring now..."
configure
end
end
def type def type
self.class.name.to_s.split('::').last.downcase.to_sym self.class.name.to_s.split('::').last.downcase.to_sym
end end
@ -42,7 +56,10 @@ module Flowerbox
def server def server
return @server if @server return @server if @server
@server = Flowerbox::Delivery::Server.new(:app => Flowerbox::Rack) server_options = { :app => Flowerbox::Rack }
server_options[:logging] = true if options[:verbose]
@server = Flowerbox::Delivery::Server.new(server_options)
Flowerbox::Rack.runner = self Flowerbox::Rack.runner = self
@server @server

View File

@ -20,6 +20,15 @@ module Flowerbox
:node :node
end end
def configured?
File.directory?(File.join(Dir.pwd, 'node_modules/jsdom')) &&
File.directory?(File.join(Dir.pwd, 'node_modules/XMLHttpRequest'))
end
def configure
system %{bash -c "mkdir -p node_modules && npm link jsdom && npm link xmlhttprequest"}
end
def run(sprockets, spec_files, options) def run(sprockets, spec_files, options)
super do super do
begin begin

View File

@ -14,8 +14,8 @@ module Flowerbox
end end
def start_for(runner) def start_for(runner)
@sprockets.add("flowerbox/jasmine") @sprockets.add("flowerbox/jasmine.js")
@sprockets.add("flowerbox/jasmine/#{runner.type}") @sprockets.add("flowerbox/jasmine/#{runner.type}.js")
runner.spec_files.each { |file| @sprockets.add(file) } runner.spec_files.each { |file| @sprockets.add(file) }