Sha256: 8d0fe9eec063aea7af33868b470e53e0e990143e62d1d253d636661d78887e8c
Contents?: true
Size: 795 Bytes
Versions: 4
Compression:
Stored size: 795 Bytes
Contents
require 'optparse' options = { :environment => (ENV['RAILS_ENV'] || "development").dup } ARGV.options do |opts| script_name = File.basename($0) opts.banner = "Usage: runner 'puts Person.find(1).name' [options]" opts.separator "" opts.on("-e", "--environment=name", String, "Specifies the environment for the runner to operate under (test/development/production).", "Default: development") { |options[:environment]| } opts.separator "" opts.on("-h", "--help", "Show this help message.") { puts opts; exit } opts.parse! end ENV["RAILS_ENV"] = options[:environment] RAILS_ENV.replace(options[:environment]) if defined?(RAILS_ENV) require RAILS_ROOT + '/config/environment' ARGV.empty? ? puts("Usage: runner 'code' [options]") : eval(ARGV.first)
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
rails-1.1.1 | lib/commands/runner.rb |
rails-1.1.0 | lib/commands/runner.rb |
rails-1.1.2 | lib/commands/runner.rb |
rails-1.1.3 | lib/commands/runner.rb |