rconf 0.6.5 → 0.6.10
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/rconf +8 -2
- data/lib/rconf/configurator.rb +12 -2
- data/lib/rconf/configurators/bundler_configurator.rb +1 -1
- data/lib/rconf/configurators/passenger_configurator.rb +320 -0
- data/lib/rconf/configurators/ruby_configurator.rb +15 -5
- data/lib/rconf/profile.rb +1 -0
- data/lib/rconf/version.rb +1 -1
- data/spec/configurators/bundler_configurator_spec.rb +2 -2
- data/spec/configurators/passenger_configurator_spec.rb +44 -0
- metadata +5 -2
data/bin/rconf
CHANGED
@@ -86,14 +86,20 @@ where [options] are:
|
|
86
86
|
end
|
87
87
|
exit 0
|
88
88
|
end
|
89
|
+
Profile.reset if options[:force]
|
89
90
|
ProgressReporter.report_to_stdout
|
90
91
|
ProgressReporter.report_to_file(options[:output]) if options[:output]
|
91
92
|
Command.set_verbose if options[:verbose]
|
92
93
|
begin
|
93
94
|
lang = Language.load(options[:config])
|
94
95
|
report_fatal("Validation of configuration file failed:\n -#{lang.validation_errors.join("\n -").map(&:red)}") unless lang.validation_errors.empty?
|
95
|
-
|
96
|
-
|
96
|
+
Dir.chdir(File.dirname(options[:config])) do
|
97
|
+
lang.configurators.each do |c|
|
98
|
+
c.run
|
99
|
+
break if c.aborting
|
100
|
+
c.post_process
|
101
|
+
end
|
102
|
+
end
|
97
103
|
report("Successfully configured #{File.basename(options[:config], '.rc').blue} for #{Platform.family.to_s.blue}")
|
98
104
|
rescue Exception => e
|
99
105
|
raise if e.is_a?(SystemExit)
|
data/lib/rconf/configurator.rb
CHANGED
@@ -121,13 +121,23 @@ module RightConf
|
|
121
121
|
def run(*args)
|
122
122
|
init
|
123
123
|
sha = Profile.configurator_signature(self.class.key)
|
124
|
-
|
124
|
+
sig = signature
|
125
|
+
if sha != sig
|
125
126
|
Platform.dispatch(*args) { :run }
|
126
|
-
Profile.set_configurator_signature(self.class.key,
|
127
|
+
Profile.set_configurator_signature(self.class.key, sig)
|
127
128
|
end
|
128
129
|
true
|
129
130
|
end
|
130
131
|
|
132
|
+
# Called even if configuration is already done for steps that must
|
133
|
+
# always happen, do nothing by default
|
134
|
+
#
|
135
|
+
# === Return
|
136
|
+
# true:: Always return true
|
137
|
+
def post_process
|
138
|
+
true
|
139
|
+
end
|
140
|
+
|
131
141
|
# Calculate unique SHA for current settings
|
132
142
|
#
|
133
143
|
# === Return
|
@@ -0,0 +1,320 @@
|
|
1
|
+
# Copyright (C) 2011 RightScale, Inc, All Rights Reserved Worldwide.
|
2
|
+
#
|
3
|
+
# THIS PROGRAM IS CONFIDENTIAL AND PROPRIETARY TO RIGHTSCALE
|
4
|
+
# AND CONSTITUTES A VALUABLE TRADE SECRET. Any unauthorized use,
|
5
|
+
# reproduction, modification, or disclosure of this program is
|
6
|
+
# strictly prohibited. Any use of this program by an authorized
|
7
|
+
# licensee is strictly subject to the terms and conditions,
|
8
|
+
# including confidentiality obligations, set forth in the applicable
|
9
|
+
# License Agreement between RightScale.com, Inc. and
|
10
|
+
# the licensee
|
11
|
+
|
12
|
+
require 'fileutils'
|
13
|
+
|
14
|
+
module RightConf
|
15
|
+
|
16
|
+
class PassengerConfigurator
|
17
|
+
|
18
|
+
PASSENGER_GEM_VERSION = '2.2.15'
|
19
|
+
|
20
|
+
DEFAULT_NGINX_INSTALL = ['/opt/nginx', File.join(ENV['HOME'], 'nginx')]
|
21
|
+
|
22
|
+
include Configurator
|
23
|
+
|
24
|
+
register :passenger
|
25
|
+
|
26
|
+
description "Installs and configure passenger with nginx\nNOTE: If the " +
|
27
|
+
'configuration file includes a ruby section before the ' +
|
28
|
+
'passenger section then that ruby will be used, otherwise ' +
|
29
|
+
'the default ruby will.'
|
30
|
+
|
31
|
+
settings :library_src_path => "Path to library sources, #{File.expand_path(File.join(Dir.getwd, '..', 'library'))} by default",
|
32
|
+
:gem_version => "Passenger gem version #{PASSENGER_GEM_VERSION} by default",
|
33
|
+
:install_path => 'Path to nginx installation directory, uses /opt/nginx if it ' +
|
34
|
+
'is writable by the current user or ~/nginx otherwise by default'
|
35
|
+
|
36
|
+
# Install passenger gem in given ruby then run nginx install script
|
37
|
+
#
|
38
|
+
# === Return
|
39
|
+
# true:: Always return true
|
40
|
+
def run_linux
|
41
|
+
set_defaults
|
42
|
+
report_check("Checking for passenger gem #{gem_version}")
|
43
|
+
res = Command.execute('gem', 'list', 'passenger')
|
44
|
+
success = (res.output =~ /^passenger \(#{gem_version}\)$/)
|
45
|
+
report_result(success)
|
46
|
+
install_gem unless success
|
47
|
+
report_check('Checking for passenger+nginx')
|
48
|
+
res = Command.execute('which', 'nginx').success?
|
49
|
+
res = File.exists?(File.join(install_path, 'sbin', 'nginx')) unless res
|
50
|
+
report_result(res)
|
51
|
+
install_passenger unless res
|
52
|
+
true
|
53
|
+
end
|
54
|
+
alias :run_darwin :run_linux
|
55
|
+
|
56
|
+
# Not implemented on windows
|
57
|
+
#
|
58
|
+
# === Raise
|
59
|
+
# (Exception):: Always raise
|
60
|
+
def run_windows
|
61
|
+
raise "Passenger is not supported on Windows!"
|
62
|
+
end
|
63
|
+
|
64
|
+
protected
|
65
|
+
|
66
|
+
# Set default values for settings
|
67
|
+
#
|
68
|
+
# === Return
|
69
|
+
# true:: Always return true
|
70
|
+
def set_defaults
|
71
|
+
right_site_src_path(Dir.getwd)
|
72
|
+
library_src_path(File.expand_path(File.join(Dir.getwd, '..', 'library'))) if library_src_path.nil?
|
73
|
+
gem_version(PASSENGER_GEM_VERSION) if gem_version.nil?
|
74
|
+
install_path(default_install_path) if install_path.nil?
|
75
|
+
user(ENV['USER']) if user.nil?
|
76
|
+
true
|
77
|
+
end
|
78
|
+
|
79
|
+
# Retrieve default install path
|
80
|
+
# Try /opt/nginx and revert to ~/nginx if not writable
|
81
|
+
#
|
82
|
+
# === Return
|
83
|
+
# path:: Default passenger+nginx install path
|
84
|
+
def default_install_path
|
85
|
+
path = if File.exist?('/opt')
|
86
|
+
if File.exist?('/opt/nginx')
|
87
|
+
pick_default_path(File.writable?('/opt/nginx'))
|
88
|
+
else
|
89
|
+
res = Command.execute('mkdir', '/opt/nginx')
|
90
|
+
pick_default_path(res.success?)
|
91
|
+
end
|
92
|
+
else
|
93
|
+
res = Command.execute('mkdir', '-p', '/opt/nginx')
|
94
|
+
pick_default_path(res.success?)
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
# First or second choice nginx install path
|
99
|
+
#
|
100
|
+
# === Parameter
|
101
|
+
# first_choice(TrueClass|FalseClass):: Whether to use first or second choice path
|
102
|
+
#
|
103
|
+
# === Return
|
104
|
+
# path(String):: Path
|
105
|
+
def pick_default_path(first_choice)
|
106
|
+
path = first_choice ? DEFAULT_NGINX_INSTALL[0] : DEFAULT_NGINX_INSTALL[1]
|
107
|
+
end
|
108
|
+
|
109
|
+
# Install passenger gem
|
110
|
+
#
|
111
|
+
# === Return
|
112
|
+
# true:: Always return true
|
113
|
+
def install_gem
|
114
|
+
report_check('Installing passenger gem')
|
115
|
+
Command.execute('gem', 'install', 'passenger', '-v', gem_version,
|
116
|
+
:abort_on_failure => "Failed to install passenger gem version #{gem_version}")
|
117
|
+
report_success
|
118
|
+
end
|
119
|
+
|
120
|
+
# Install passenger+nginx
|
121
|
+
#
|
122
|
+
# === Return
|
123
|
+
# true:: Always return true
|
124
|
+
def install_passenger
|
125
|
+
report_check('Installing passenger+nginx')
|
126
|
+
# Grrrrr passenger installer expect rake where it's not... HACK
|
127
|
+
ruby_dir = File.dirname(`which ruby`.chomp)
|
128
|
+
FileUtils.cp(`which rake`.chomp, ruby_dir) unless rake_exist = File.exist?(File.join(ruby_dir, 'rake'))
|
129
|
+
Command.execute('passenger-install-nginx-module', '--auto',
|
130
|
+
'--auto-download', '--prefix', install_path,
|
131
|
+
:abort_on_failure => "Failed to install nginx into #{install_path}")
|
132
|
+
FileUtils.mkdir_p(File.join(install_path, 'sites-enabled'))
|
133
|
+
FileUtils.mkdir_p(File.join(install_path, 'logs'))
|
134
|
+
File.open(File.join(install_path, 'conf', 'nginx.conf'), 'w') { |f| f.puts(nginx_config) }
|
135
|
+
File.open(File.join(install_path, 'sites-enabled', 'right_site'), 'w') { |f| f.puts(right_site_config) }
|
136
|
+
File.open(File.join(install_path, 'sites-enabled', 'library'), 'w') { |f| f.puts(library_config) }
|
137
|
+
if File.writable?('/etc/hosts') && IO.read('/etc/hosts') !~ /hosts_entry/
|
138
|
+
File.open('/etc/hosts', 'a') { |f| f.puts hosts_entry }
|
139
|
+
else
|
140
|
+
post_note "Please add the following line to your /etc/hosts file:\n#{hosts_entry}\n" +
|
141
|
+
"\nThe following aliases may help too:\n" +
|
142
|
+
"alias nrestart='kill -HUP `cat #{pid_path}/nginx.pid`'\n" +
|
143
|
+
"alias nstart='#{install_path}/sbin/nginx'\n" +
|
144
|
+
"alias nstop='#{install_path}/sbin/nginx -s stop'"
|
145
|
+
end
|
146
|
+
File.delete(File.join(ruby_dir, 'rake')) unless rake_exist
|
147
|
+
report_success
|
148
|
+
end
|
149
|
+
|
150
|
+
# Hosts entry in /etc/hosts
|
151
|
+
#
|
152
|
+
# === Return
|
153
|
+
# entry(String):: Hosts entry required to run local dev
|
154
|
+
def hosts_entry
|
155
|
+
'127.0.0.1 right-site.rightscale.local library.rightscale.local rightscale.local'
|
156
|
+
end
|
157
|
+
|
158
|
+
# Nginx error log path
|
159
|
+
def log_path
|
160
|
+
File.join(install_path, 'logs', 'nginx-error.log')
|
161
|
+
end
|
162
|
+
|
163
|
+
# Nginx pid file path
|
164
|
+
def pid_path
|
165
|
+
File.join(install_path, 'logs', 'nginx.pid')
|
166
|
+
end
|
167
|
+
|
168
|
+
# Nginx config
|
169
|
+
#
|
170
|
+
# === Parameters
|
171
|
+
# username(String):: Username used to run nginx
|
172
|
+
#
|
173
|
+
# === Return
|
174
|
+
# config(String):: Nginx config
|
175
|
+
def nginx_config
|
176
|
+
ruby_bin = Command.execute('which', 'ruby').output.chomp
|
177
|
+
res = Command.execute('ruby', '-e', "require 'rubygems';puts Gem.source_index.find_name('passenger').detect { |g| g.version.to_s == '#{PASSENGER_GEM_VERSION}' }.full_gem_path",
|
178
|
+
:abort_on_failure => 'Could not find passenger gem to build passenger_root')
|
179
|
+
passenger_root = res.output.chomp
|
180
|
+
report_fatal('Could not find passenger gem') if passenger_root.empty?
|
181
|
+
<<-EOS
|
182
|
+
worker_processes 1;
|
183
|
+
|
184
|
+
error_log #{log_path} debug;
|
185
|
+
pid #{pid_path};
|
186
|
+
|
187
|
+
events {
|
188
|
+
worker_connections 256;
|
189
|
+
}
|
190
|
+
|
191
|
+
http {
|
192
|
+
passenger_root #{passenger_root};
|
193
|
+
passenger_ruby #{ruby_bin};
|
194
|
+
passenger_max_pool_size 2;
|
195
|
+
passenger_pool_idle_time 0;
|
196
|
+
passenger_max_instances_per_app 1;
|
197
|
+
|
198
|
+
include mime.types;
|
199
|
+
default_type application/octet-stream;
|
200
|
+
|
201
|
+
|
202
|
+
sendfile on;
|
203
|
+
keepalive_timeout 65;
|
204
|
+
|
205
|
+
gzip on;
|
206
|
+
gzip_buffers 16 8k;
|
207
|
+
gzip_disable "MSIE [1-6]\.";
|
208
|
+
gzip_proxied any;
|
209
|
+
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
|
210
|
+
|
211
|
+
server {
|
212
|
+
ssi on;
|
213
|
+
listen 8080;
|
214
|
+
server_name right-site.rightscale.local;
|
215
|
+
root /Users/raphael/src/right_site/public;
|
216
|
+
passenger_enabled on;
|
217
|
+
rails_env development;
|
218
|
+
|
219
|
+
# POST and AJAX requests need to proxied directly to the library app
|
220
|
+
#####################################################################
|
221
|
+
set $is_library_direct "";
|
222
|
+
|
223
|
+
# provisioning routes to the library
|
224
|
+
if ($request_uri ~ ^/provisioning)
|
225
|
+
{
|
226
|
+
rewrite ^/provisioning(.*)$ /direct_library/provisioning$1 last;
|
227
|
+
}
|
228
|
+
|
229
|
+
if ($request_uri ~ ^/aria_provisioning_callbacks)
|
230
|
+
{
|
231
|
+
rewrite ^/aria_provisioning_callbacks(.*)$ /direct_library/aria_provisioning_callbacks$1 last;
|
232
|
+
}
|
233
|
+
|
234
|
+
# request is for a library related action
|
235
|
+
if ($request_uri ~ ^/library/)
|
236
|
+
{
|
237
|
+
set $is_library_direct L;
|
238
|
+
}
|
239
|
+
|
240
|
+
# request is a POST
|
241
|
+
if ($request_method = POST)
|
242
|
+
{
|
243
|
+
set $is_library_direct "${is_library_direct}P";
|
244
|
+
}
|
245
|
+
|
246
|
+
# request is an AJAX
|
247
|
+
if ($http_x_requested_with = XMLHttpRequest)
|
248
|
+
{
|
249
|
+
set $is_library_direct "${is_library_direct}A";
|
250
|
+
}
|
251
|
+
|
252
|
+
# library post request should be directly proxied
|
253
|
+
if ($is_library_direct = LP)
|
254
|
+
{
|
255
|
+
rewrite ^/library/(.*)$ /direct_library/$1 last;
|
256
|
+
}
|
257
|
+
|
258
|
+
# library post ajax request should be directly proxied
|
259
|
+
if ($is_library_direct = LPA)
|
260
|
+
{
|
261
|
+
rewrite ^/library/(.*)$ /direct_library/$1 last;
|
262
|
+
}
|
263
|
+
|
264
|
+
# library ajax request should be directly proxied
|
265
|
+
if ($is_library_direct = LA)
|
266
|
+
{
|
267
|
+
rewrite ^/library/(.*)$ /direct_library/$1 last;
|
268
|
+
}
|
269
|
+
#####################################################################
|
270
|
+
|
271
|
+
location /direct_library/
|
272
|
+
{
|
273
|
+
proxy_pass http://library.rightscale.local:8081/;
|
274
|
+
proxy_set_header X-Relative-Root library;
|
275
|
+
proxy_set_header X-Embedded on;
|
276
|
+
proxy_set_header X-Core-Site-Domain right-site.rightscale.local;
|
277
|
+
}
|
278
|
+
|
279
|
+
location ~ ^/library/users/(.+)/openid_consume
|
280
|
+
{
|
281
|
+
proxy_pass http://library.rightscale.local:8081/users/$1/openid_consume?$args;
|
282
|
+
proxy_set_header X-Relative-Root library;
|
283
|
+
proxy_set_header X-Embedded on;
|
284
|
+
}
|
285
|
+
|
286
|
+
|
287
|
+
location ~ ^/library/(.*).(css|js)
|
288
|
+
{
|
289
|
+
# library assets get proxied directly to the library app
|
290
|
+
proxy_pass http://library.rightscale.local:8081/$1.$2;
|
291
|
+
}
|
292
|
+
|
293
|
+
location /library_images/
|
294
|
+
{
|
295
|
+
proxy_pass http://library.rightscale.local:8081/library_images/;
|
296
|
+
}
|
297
|
+
|
298
|
+
|
299
|
+
location /library_rest/
|
300
|
+
{
|
301
|
+
proxy_pass http://127.0.0.1:87/;
|
302
|
+
proxy_set_header X-Relative-Root library;
|
303
|
+
proxy_set_header X-Core-Site-Domain right-site.rightscale.local;
|
304
|
+
}
|
305
|
+
}
|
306
|
+
server {
|
307
|
+
ssi on;
|
308
|
+
listen 8081;
|
309
|
+
server_name library.rightscale.local;
|
310
|
+
root #{library_src_path}/public;
|
311
|
+
passenger_enabled on;
|
312
|
+
rails_env development;
|
313
|
+
}
|
314
|
+
}
|
315
|
+
EOS
|
316
|
+
end
|
317
|
+
|
318
|
+
end
|
319
|
+
end
|
320
|
+
|
@@ -23,9 +23,9 @@ module RightConf
|
|
23
23
|
description "Installs ruby interpreter and rubygems.\n" +
|
24
24
|
'Installs and uses rvm on supported (i.e. non-Windows) platforms'
|
25
25
|
|
26
|
-
settings :version
|
27
|
-
:rubygems
|
28
|
-
:gemset
|
26
|
+
settings :version => 'Ruby version using rvm notation (see "rvm list known")',
|
27
|
+
:rubygems => 'Rubygems version, e.g. "1.3.7"',
|
28
|
+
:gemset => 'Gemset to be used for platforms supporting rvm'
|
29
29
|
|
30
30
|
validate_has_settings :version, :rubygems
|
31
31
|
|
@@ -54,7 +54,8 @@ module RightConf
|
|
54
54
|
when /^Using /
|
55
55
|
report_success
|
56
56
|
check_rvmrc
|
57
|
-
post_note "Configuration required switching the active ruby\nPlease 'cd
|
57
|
+
post_note "Configuration required switching the active ruby\nPlease run " + 'cd ..;cd -'.blue + ' to activate it and re-run rconf'
|
58
|
+
aborting(true)
|
58
59
|
else
|
59
60
|
report_fatal("Failed to use #{version}:\n#{out}")
|
60
61
|
end
|
@@ -78,7 +79,6 @@ module RightConf
|
|
78
79
|
:abort_on_failure => "Failed to switch to gemset '#{gemset}'")
|
79
80
|
report_success
|
80
81
|
end
|
81
|
-
Command.set_prefix("rvm #{version}@#{gemset} exec --")
|
82
82
|
true
|
83
83
|
end
|
84
84
|
alias :run_darwin :run_linux
|
@@ -91,6 +91,15 @@ module RightConf
|
|
91
91
|
def run_windows
|
92
92
|
end
|
93
93
|
|
94
|
+
# Set command prefix when already configured
|
95
|
+
#
|
96
|
+
# === Return
|
97
|
+
# true:: Always return true
|
98
|
+
def post_process
|
99
|
+
Command.set_prefix("rvm #{version}@#{gemset} exec --")
|
100
|
+
true
|
101
|
+
end
|
102
|
+
|
94
103
|
protected
|
95
104
|
|
96
105
|
# Check whether the right version of RVM is installed and install it if not
|
@@ -215,6 +224,7 @@ module RightConf
|
|
215
224
|
FileUtils.mv(bashrc_path, bashrc_path + '.old')
|
216
225
|
File.open(bashrc_path, 'w') { |f| f.puts content }
|
217
226
|
post_note 'rvm was installed, please reload your shell to activate it and re-run rconf'
|
227
|
+
aborting(true)
|
218
228
|
end
|
219
229
|
else
|
220
230
|
report_error("Failed to update bashrc to activate rvm, no bashrc found")
|
data/lib/rconf/profile.rb
CHANGED
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', 'install', {:abort_on_failure=>"Failed to install gems"}).and_return(success_result)
|
32
|
+
'bundle', 'install', '_0_', {: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', 'install', {:abort_on_failure=>"Failed to install gems"}).and_return(success_result)
|
40
|
+
'bundle', 'install', '_0_', {: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(
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# Copyright (C) 2011 RightScale, Inc, All Rights Reserved Worldwide.
|
2
|
+
#
|
3
|
+
# THIS PROGRAM IS CONFIDENTIAL AND PROPRIETARY TO RIGHTSCALE
|
4
|
+
# AND CONSTITUTES A VALUABLE TRADE SECRET. Any unauthorized use,
|
5
|
+
# reproduction, modification, or disclosure of this program is
|
6
|
+
# strictly prohibited. Any use of this program by an authorized
|
7
|
+
# licensee is strictly subject to the terms and conditions,
|
8
|
+
# including confidentiality obligations, set forth in the applicable
|
9
|
+
# License Agreement between RightScale.com, Inc. and
|
10
|
+
# the licensee
|
11
|
+
|
12
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
|
13
|
+
|
14
|
+
describe RightConf::PassengerConfigurator do
|
15
|
+
|
16
|
+
before(:each) do
|
17
|
+
lang = RightConf::Language.parse('passenger {}')
|
18
|
+
@configurator = lang.configurators.first
|
19
|
+
[:report_check, :report_result, :report_fatal, :report_success].each do |meth|
|
20
|
+
flexmock(@configurator).should_receive(meth)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'should set defaults' do
|
25
|
+
@configurator.__send__(:set_defaults)
|
26
|
+
@configurator.right_site_src_path.should == Dir.getwd
|
27
|
+
@configurator.library_src_path.should == File.expand_path(File.join(Dir.getwd, '..', 'library'))
|
28
|
+
@configurator.gem_version.should == RightConf::PassengerConfigurator::PASSENGER_GEM_VERSION
|
29
|
+
@configurator.install_path.should == @configurator.__send__(:default_install_path)
|
30
|
+
@configurator.user.should == ENV['USER']
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'should default to /opt/nginx when possible' do
|
34
|
+
to_check = File.exist?('/opt/nginx') ? '/opt/nginx' :
|
35
|
+
(File.exist?('/opt') ? '/opt' : '/')
|
36
|
+
if File.writable?(to_check)
|
37
|
+
@configurator.__send__(:default_install_path).should == '/opt/nginx'
|
38
|
+
else
|
39
|
+
pending '/opt/nginx not writable'
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
|
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.10
|
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-11 00:00:00 -08:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -64,6 +64,7 @@ files:
|
|
64
64
|
- lib/rconf/configurator_registry.rb
|
65
65
|
- lib/rconf/configurators/bundler_configurator.rb
|
66
66
|
- lib/rconf/configurators/packages_configurator.rb
|
67
|
+
- lib/rconf/configurators/passenger_configurator.rb
|
67
68
|
- lib/rconf/configurators/ruby_configurator.rb
|
68
69
|
- lib/rconf/language.rb
|
69
70
|
- lib/rconf/platform.rb
|
@@ -84,6 +85,7 @@ files:
|
|
84
85
|
- spec/configurator_spec.rb
|
85
86
|
- spec/configurators/bundler_configurator_spec.rb
|
86
87
|
- spec/configurators/packages_configurator_spec.rb
|
88
|
+
- spec/configurators/passenger_configurator_spec.rb
|
87
89
|
- spec/configurators/ruby_configurator_spec.rb
|
88
90
|
- spec/language_spec.rb
|
89
91
|
- spec/platform_spec.rb
|
@@ -126,6 +128,7 @@ test_files:
|
|
126
128
|
- spec/configurator_spec.rb
|
127
129
|
- spec/configurators/bundler_configurator_spec.rb
|
128
130
|
- spec/configurators/packages_configurator_spec.rb
|
131
|
+
- spec/configurators/passenger_configurator_spec.rb
|
129
132
|
- spec/configurators/ruby_configurator_spec.rb
|
130
133
|
- spec/language_spec.rb
|
131
134
|
- spec/platform_spec.rb
|