rconf 1.0.1 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
data/bin/rconf
CHANGED
@@ -64,18 +64,20 @@ where [options] are:
|
|
64
64
|
end
|
65
65
|
end
|
66
66
|
Command.set_verbose if opts[:verbose]
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
67
|
+
Dir.chdir(File.dirname(opts[:config])) do
|
68
|
+
if opts[:configurators]
|
69
|
+
new.list_configurators
|
70
|
+
elsif opts[:platform]
|
71
|
+
new.show_platform
|
72
|
+
elsif opts[:overrides]
|
73
|
+
new.show_overrides
|
74
|
+
elsif opts[:update]
|
75
|
+
new.update
|
76
|
+
elsif opts[:remove]
|
77
|
+
new.remove
|
78
|
+
else
|
79
|
+
new.configure(opts)
|
80
|
+
end
|
79
81
|
end
|
80
82
|
end
|
81
83
|
|
@@ -107,18 +107,10 @@ module RightConf
|
|
107
107
|
# === Return
|
108
108
|
# true:: Always return true
|
109
109
|
def check_ruby
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
end
|
115
|
-
|
116
|
-
unless exists && right_ruby
|
117
|
-
unless Command.execute('rbenv', 'local', ruby_version).success?
|
118
|
-
report_check("Installing ruby #{ruby} (this will take a while, please be patient)")
|
119
|
-
Platform.dispatch(ruby_version) { :install_ruby }
|
120
|
-
Command.execute('rbenv', 'local', ruby_version)
|
121
|
-
end
|
110
|
+
unless Command.execute('rbenv', 'local', ruby_version).success?
|
111
|
+
report_check("Installing ruby #{ruby_version} (this will take a while, please be patient)")
|
112
|
+
Platform.dispatch(ruby_version) { :install_ruby }
|
113
|
+
Command.execute('rbenv', 'local', ruby_version)
|
122
114
|
end
|
123
115
|
true
|
124
116
|
end
|
@@ -148,6 +140,7 @@ module RightConf
|
|
148
140
|
# === Return
|
149
141
|
# true:: Always return true
|
150
142
|
def install_ruby_darwin(ruby)
|
143
|
+
Platform.dispatch(ruby) { :install_ruby_prerequisites }
|
151
144
|
c_version = `system_profiler SPDeveloperToolsDataType -xml | xpath "//*[text()='_items']/following-sibling::array/dict/child::key[text()='spdevtools_version']/following-sibling::string/text()" 2> /dev/null`
|
152
145
|
env = {}
|
153
146
|
gcc42 = ['/usr/bin/gcc-4.2', '/usr/local/bin/gcc-4.2'].detect { |p| File.executable?(p) }
|
@@ -86,11 +86,16 @@ module RightConf
|
|
86
86
|
def install_darwin(packages, opts)
|
87
87
|
return if packages.nil?
|
88
88
|
BrewInstaller.check_and_install
|
89
|
+
res = Command.execute('brew', 'list')
|
90
|
+
all_installed = res.success? ? res.output.gsub("\t", "\n") : ''
|
89
91
|
packages.each do |p|
|
90
92
|
args = [ p ]
|
91
93
|
args << opts if opts
|
94
|
+
formula = p.split('/').last.split('.rb').first
|
95
|
+
already_installed = all_installed =~ /^#{formula}$/
|
96
|
+
next if already_installed
|
92
97
|
res = Command.execute('brew', 'install', *args)
|
93
|
-
installed = res.success? && res.output !~ /
|
98
|
+
installed = res.success? && res.output !~ /already installed/
|
94
99
|
Command.sudo('brew', 'link', p) if installed
|
95
100
|
end
|
96
101
|
end
|
data/lib/rconf/version.rb
CHANGED
@@ -33,8 +33,7 @@ describe RightConf::RubyConfigurator do
|
|
33
33
|
context "with rbenv installed" do
|
34
34
|
before(:each) do
|
35
35
|
should_execute('rvm').once.and_return(failure_result)
|
36
|
-
|
37
|
-
flexmock(IO).should_receive(:read).with('.ruby-version').and_return("42")
|
36
|
+
should_execute('rbenv', 'local', '42').and_return(success_result)
|
38
37
|
end
|
39
38
|
|
40
39
|
it 'should succeed' do
|
@@ -53,7 +52,6 @@ describe RightConf::RubyConfigurator do
|
|
53
52
|
before(:each) do
|
54
53
|
should_execute('rvm').once.and_return(failure_result)
|
55
54
|
should_execute('rbenv').once.and_return(failure_result)
|
56
|
-
flexmock(File).should_receive(:exist?).with('.ruby-version').and_return(false)
|
57
55
|
flexmock(File).should_receive(:exist?).with(File.join(ENV['HOME'], '.rbenv', 'bin', 'rbenv')).and_return(false)
|
58
56
|
end
|
59
57
|
|
@@ -40,6 +40,7 @@ describe RightConf::PackageInstaller do
|
|
40
40
|
it 'should install packages on Darwin' do
|
41
41
|
flexmock(RightConf::Platform.instance).should_receive(:family).and_return(:darwin)
|
42
42
|
flexmock(RightConf::BrewInstaller).should_receive(:check_and_install).once
|
43
|
+
should_execute('brew', 'list').once.and_return(success_result(''))
|
43
44
|
should_execute('brew', 'install', 'mac1').once.and_return(success_result)
|
44
45
|
should_sudo('brew', 'link', 'mac1').once.and_return(success_result)
|
45
46
|
should_execute('brew', 'install', 'mac2').once.and_return(success_result)
|