Skip to content
Browse files

make the admin CLI use the config file.

  • Loading branch information...
1 parent 8202960 commit ed41c0f2194f50face71a238a2ce0bd9f5e16a12 @braintreeps braintreeps committed Oct 24, 2012
Showing with 6 additions and 8 deletions.
  1. +2 −1 lib/litmus_paper/cli/admin.rb
  2. +3 −6 lib/litmus_paper/cli/admin/command.rb
  3. +1 −1 spec/litmus_paper/cli/admin_spec.rb
View
3 lib/litmus_paper/cli/admin.rb
@@ -15,7 +15,8 @@ def run(argv = ARGV)
if command = Admin.commands[command_name]
options = {}
request = command.build_request(options, argv)
- _litmus_request(options[:host], options[:port], request)
+ LitmusPaper.configure(options[:litmus_config])
+ _litmus_request('127.0.0.1', LitmusPaper.port, request)
else
_display_help
end
View
9 lib/litmus_paper/cli/admin/command.rb
@@ -3,18 +3,15 @@ module CLI
class Admin
class Command
def self._default_options
- options = { :port => 9292, :host => '127.0.0.1' }
+ options = { :litmus_config => "/etc/litmus.conf" }
end
def self._extend_default_parser(options, &block)
OptionParser.new do |opts|
block.call(opts)
- opts.on("-p", "--port=port", Integer, "Port litmus is running on", "Default: 9292") do |port|
- options[:port] = port
- end
- opts.on("-h", "--host=ip", String, ":Host litmus is running on", "Default: localhost") do |host|
- options[:host] = host
+ opts.on("-c", "--config=file", String, "Litmus configuration file", "Default: /etc/litmus.conf") do |config|
+ options[:litmus_config] = config
end
opts.on("--help", "Show this help message.") { puts opts; exit }
end
View
2 spec/litmus_paper/cli/admin_spec.rb
@@ -3,7 +3,7 @@
describe 'litmusctl' do
def _litmusctl(args)
- `bundle exec ruby -I lib bin/litmusctl #{args} -p 9293`
+ `bundle exec ruby -I lib bin/litmusctl #{args} -c #{TEST_CONFIG}`
end
before(:all) do

0 comments on commit ed41c0f

Please sign in to comment.
Something went wrong with that request. Please try again.