44 lines
1.1 KiB
Ruby
Executable File
44 lines
1.1 KiB
Ruby
Executable File
#!/usr/bin/env ruby
|
|
|
|
require 'flowerbox'
|
|
require 'flowerbox-delivery'
|
|
require 'thor'
|
|
|
|
class Flowerbox::CLI < Thor
|
|
desc "test DIR", "Run the specs found in spec dir, loading spec_helper.rb for configuration details"
|
|
method_options :pwd => :string
|
|
def test(dir)
|
|
Dir.chdir(pwd) do
|
|
load File.join(dir, 'spec_helper.rb')
|
|
|
|
require 'tilt/coffee'
|
|
|
|
Tilt::CoffeeScriptTemplate.default_bare = Flowerbox.bare_coffeescript
|
|
|
|
sprockets = Flowerbox::Delivery::SprocketsHandler.new(:asset_paths => [ Flowerbox.path.join("lib/assets/javascripts"), dir, Flowerbox.asset_paths ].flatten)
|
|
|
|
Flowerbox.test_environment.inject_into(sprockets)
|
|
|
|
Flowerbox.spec_patterns.each do |pattern|
|
|
Dir[File.join(dir, pattern)].each do |file|
|
|
sprockets.add(file.gsub(dir + '/', ''))
|
|
end
|
|
end
|
|
|
|
exit Flowerbox.runner_environment.run(sprockets)
|
|
end
|
|
end
|
|
|
|
no_tasks do
|
|
def pwd
|
|
options[:pwd] || Dir.pwd
|
|
end
|
|
|
|
def asset_paths
|
|
Flowerbox.asset_paths.collect { |path| File.join(pwd, path) }
|
|
end
|
|
end
|
|
end
|
|
|
|
Flowerbox::CLI.start
|