Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

quiet option for spork server #163

Merged
merged 1 commit into from May 4, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/spork/runner.rb
Expand Up @@ -22,6 +22,7 @@ def initialize(args, output, error)
opt.on("-b", "--bootstrap") {|ignore| @options[:bootstrap] = true } opt.on("-b", "--bootstrap") {|ignore| @options[:bootstrap] = true }
opt.on("-d", "--diagnose") {|ignore| @options[:diagnose] = true } opt.on("-d", "--diagnose") {|ignore| @options[:diagnose] = true }
opt.on("-h", "--help") {|ignore| @options[:help] = true } opt.on("-h", "--help") {|ignore| @options[:help] = true }
opt.on("-q", "--quiet") {|ignore| @options[:quiet] = true }
opt.on("-p", "--port [PORT]") {|port| @options[:port] = port } opt.on("-p", "--port [PORT]") {|port| @options[:port] = port }
non_option_args = args.select { |arg| ! args[0].match(/^-/) } non_option_args = args.select { |arg| ! args[0].match(/^-/) }
@options[:server_matcher] = non_option_args[0] @options[:server_matcher] = non_option_args[0]
Expand Down Expand Up @@ -72,7 +73,7 @@ def run
else else
run_strategy = Spork::RunStrategy.factory(test_framework) run_strategy = Spork::RunStrategy.factory(test_framework)
return(false) unless run_strategy.preload return(false) unless run_strategy.preload
Spork::Server.run(:port => @options[:port] || test_framework.default_port, :run_strategy => run_strategy) Spork::Server.run(:port => @options[:port] || test_framework.default_port, :run_strategy => run_strategy, :quiet => @options[:quiet])
return true return true
end end
end end
Expand Down
5 changes: 3 additions & 2 deletions lib/spork/server.rb
Expand Up @@ -14,6 +14,7 @@ class Spork::Server
def initialize(options = {}) def initialize(options = {})
@run_strategy = options[:run_strategy] @run_strategy = options[:run_strategy]
@port = options[:port] @port = options[:port]
@quiet = options[:quiet]
end end


def self.run(options = {}) def self.run(options = {})
Expand Down Expand Up @@ -44,9 +45,9 @@ def listen
# #
# When implementing a test server, don't override this method: override run_tests instead. # When implementing a test server, don't override this method: override run_tests instead.
def run(argv, stderr, stdout) def run(argv, stderr, stdout)
puts "Running tests with args #{argv.inspect}..." puts "Running tests with args #{argv.inspect}..." unless @quiet
result = run_strategy.run(argv, stderr, stdout) result = run_strategy.run(argv, stderr, stdout)
puts "Done.\n\n" puts "Done.\n\n" unless @quiet
result result
end end


Expand Down