rconf 1.0.6 → 1.0.7
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.
data/Rakefile
CHANGED
@@ -24,9 +24,6 @@ rescue LoadError => e
|
|
24
24
|
require 'rake/rdoctask'
|
25
25
|
end
|
26
26
|
|
27
|
-
task :default => 'spec'
|
28
|
-
task :build => [ 'spec', 'gem' ]
|
29
|
-
|
30
27
|
# == Unit Tests == #
|
31
28
|
|
32
29
|
desc "Run unit tests"
|
@@ -68,3 +65,6 @@ Rake::RDocTask.new do |rd|
|
|
68
65
|
rd.rdoc_files.include 'README.rdoc', "lib/**/*.rb"
|
69
66
|
end
|
70
67
|
|
68
|
+
task :default => 'spec'
|
69
|
+
task :build => [ 'spec', 'gem' ]
|
70
|
+
|
data/lib/rconf/command.rb
CHANGED
@@ -41,7 +41,7 @@ module RightConf
|
|
41
41
|
if @verbose
|
42
42
|
msg = ([command] + args).compact.join(' ') + ' => ' +
|
43
43
|
res.status.to_s + ': ' + res.output
|
44
|
-
report(msg)
|
44
|
+
report("[rconf] " + msg)
|
45
45
|
end
|
46
46
|
if !res.success? && msg = opts[:abort_on_failure]
|
47
47
|
report_fatal("#{msg}: '#{command} #{args.join(' ')}' returned\n#{res.output}")
|
@@ -32,11 +32,7 @@ module RightConf
|
|
32
32
|
# true:: If bundler is already installed
|
33
33
|
# false:: Otherwise
|
34
34
|
def check_linux
|
35
|
-
|
36
|
-
res = Command.execute('bundle', '--version')
|
37
|
-
success = (res.output =~ /#{version}/)
|
38
|
-
report_result(success)
|
39
|
-
success
|
35
|
+
check_bundler && check_bundle
|
40
36
|
end
|
41
37
|
alias :check_darwin :check_linux
|
42
38
|
|
@@ -48,19 +44,13 @@ module RightConf
|
|
48
44
|
raise "Bundler is not supported on Windows!"
|
49
45
|
end
|
50
46
|
|
51
|
-
# Install bundler if needed and run bundle install
|
47
|
+
# Install bundler if needed and run bundle install.
|
52
48
|
#
|
53
49
|
# === Return
|
54
50
|
# true:: Always return true
|
55
51
|
def run_linux
|
56
52
|
install_bundler
|
57
|
-
|
58
|
-
options = [ "_#{version}_", 'install' ]
|
59
|
-
options << "--without=#{exclusions.delete(' ')}" unless exclusions.nil?
|
60
|
-
options += [ '--path', bundle_path ] unless bundle_path.nil?
|
61
|
-
options << { :abort_on_failure => 'Failed to install gems' }
|
62
|
-
res = Command.execute('bundle', *options)
|
63
|
-
report_success
|
53
|
+
install_bundle
|
64
54
|
true
|
65
55
|
end
|
66
56
|
alias :run_darwin :run_linux
|
@@ -75,6 +65,32 @@ module RightConf
|
|
75
65
|
|
76
66
|
protected
|
77
67
|
|
68
|
+
# Check whether bundler is already installed.
|
69
|
+
#
|
70
|
+
# === Return
|
71
|
+
# true:: If bundler is already installed
|
72
|
+
# false:: Otherwise
|
73
|
+
def check_bundler
|
74
|
+
report_check("Checking bundler #{version}")
|
75
|
+
res = Command.execute("bundle", "_#{version}_", '--version')
|
76
|
+
success = !!(res.output =~ /#{version}/)
|
77
|
+
report_result(success)
|
78
|
+
success
|
79
|
+
end
|
80
|
+
|
81
|
+
# Check whether the gems in the bundle are all installed.
|
82
|
+
#
|
83
|
+
# === Return
|
84
|
+
# true:: If bundle's gem dependencies are satisfied.
|
85
|
+
# false:: Otherwise
|
86
|
+
def check_bundle
|
87
|
+
report_check("Checking bundle")
|
88
|
+
res = Command.execute("bundle", "_#{version}_", 'check')
|
89
|
+
success = !!(res.output =~ /dependencies are satisfied/)
|
90
|
+
report_result(success)
|
91
|
+
success
|
92
|
+
end
|
93
|
+
|
78
94
|
# Install bundler from gem in cache
|
79
95
|
#
|
80
96
|
# === Return
|
@@ -93,10 +109,28 @@ module RightConf
|
|
93
109
|
options = [ 'gem','install' ]
|
94
110
|
options += version_or_file
|
95
111
|
options += [ '--no-ri', '--no-rdoc', { :abort_on_failure => 'Failed to install bundler' } ]
|
96
|
-
|
112
|
+
Command.execute(*options)
|
97
113
|
report_success
|
98
114
|
true
|
99
115
|
end
|
100
116
|
|
117
|
+
# Run "bundle install" to install the gems in the app's bundle.
|
118
|
+
#
|
119
|
+
# === Return
|
120
|
+
# true:: Always return true
|
121
|
+
#
|
122
|
+
# === Raise
|
123
|
+
# (Exception):: If one or gems in the bundle cannot be installed for any reason
|
124
|
+
def install_bundle
|
125
|
+
report_check('Installing gems')
|
126
|
+
options = [ "_#{version}_", 'install' ]
|
127
|
+
options << "--without=#{exclusions.delete(' ')}" unless exclusions.nil?
|
128
|
+
options += [ '--path', bundle_path ] unless bundle_path.nil?
|
129
|
+
options << { :abort_on_failure => 'Failed to install gems' }
|
130
|
+
res = Command.execute('bundle', *options)
|
131
|
+
report_success
|
132
|
+
Command.execute('rbenv', 'rehash') # this is kind of optional
|
133
|
+
true
|
134
|
+
end
|
101
135
|
end
|
102
136
|
end
|
@@ -143,14 +143,19 @@ module RightConf
|
|
143
143
|
Platform.dispatch(ruby) { :install_ruby_prerequisites }
|
144
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`
|
145
145
|
env = {}
|
146
|
+
|
147
|
+
# Ensure we're using a sane GCC 4.2, not Apple's LLVM-based lookalike.
|
146
148
|
gcc42 = ['/usr/local/bin/gcc-4.2', '/usr/bin/gcc-4.2'].detect { |p| File.executable?(p) }
|
147
149
|
if c_version =~ /^4\.2\.[0-9]+/
|
148
|
-
if
|
150
|
+
if gcc42.nil?
|
149
151
|
report_fatal("The C compiler included with Xcode #{c_version} produces buggy ruby interpreters, please install the C compilers from https://github.com/downloads/kennethreitz/osx-gcc-installer/GCC-10.7-v2.pkg or update your version of Xcode and re-run rconf")
|
150
152
|
else
|
151
153
|
env['CC'] = gcc42
|
152
154
|
end
|
153
155
|
end
|
156
|
+
|
157
|
+
# Ruby 1.8 force-installs the Tk stdlib extension, no way to opt out.
|
158
|
+
# Ensure XQuartz is installed and its headers are on the path.
|
154
159
|
if ruby =~ /1\.8/
|
155
160
|
if File.directory?('/opt/X11/include')
|
156
161
|
env['CC'] = gcc42
|
@@ -159,6 +164,7 @@ module RightConf
|
|
159
164
|
report_fatal("Installing ruby 1.8 (or ree 1.8) on Mac OS X requires that XQuartz be installed on the machine first, please go to http://xquartz.macosforge.org/landing/, install XQuartz and try again")
|
160
165
|
end
|
161
166
|
end
|
167
|
+
|
162
168
|
Command.execute('rbenv', 'install', ruby, :abort_on_failure => 'Failed to install ruby', :env => env)
|
163
169
|
report_success
|
164
170
|
end
|
data/lib/rconf/version.rb
CHANGED
@@ -36,7 +36,8 @@ describe RightConf::BundlerConfigurator do
|
|
36
36
|
end
|
37
37
|
|
38
38
|
it 'should succeed when bundler succeeds' do
|
39
|
-
should_execute('bundle', '--version').once.and_return(success_result('0'))
|
39
|
+
should_execute('bundle', '_0_', '--version').once.and_return(success_result('0'))
|
40
|
+
should_execute('bundle', '_0_', 'check').once.and_return(success_result('dependencies are satisfied'))
|
40
41
|
@configurator.check_linux.should be_true
|
41
42
|
end
|
42
43
|
|
@@ -45,6 +46,7 @@ describe RightConf::BundlerConfigurator do
|
|
45
46
|
{:abort_on_failure=>"Failed to install bundler"}).once.and_return(success_result)
|
46
47
|
should_execute('bundle','_0_', 'install',
|
47
48
|
{:abort_on_failure=>"Failed to install gems"}).once.and_return(success_result)
|
49
|
+
should_execute('rbenv', 'rehash').once.and_return(success_result)
|
48
50
|
@configurator.run_linux
|
49
51
|
end
|
50
52
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rconf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-04-
|
12
|
+
date: 2013-04-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|