JasonKing-pulp 0.0.2 → 0.0.3
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/lib/passenger/config.rb +25 -3
- metadata +2 -2
data/lib/passenger/config.rb
CHANGED
@@ -1,11 +1,19 @@
|
|
1
|
+
require 'rubygems'
|
1
2
|
require 'fileutils'
|
2
3
|
require 'etc'
|
3
4
|
require 'find'
|
4
5
|
require 'grep'
|
5
6
|
|
6
7
|
module Passenger
|
8
|
+
class Version
|
9
|
+
include Comparable
|
10
|
+
def initialize(_v); @v = _v.split('.').map(&:to_i); end
|
11
|
+
def <=>(_v); @v <=> _v.split('.').map(&:to_i); end
|
12
|
+
def to_s; @v.join('.'); end
|
13
|
+
end
|
14
|
+
|
7
15
|
class Config
|
8
|
-
VERSION = '0.8.
|
16
|
+
VERSION = '0.8.2'
|
9
17
|
attr_reader :domain
|
10
18
|
attr_reader :ip
|
11
19
|
attr_reader :hosts
|
@@ -14,6 +22,7 @@ module Passenger
|
|
14
22
|
|
15
23
|
@@httpd_cmd = 'httpd'
|
16
24
|
@@apachectl = 'apachectl'
|
25
|
+
@@passenger_config = 'passenger-config'
|
17
26
|
|
18
27
|
@@user_re = /^\s*User\s+(\S+)/i
|
19
28
|
@@group_re = /^\s*Group\s+(\S+)/i
|
@@ -251,8 +260,8 @@ module Passenger
|
|
251
260
|
#
|
252
261
|
@_conf_strings = {
|
253
262
|
:vhost => /^\s*NameVirtualHost\s+(\S+)/i,
|
254
|
-
:load => %r{^\s*LoadModule\s+passenger_module\s+((/\S+)/lib/ruby/gems/\S+/passenger-[\d.]+)/ext/apache2/mod_passenger.so}i,
|
255
|
-
:root => %r{^\s*PassengerRoot\s+(['"]?)(/\S+/lib/ruby/gems/\S+/passenger-[\d.]+)\1}i,
|
263
|
+
:load => %r{^\s*LoadModule\s+passenger_module\s+((/\S+)/lib/ruby/gems/\S+/passenger-([\d.]+))/ext/apache2/mod_passenger.so}i,
|
264
|
+
:root => %r{^\s*PassengerRoot\s+(['"]?)(/\S+/lib/ruby/gems/\S+/passenger-([\d.]+))\1}i,
|
256
265
|
:ruby => %r{^\s*PassengerRuby\s+(['"]?)(/\S+)/bin/ruby\1}i,
|
257
266
|
:renv => %r{^\s*RailsEnv\s+(['"]?)(\S+)\1}i
|
258
267
|
}
|
@@ -359,6 +368,15 @@ module Passenger
|
|
359
368
|
unless _load_passenger_location == _root_passenger_location = @conf_files[:root][:match][2]
|
360
369
|
raise "Passenger module location #{_load_passenger_location} and PassengerRoot setting #{_root_passenger_location} should be the same."
|
361
370
|
end
|
371
|
+
|
372
|
+
_configured_passenger_version = Version.new(@conf_files[:root][:match][3])
|
373
|
+
unless _configured_passenger_version >= passenger_config_version
|
374
|
+
warn "Configured passenger [#{_configured_passenger_version}] looks older than latest installed [#{passenger_config_version}]\n" +
|
375
|
+
" You should edit: '#{passenger_conf}'\n"+
|
376
|
+
" Or if you have sed maybe this:\n"+
|
377
|
+
" sudo sed -i '' -e's~#{_root_passenger_location.sub(%r{.*/},'')}~#{_root_passenger_location.sub(%r{.*/},'').sub(/#{_configured_passenger_version}/, passenger_config_version)}~' '#{passenger_conf}'" +
|
378
|
+
" ...and then rerun #{$0}."
|
379
|
+
end
|
362
380
|
end
|
363
381
|
|
364
382
|
_load_passenger_prefix = @conf_files[:load][:match][2]
|
@@ -369,6 +387,10 @@ module Passenger
|
|
369
387
|
end
|
370
388
|
end
|
371
389
|
|
390
|
+
def passenger_config_version
|
391
|
+
@passenger_config_version ||= `#{@@passenger_config} --version`.chomp
|
392
|
+
end
|
393
|
+
|
372
394
|
def vhost
|
373
395
|
@vhost ||= @conf_files[:vhost][:match][1]
|
374
396
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: JasonKing-pulp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason King
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-03-
|
12
|
+
date: 2009-03-17 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|