jasmine-headless-webkit/lib/jasmine/cli.rb

55 lines
1.2 KiB
Ruby
Raw Normal View History

2011-05-06 18:05:15 +00:00
module Jasmine
module CLI
DEFAULTS = {
'spec_files' => [ '**/*[sS]pec.js' ],
'helpers' => [ 'helpers/**/*.js' ],
'spec_dir' => 'spec/javascripts',
'src_dir' => nil,
2011-05-06 18:05:15 +00:00
'stylesheets' => [],
'src_files' => []
}
2011-05-10 13:25:55 +00:00
RUNNER = 'ext/jasmine-webkit-specrunner/jasmine-webkit-specrunner'
2011-05-09 19:52:11 +00:00
DEFAULTS_FILE = '.jasmine-headless-webkit'
2011-05-16 21:19:44 +00:00
GLOBAL_DEFAULTS_FILE = File.expand_path("~/#{DEFAULTS_FILE}")
2011-05-09 19:52:11 +00:00
2011-06-10 14:04:21 +00:00
def load_config(file)
process_jasmine_config(YAML.load_file(file))
end
2011-05-06 18:05:15 +00:00
def process_jasmine_config(overrides = {})
DEFAULTS.merge(overrides)
end
2011-05-09 19:52:11 +00:00
2011-05-16 21:19:44 +00:00
def read_defaults_files!
[ GLOBAL_DEFAULTS_FILE, DEFAULTS_FILE ].each do |file|
if File.file?(file)
File.readlines(file).collect { |line| line.strip.split(' ', 2) }.each(&@process_options)
end
end
2011-05-09 19:52:11 +00:00
end
2011-05-10 13:25:55 +00:00
def jasmine_html_template(files)
end
2011-05-16 21:19:44 +00:00
2011-05-29 16:30:19 +00:00
def runner_path
@runner_path ||= File.join(gem_dir, RUNNER)
end
def jasmine_command(options, targets)
2011-05-29 16:30:19 +00:00
[
runner_path,
options[:colors] ? '-c' : nil,
options[:report] ? "-r #{options[:report]}" : nil,
*targets
2011-05-29 16:30:19 +00:00
].join(" ")
end
2011-05-16 21:19:44 +00:00
private
def read_config_file(file)
end
2011-05-06 18:05:15 +00:00
end
end