5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/backgroundrb/bdrb_config.rb', line 5
def self.parse_cmd_options(argv)
options = { }
OptionParser.new do |opts|
script_name = File.basename($0)
opts.banner = "Usage: #{$0} [options]"
opts.separator ""
opts.on("-e", "--environment=name", String,
"Specifies the environment to operate under (test/development/production).",
"Default: development") { |v| options[:environment] = v }
opts.separator ""
opts.on("-h", "--help",
"Show this help message.") { $stderr.puts opts; exit }
opts.separator ""
opts.on("-v","--version",
"Show version.") { $stderr.puts "1.1"; exit }
end.parse!(argv)
ENV["RAILS_ENV"] = options[:environment] if options[:environment]
end
|