Skip to content
This repository has been archived by the owner on Sep 20, 2019. It is now read-only.

Commit

Permalink
refs #5 some option fix.
Browse files Browse the repository at this point in the history
- I want to use "-h" to --help. --host is minor option.
- I need -E option for other environment's task running.
  • Loading branch information
walf443 committed Oct 15, 2012
1 parent b12acb0 commit 399fca2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/rrails/client.rb
Expand Up @@ -20,7 +20,9 @@ class Client
def self.opts_parser(options = {})
opts = OptionParser.new
opts.banner = 'Usage: rrails [options] [[--] commands]'
opts.on('-h', '--host=s', 'RRails server hostname. Default value is "localhost".') {|v| options[:host] = v }
opts.on('-h', '--help', 'This help.') {|v| options[:help] = v }
opts.on('--host=s', 'RRails server hostname. Default value is "localhost".') {|v| options[:host] = v }
opts.on('-E', '--rails_env=s') {|v| options[:rails_env] = v }
opts.on('-p', '--port=i', 'RRails server port. Default value is decided from RAILS_ENV.') {|v| options[:port] = v }
opts.on('-t', '--[no-]pty', "Prepare a PTY. Default value is decided by commands.") {|v| options[:pty] = v }
return opts
Expand All @@ -38,7 +40,8 @@ def self.new_with_options(argv)
def initialize(options={})
@cmd = options[:cmd] || ""
@host = options[:host] || 'localhost'
@port = options[:port] || DEFAULT_PORT[ENV['RAILS_ENV'] || 'development']
@rails_env = options[:rails_env] || ENV['RAILS_ENV'] || 'development'
@port = options[:port] || DEFAULT_PORT[@rails_env]
@use_pty = options[:pty]
if @use_pty.nil?
# decide use_pty from cmd
Expand Down
1 change: 1 addition & 0 deletions lib/rrails/server.rb
Expand Up @@ -79,6 +79,7 @@ def boot_rails
end

def dispatch(sock, line, pty=false)

if pty
m_out, c_out = PTY.open
c_in = c_err = c_out
Expand Down

0 comments on commit 399fca2

Please sign in to comment.