Skip to content
This repository has been archived by the owner on Aug 29, 2018. It is now read-only.

Commit

Permalink
Merge pull request #44 from fabianofranz/master
Browse files Browse the repository at this point in the history
Fixes Bugzilla 823854
  • Loading branch information
John Palmieri committed May 29, 2012
2 parents 6905bd9 + ff6aeae commit 7ca26a8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
13 changes: 7 additions & 6 deletions express/bin/rhc-port-forward
Expand Up @@ -102,8 +102,9 @@ Net::SSH.start(ssh_host, app_uuid) do |ssh|

ssh.exec! "rhc-list-ports" do |channel, stream, data|

if data.is_a?(String)
data = data.split '\n'
# data comes from a linux server so it is a one-line string for windows, we need to split \n manually
if RHC::Helpers.windows?
data = data.split /\n/
end

if stream == :stderr
Expand Down Expand Up @@ -148,8 +149,9 @@ Net::SSH.start(ssh_host, app_uuid) do |ssh|
Net::SSH.start(ssh_host, scaled_uuid) do |ssh|

ssh.exec! "rhc-list-ports" do |channel, stream, data|
if data.is_a?(String)
data = data.split '\n'
# data comes from a linux server so it is a one-line string for windows, we need to split \n manually
if RHC::Helpers.windows?
data = data.split /\n/
end
if stream == :stderr
data.each { |line|
Expand Down Expand Up @@ -184,11 +186,10 @@ Net::SSH.start(ssh_host, app_uuid) do |ssh|

hosts_and_ports_descriptions.each { |description| puts "Binding #{description}..." }

puts "Use ctl + c to stop"

begin

Net::SSH.start(ssh_host, app_uuid) do |ssh|
puts "Use ctl + c to stop"
hosts_and_ports.each do |host_and_port|
host, port = host_and_port.split(/:/)
ssh.forward.local(host, port.to_i, host, port.to_i)
Expand Down
8 changes: 8 additions & 0 deletions express/lib/rhc/helpers.rb
Expand Up @@ -136,5 +136,13 @@ def paragraph(&block)
def jruby? ; RUBY_PLATFORM =~ /java/i end
def windows? ; RUBY_PLATFORM =~ /win(32|dows|ce)|djgpp|(ms|cyg|bcc)win|mingw32/i end
def unix? ; !jruby? && !windows? end

end
end

# mock for windows
if defined?(UNIXServer) != 'constant' or UNIXServer.class != Class
#:nocov:
class UNIXServer; end
#:nocov:
end

0 comments on commit 7ca26a8

Please sign in to comment.