Sha256: 367a41524ec5b10bf86ca9c881520ef8882bdfce8af95072a5d40a1ac94e1307
Contents?: true
Size: 1.86 KB
Versions: 1
Compression:
Stored size: 1.86 KB
Contents
require 'getoptlong' require 'jetty_rails/config/rdoc_fix' class CommandLineReader def default_config() @@config ||= { :rails => { :base => Dir.pwd, :port => 3000, :config_file => "#{File.join(Dir.pwd, 'config', 'jetty_rails.yml')}", :adapter => :rails }, :merb => { :base => Dir.pwd, :port => 4000, :config_file => "#{File.join(Dir.pwd, 'jetty_merb.yml')}", :adapter => :merb } } end def read(default_adapter = :rails) config = default_config[default_adapter] opts = GetoptLong.new( [ '--version', '-v', GetoptLong::NO_ARGUMENT ], [ '--help', '-h', GetoptLong::NO_ARGUMENT ], [ '--context-path', '-u', GetoptLong::REQUIRED_ARGUMENT ], [ '--port', '-p', GetoptLong::REQUIRED_ARGUMENT ], [ '--environment', '-e', GetoptLong::REQUIRED_ARGUMENT ], [ '--lib', '--jars', GetoptLong::REQUIRED_ARGUMENT ], [ '--classes', GetoptLong::REQUIRED_ARGUMENT ], [ '--config', '-c', GetoptLong::OPTIONAL_ARGUMENT ] ) opts.each do |opt, arg| case opt when '--version' require 'jetty_rails/version' puts "JettyRails version #{JettyRails::VERSION::STRING} - http://jetty-rails.rubyforge.org" exit(0) when '--help' RDoc::usage when '--context-path' config[:context_path] = arg when '--port' config[:port] = arg.to_i when '--environment' config[:environment] = arg when '--classes' config[:classes_dir] = arg when '--lib' config[:lib_dir] = arg when '--config' config[:config_file] = arg if !arg.nil? && arg != "" config.merge!(YAML.load_file(config[:config_file])) end end config[:base] = ARGV.shift unless ARGV.empty? config end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
jetty-rails-0.6 | lib/jetty_rails/config/command_line_reader.rb |