Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

CLI option for specifying the file that additional arguments are load…

…ed from (previously hard-coded to testjour.yml)
  • Loading branch information...
commit efa144296111ad27f1797e33691798b0bed5b08c 1 parent b3e5693
@lukemelia lukemelia authored
View
12 lib/testjour/commands/run.rb
@@ -16,7 +16,7 @@ module Commands
class Run < Command
def execute
- configuration.unshift_args(testjour_yml_args)
+ configuration.load_additional_args_from_external_file
configuration.parse!
configuration.setup
@@ -86,16 +86,6 @@ def start_slave
detached_exec(local_run_command)
end
- def testjour_yml_args
- @testjour_yml_args ||= begin
- if File.exist?("testjour.yml")
- File.read("testjour.yml").strip.split
- else
- []
- end
- end
- end
-
def print_results
results_formatter = ResultsFormatter.new(step_counter, configuration.options)
queue = RedisQueue.new(configuration.queue_host)
View
28 lib/testjour/configuration.rb
@@ -19,7 +19,7 @@ def language_incomplete?
# Cucumber.load_language("en")
step_mother.options = cucumber_configuration.options
end
-
+
def max_local_slaves
@options[:max_local_slaves] || 2
end
@@ -115,6 +115,28 @@ def unshift_args(pushed_args)
@args.unshift(pushed_arg)
end
end
+
+ def load_additional_args_from_external_file
+ args_from_file = begin
+ if File.exist?(args_file)
+ File.read(args_file).strip.split
+ else
+ []
+ end
+ end
+ unshift_args(args_from_file)
+ end
+
+ def args_file
+ # We need to know about this CLI option prior to OptParse's parse
+ args_file_option = @args.detect{|arg| arg =~ /^--testjour-config=/}
+ if args_file_option
+ args_file_option =~ /^--testjour-config=(.*)/
+ $1
+ else
+ 'testjour.yml'
+ end
+ end
def parse!
begin
@@ -162,6 +184,10 @@ def args_for_cucumber
def option_parser
OptionParser.new do |opts|
+ opts.on("--testjour-config=ARGS_FILE", "Load additional testjour args from the specified file (defaults to testjour.yml)") do |args_file|
+ @options[:args_file] = args_file
+ end
+
opts.on("--on=SLAVE", "Specify a slave URI") do |slave|
@options[:slaves] ||= []
@options[:slaves] << slave
View
4 lib/testjour/mysql.rb
@@ -18,10 +18,6 @@ def drop_database
def load_schema
schema_file = File.expand_path("./db/development_structure.sql")
-
- unless File.exist?(schema_file)
- end
-
run "/usr/local/mysql/bin/mysql #{runner_database_name} < #{schema_file}"
end
Please sign in to comment.
Something went wrong with that request. Please try again.