rconf 0.6.10 → 0.6.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -39,7 +39,7 @@ module RightConf
|
|
39
39
|
report_result(success)
|
40
40
|
install_bundler unless success
|
41
41
|
report_check('Installing gems')
|
42
|
-
options = [
|
42
|
+
options = [ "_#{version}_", 'install' ]
|
43
43
|
options << "--without=#{exclusions}" unless exclusions.nil?
|
44
44
|
options << "--path #{bundle_path}" unless bundle_path.nil?
|
45
45
|
options << { :abort_on_failure => 'Failed to install gems' }
|
@@ -54,7 +54,6 @@ module RightConf
|
|
54
54
|
when /^Using /
|
55
55
|
report_success
|
56
56
|
check_rvmrc
|
57
|
-
post_note "Configuration required switching the active ruby\nPlease run " + 'cd ..;cd -'.blue + ' to activate it and re-run rconf'
|
58
57
|
aborting(true)
|
59
58
|
else
|
60
59
|
report_fatal("Failed to use #{version}:\n#{out}")
|
@@ -92,11 +91,13 @@ module RightConf
|
|
92
91
|
end
|
93
92
|
|
94
93
|
# Set command prefix when already configured
|
94
|
+
# Re-create .rvmrc if needed
|
95
95
|
#
|
96
96
|
# === Return
|
97
97
|
# true:: Always return true
|
98
98
|
def post_process
|
99
99
|
Command.set_prefix("rvm #{version}@#{gemset} exec --")
|
100
|
+
check_rvmrc
|
100
101
|
true
|
101
102
|
end
|
102
103
|
|
@@ -128,10 +129,10 @@ module RightConf
|
|
128
129
|
end
|
129
130
|
Dir.chdir(File.join(rvm_src, "rvm-#{version}")) do
|
130
131
|
Command.execute('./install', :abort_on_failure => "Failed to install rvm #{version}")
|
131
|
-
setup_bashrc
|
132
132
|
end
|
133
133
|
report_success
|
134
134
|
end
|
135
|
+
setup_bashrc
|
135
136
|
true
|
136
137
|
end
|
137
138
|
|
@@ -193,6 +194,7 @@ module RightConf
|
|
193
194
|
# === Return
|
194
195
|
# true:: Always return true
|
195
196
|
def check_rvmrc
|
197
|
+
return true if File.exist?('.rvmrc')
|
196
198
|
report_check('Setting up .rvmrc')
|
197
199
|
begin
|
198
200
|
File.open('.rvmrc', 'w') do |f|
|
@@ -202,6 +204,7 @@ module RightConf
|
|
202
204
|
end
|
203
205
|
Command.execute('rvm', "#{version}@#{gemset}", 'trust', 'rvmrc')
|
204
206
|
report_success
|
207
|
+
post_note "Configuration required switching the active ruby\nPlease run " + 'cd ..;cd -'.blue + ' to activate it and re-run rconf'
|
205
208
|
rescue Exception => e
|
206
209
|
report_failure
|
207
210
|
report_error(e.message)
|
@@ -220,7 +223,17 @@ module RightConf
|
|
220
223
|
if bashrc_path
|
221
224
|
content = IO.read(bashrc_path)
|
222
225
|
unless content.include?(rvm_bash_activation)
|
223
|
-
|
226
|
+
i = content.index(/^\s*PATH=[^$PATH]/)
|
227
|
+
if i
|
228
|
+
next_line = content.index("\n", i + 1)
|
229
|
+
if next_line
|
230
|
+
content.insert(next_line + 1, rvm_bash_activation + "\n")
|
231
|
+
else
|
232
|
+
content += "\n" + rvm_bash_activation
|
233
|
+
end
|
234
|
+
else
|
235
|
+
content = rvm_bash_activation + "\n" + content
|
236
|
+
end
|
224
237
|
FileUtils.mv(bashrc_path, bashrc_path + '.old')
|
225
238
|
File.open(bashrc_path, 'w') { |f| f.puts content }
|
226
239
|
post_note 'rvm was installed, please reload your shell to activate it and re-run rconf'
|
@@ -237,6 +250,7 @@ module RightConf
|
|
237
250
|
# code(String):: Code that needs to be added to bashrc to activate rvm
|
238
251
|
def rvm_bash_activation
|
239
252
|
code = <<EOS
|
253
|
+
export rvm_trust_rvmrcs_flag=1
|
240
254
|
if [[ -n "$PS1" ]]; then
|
241
255
|
if [[ -s $HOME/.rvm/scripts/rvm ]] ; then source $HOME/.rvm/scripts/rvm ; fi
|
242
256
|
fi
|
data/lib/rconf/version.rb
CHANGED
@@ -29,7 +29,7 @@ describe RightConf::BundlerConfigurator do
|
|
29
29
|
flexmock(RightConf::Command.instance).should_receive(:execute).once.with(
|
30
30
|
'bundle', '--version').and_return(success_result('0'))
|
31
31
|
flexmock(RightConf::Command.instance).should_receive(:execute).once.with(
|
32
|
-
'bundle',
|
32
|
+
'bundle','_0_', 'install', {:abort_on_failure=>"Failed to install gems"}).and_return(success_result)
|
33
33
|
@configurator.run_linux
|
34
34
|
end
|
35
35
|
|
@@ -37,7 +37,7 @@ describe RightConf::BundlerConfigurator do
|
|
37
37
|
flexmock(RightConf::Command.instance).should_receive(:execute).twice.with(
|
38
38
|
'bundle', '--version').and_return(success_result('1'))
|
39
39
|
flexmock(RightConf::Command.instance).should_receive(:execute).once.with(
|
40
|
-
'bundle',
|
40
|
+
'bundle','_0_', 'install', {:abort_on_failure=>"Failed to install gems"}).and_return(success_result)
|
41
41
|
flexmock(RightConf::Command.instance).should_receive(:execute).once.with(
|
42
42
|
'gem', 'uninstall', 'bundler', '-a', '-x').and_return(success_result)
|
43
43
|
flexmock(RightConf::Command.instance).should_receive(:execute).once.with(
|
@@ -55,9 +55,58 @@ describe RightConf::RubyConfigurator do
|
|
55
55
|
'./install', {:abort_on_failure=>"Failed to install rvm #{RVM_VERSION}"}).and_return(success_result)
|
56
56
|
flexmock(RightConf::Command.instance).should_receive(:execute).once.with(
|
57
57
|
'rvm', 'use', '0').and_return(success_result('Using'))
|
58
|
+
flexmock(@configurator).should_receive(:setup_bashrc).once.and_return(true)
|
58
59
|
@configurator.run_linux
|
59
60
|
end
|
60
61
|
|
61
|
-
|
62
|
+
describe 'bashrc update' do
|
63
|
+
|
64
|
+
before(:each) do
|
65
|
+
flexmock(File).should_receive(:exist?).once.with(File.join(ENV['HOME'], '.bashrc')).once.and_return(true)
|
66
|
+
flexmock(FileUtils).should_receive(:mv).and_return(true)
|
67
|
+
f = flexmock('f')
|
68
|
+
f.should_receive(:puts).and_return { |c| @bashrc_content = c }
|
69
|
+
flexmock(File).should_receive(:open).and_yield(f)
|
70
|
+
@rvm_bash_activation = @configurator.__send__(:rvm_bash_activation)
|
71
|
+
end
|
72
|
+
|
73
|
+
it 'should install rvm hook in bashrc when not present' do
|
74
|
+
flexmock(IO).should_receive(:read).and_return('test')
|
75
|
+
@configurator.__send__(:setup_bashrc)
|
76
|
+
@bashrc_content.should == "#{@rvm_bash_activation}\ntest"
|
77
|
+
end
|
78
|
+
|
79
|
+
it 'should not install rvm hook in bashrc when present' do
|
80
|
+
flexmock(IO).should_receive(:read).and_return('test' + @rvm_bash_activation)
|
81
|
+
@configurator.__send__(:setup_bashrc)
|
82
|
+
@bashrc_content.should be_nil
|
83
|
+
end
|
84
|
+
|
85
|
+
it 'should install rvm hook after path is set' do
|
86
|
+
flexmock(IO).should_receive(:read).and_return(<<-EOS
|
87
|
+
echo 'zobi la mouche'
|
88
|
+
radio killed the radio star
|
89
|
+
#PATH=something
|
90
|
+
PATH=$PATH:should be fine
|
91
|
+
this should not:
|
92
|
+
PATH=something
|
93
|
+
AFTER
|
94
|
+
EOS
|
95
|
+
)
|
96
|
+
@configurator.__send__(:setup_bashrc)
|
97
|
+
@bashrc_content.should == <<-EOS
|
98
|
+
echo 'zobi la mouche'
|
99
|
+
radio killed the radio star
|
100
|
+
#PATH=something
|
101
|
+
PATH=$PATH:should be fine
|
102
|
+
this should not:
|
103
|
+
PATH=something
|
104
|
+
#{@rvm_bash_activation}
|
105
|
+
AFTER
|
106
|
+
EOS
|
107
|
+
end
|
108
|
+
|
109
|
+
end
|
110
|
+
|
62
111
|
end
|
63
112
|
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: rconf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.6.
|
5
|
+
version: 0.6.11
|
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-03-
|
13
|
+
date: 2011-03-12 00:00:00 -08:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|