Skip to content

Commit

Permalink
Review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
smarterclayton committed Apr 9, 2013
1 parent 6d0ecea commit 9cb2081
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lib/rhc/commands/cartridge.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class Cartridge < Base
syntax "<action>"
description <<-DESC
Cartridges add functionality to OpenShift applications. Each application
has one web cartridge to listens for HTTP requests, and any number
has one web cartridge to listen for HTTP requests, and any number
of addon cartridges. Addons may include databases like MySQL and Mongo,
administrative tools like phpMyAdmin, or build clients like Jenkins.
Expand Down
12 changes: 6 additions & 6 deletions lib/rhc/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ def decode_json(s)
RHC::Vendor::OkJson.decode(s)
end

def system_path(path)
return path.gsub(File::SEPARATOR, File::ALT_SEPARATOR) if File.const_defined?('ALT_SEPARATOR') and File::ALT_SEPARATOR.present?
path
end

def date(s)
now = Date.today
d = datetime_rfc3339(s).to_time
Expand Down Expand Up @@ -112,7 +117,7 @@ def user_agent
global_option '--noprompt', "Suppress all interactive operations command", :hide => true do
$terminal.page_at = nil
end
global_option '--config FILE', "Path of a different config file", :hide => true
global_option '--config FILE', "Path of a different config file (default: #{system_path("~/.openshift/express.conf")})", :hide => true
global_option '--clean', "Ignore any saved configuration options", :hide => true
global_option '--mock', "Run in mock mode", :hide => true do
#:nocov:
Expand Down Expand Up @@ -308,11 +313,6 @@ def windows? ; RUBY_PLATFORM =~ /win(32|dows|ce)|djgpp|(ms|cyg|bcc)win|mingw32/i
def unix? ; !jruby? && !windows? end
def mac? ; RbConfig::CONFIG['host_os'] =~ /^darwin/ end

def system_path(path)
return path.gsub(File::SEPARATOR, File::ALT_SEPARATOR) if File.const_defined?('ALT_SEPARATOR') and File::ALT_SEPARATOR.present?
path
end

#
# Check if host exists
#
Expand Down
2 changes: 1 addition & 1 deletion rhc.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Gem::Specification.new do |s|
s.add_dependency 'net-ssh', '>= 2.0.11'
s.add_dependency 'archive-tar-minitar'
s.add_runtime_dependency 'commander', '>= 4.0'
s.add_runtime_dependency 'highline', '>= 1.5.1'
s.add_runtime_dependency 'highline', '~> 1.6.11'
s.add_runtime_dependency 'httpclient', '>= 2.2'
s.add_runtime_dependency 'open4'
s.add_development_dependency 'rake', '>= 0.8.7', '<= 0.9.2.2'
Expand Down
3 changes: 3 additions & 0 deletions spec/rhc/helpers_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@ def options
it{ "\e[12;34ma".textwrap_ansi(1).should == ["\e[12;34ma\e[0m"] }
it{ "\e[1m\e[1m".textwrap_ansi(1).should == ["\e[1m\e[1m\e[0m"] }
it{ "\e[1m \e[1m".textwrap_ansi(1).should == ["\e[1m\e[0m", "\e[1m\e[1m\e[0m"] }
it{ "\e[1ma\nb".textwrap_ansi(80).should == ["\e[1ma","b"] }

it{ "ab".textwrap_ansi(1,false).should == ['ab'] }
it{ " abc".textwrap_ansi(3,false).should == [' abc'] }
Expand All @@ -349,6 +350,8 @@ def options

describe "#strip_ansi" do
it{ "\e[1m \e[1m".strip_ansi.should == " " }
it{ "\eiei0".strip_ansi.should == "\eiei0" }
it{ "\e[iei0]".strip_ansi.should == "\e[iei0]" }
end

context "Resolv helper" do
Expand Down

0 comments on commit 9cb2081

Please sign in to comment.