rconf 0.8.11 → 0.8.12

Sign up to get free protection for your applications and to get access to all the features.
@@ -30,7 +30,7 @@ module RightConf
30
30
  :rubygems => 'Rubygems version, e.g. "1.3.7"',
31
31
  :gemset => 'Gemset to be used for platforms supporting rvm'
32
32
 
33
- validate_has_settings :version, :rubygems
33
+ validate_has_settings :version
34
34
 
35
35
  # Let configurator run, it is idempotent
36
36
  #
@@ -49,6 +49,7 @@ module RightConf
49
49
  # true:: Always return true
50
50
  def run_linux
51
51
  check_rvm(RVM_VERSION)
52
+ return true if aborting
52
53
  Command.set_ruby(version, gemset)
53
54
  report_check("Checking whether #{version} is the active ruby")
54
55
  out = Command.execute('rvm', 'list').output
@@ -93,15 +94,17 @@ module RightConf
93
94
  :abort_on_failure => "Failed to switch to gemset '#{gemset}'")
94
95
  report_success
95
96
  end
96
- report_check("Checking whether rubygems #{rubygems} is installed")
97
- res = Command.execute_in_ruby('gem', '--version')
98
- if res.success? && res.output =~ /^#{rubygems}$/
99
- report_success
100
- else
101
- report_failure
102
- report_check("Installing rubygems #{rubygems}")
103
- Command.execute_in_ruby('rubygems', rubygems, :abort_on_failure => 'Failed to install rubygems')
104
- report_success
97
+ if rubygems
98
+ report_check("Checking whether rubygems #{rubygems} is installed")
99
+ res = Command.execute_in_ruby('gem', '--version')
100
+ if res.success? && res.output =~ /^#{rubygems}$/
101
+ report_success
102
+ else
103
+ report_failure
104
+ report_check("Installing rubygems #{rubygems}")
105
+ Command.execute_in_ruby('rubygems', rubygems, :abort_on_failure => 'Failed to install rubygems')
106
+ report_success
107
+ end
105
108
  end
106
109
  true
107
110
  end
@@ -159,6 +162,8 @@ module RightConf
159
162
  Dir.chdir(File.join(rvm_src, "rvm-#{version}")) do
160
163
  Command.execute('./install', :abort_on_failure => "Failed to install rvm #{version}")
161
164
  end
165
+ post_note "Configuration required installing RVM, please start a new shell to activate it and re-run rconf to finish configuration".green
166
+ aborting(true)
162
167
  report_success
163
168
  end
164
169
  setup_bashrc
@@ -248,7 +253,7 @@ module RightConf
248
253
  # true:: Always return true
249
254
  def setup_bashrc
250
255
  if EnvironmentUpdater.update(rvm_bash_activation, ['PATH'])
251
- post_note 'rvm was installed, please reload your shell to activate it and re-run rconf'
256
+ post_note '.rvmrc was updated, please reload your shell to activate it and re-run rconf'
252
257
  aborting(true)
253
258
  end
254
259
  end
data/lib/rconf/version.rb CHANGED
@@ -13,7 +13,7 @@ module RightConf
13
13
 
14
14
  MAJOR = 0
15
15
  MINOR = 8
16
- BUILD = 11
16
+ BUILD = 12
17
17
 
18
18
  VERSION = [MAJOR, MINOR, BUILD].map(&:to_s).join('.')
19
19
 
@@ -23,6 +23,7 @@ describe RightConf::RubyConfigurator do
23
23
  @configurator = create_configurator('ruby { version "0"; rubygems "1" }')
24
24
  flexmock(File).should_receive(:exist?).with('.rvmrc').and_return(true)
25
25
  flexmock(IO).should_receive(:read).with('.rvmrc').and_return("anything")
26
+ flexmock(File).should_receive(:open).with('.rvmrc', 'w').and_yield(FlexMock.undefined) # Don't override rconf's .rvmrc...
26
27
  end
27
28
 
28
29
  it 'should succeed on linux when rvm succeeds' do
@@ -36,16 +37,13 @@ describe RightConf::RubyConfigurator do
36
37
  it 'should install rvm if needed' do
37
38
  rvm_tar = "rvm-#{RVM_VERSION}.tar.gz"
38
39
  should_execute('rvm', '--version').once.and_return(success_result("rvm"))
39
- should_execute('rvm', 'list').once.and_return(success_result("=> rvm #{RVM_VERSION}"))
40
40
  should_execute('curl', '-O', '-f', "https://rvm.beginrescueend.com/releases/#{rvm_tar}",
41
41
  {:abort_on_failure=>"Failed to download rvm #{RVM_VERSION}"}).once.and_return(success_result)
42
42
  should_execute('tar', 'zxf', rvm_tar,
43
43
  {:abort_on_failure=>"Failed to extract rvm tgz from #{File.expand_path(File.join(File.dirname(__FILE__), '..', '..', "rvm-#{RVM_VERSION}.tar.gz"))}"}).once.and_return(success_result)
44
44
  flexmock(Dir).should_receive(:chdir).and_yield
45
45
  should_execute('./install', {:abort_on_failure=>"Failed to install rvm #{RVM_VERSION}"}).once.and_return(success_result)
46
- should_execute('rvm', 'use', '0').once.and_return(success_result('Using '))
47
- should_execute('rvm', '0@', 'gem', '--version').once.and_return(success_result('1'))
48
- flexmock(@configurator).should_receive(:setup_bashrc).once.and_return(true)
46
+ should_execute('rvm', 'use', '0').never
49
47
  @configurator.run_linux
50
48
  end
51
49
 
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: rconf
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.8.11
5
+ version: 0.8.12
6
6
  platform: ruby
7
7
  authors:
8
8
  - Raphael Simon
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-07-11 00:00:00 -07:00
13
+ date: 2011-07-28 00:00:00 -07:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency