Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updated requirements and refactored the cmd line config to a shared f…
…ile since almost all of it was duplicated
- Loading branch information
Jeffrey Damick
committed
Jul 22, 2008
1 parent
773445c
commit 28370f9
Showing
8 changed files
with
151 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
require 'getoptlong' | ||
require 'jetty_rails/config/rdoc_fix' | ||
|
||
|
||
class CommandLineConfig | ||
|
||
def self.default_config() | ||
@config ||= { | ||
:rails => { | ||
:daemonize => false, | ||
:base => Dir.pwd, | ||
:port => 3000, | ||
:config_file => "#{File.join(Dir.pwd, 'config', 'jetty_rails.yml')}", | ||
:adapter => :rails | ||
}, | ||
:merb => { | ||
:daemonize => false, | ||
:base => Dir.pwd, | ||
:port => 4000, | ||
:config_file => "#{File.join(Dir.pwd, 'jetty_merb.yml')}", | ||
:adapter => :merb | ||
} | ||
} | ||
end | ||
|
||
def self.get_config(default_adapter = :rails) | ||
config = default_config[default_adapter] | ||
|
||
opts = GetoptLong.new( | ||
[ '--help', '-h', GetoptLong::NO_ARGUMENT ], | ||
[ '--context-path', '-u', GetoptLong::REQUIRED_ARGUMENT ], | ||
[ '--port', '-p', GetoptLong::REQUIRED_ARGUMENT ], | ||
[ '--environment', '-e', GetoptLong::REQUIRED_ARGUMENT ], | ||
[ '--config', '-c', GetoptLong::OPTIONAL_ARGUMENT ] | ||
) | ||
|
||
opts.each do |opt, arg| | ||
case opt | ||
when '--help' | ||
RDoc::usage | ||
when '--context-path' | ||
config[:context_path] = arg | ||
when '--port' | ||
config[:port] = arg.to_i | ||
when '--environment' | ||
config[:environment] = 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 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
require 'rdoc/usage' | ||
|
||
# fix to work with rubygems (use current file instead of main) | ||
def RDoc.usage_no_exit(*args) | ||
comment = File.open(File.join(File.dirname(__FILE__), %w(.. .. .. bin), File.basename($0))) do |file| | ||
find_comment(file) | ||
end | ||
|
||
comment = comment.gsub(/^\s*#/, '') | ||
|
||
markup = SM::SimpleMarkup.new | ||
flow_convertor = SM::ToFlow.new | ||
|
||
flow = markup.convert(comment, flow_convertor) | ||
|
||
format = "plain" | ||
|
||
unless args.empty? | ||
flow = extract_sections(flow, args) | ||
end | ||
|
||
options = RI::Options.instance | ||
if args = ENV["RI"] | ||
options.parse(args.split) | ||
end | ||
formatter = options.formatter.new(options, "") | ||
formatter.display_flow(flow) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters