Browse files

fixed option parser to parse passed args instead of global ARGV

  • Loading branch information...
1 parent bc3702c commit 54285b6442ab54331e70697aed77a68bc9e3d4f2 Andre Lewis committed Nov 29, 2009
Showing with 9 additions and 11 deletions.
  1. +1 −1 lib/scout.rb
  2. +8 −10 lib/scout/command.rb
View
2 lib/scout.rb
@@ -1,7 +1,7 @@
#!/usr/bin/env ruby -wKU
module Scout
- VERSION = "4.0.2".freeze
+ VERSION = "5.0.0".freeze
end
require "scout/command"
View
18 lib/scout/command.rb
@@ -25,7 +25,7 @@ def self.usage
def self.parse_options(argv)
options = { }
- ARGV.options do |opts|
+ op = OptionParser.new do |opts|
opts.banner = "Usage:"
opts.separator " Normal checkin with server:"
@@ -99,16 +99,15 @@ def self.parse_options(argv)
opts.on( "-F", "--force", "Force checkin to Scout server regardless of last checkin time") do |bool|
options[:force] = bool
end
-
- begin
- opts.parse!
- @usage = opts.to_s
- rescue
- puts opts
- exit
- end
end
+ begin
+ op.parse!(argv)
+ @usage = op.to_s
+ rescue
+ puts op
+ exit
+ end
options
end
private_class_method :parse_options
@@ -124,7 +123,6 @@ def self.dispatch(argv)
else
Install.new(options, argv)
end
-
command.run
end

0 comments on commit 54285b6

Please sign in to comment.