summaryrefslogtreecommitdiffstats
path: root/lib/puppet/feature
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2009-05-19 18:23:42 -0500
committerJames Turnbull <james@lovedthanlost.net>2009-06-03 07:32:21 +1000
commitabbb282211096780eea4efa461b2d7f958dc29ae (patch)
tree05a19387513bf2ca442392367bd2f8853a794915 /lib/puppet/feature
parent907b39b9708cbca10446336c424754e13d55e683 (diff)
downloadpuppet-abbb282211096780eea4efa461b2d7f958dc29ae.tar.gz
puppet-abbb282211096780eea4efa461b2d7f958dc29ae.tar.xz
puppet-abbb282211096780eea4efa461b2d7f958dc29ae.zip
Fixing the rails feature to be compatible with 2.1+
Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'lib/puppet/feature')
-rw-r--r--lib/puppet/feature/rails.rb35
1 files changed, 16 insertions, 19 deletions
diff --git a/lib/puppet/feature/rails.rb b/lib/puppet/feature/rails.rb
index bdff7893c..b4c09a2ee 100644
--- a/lib/puppet/feature/rails.rb
+++ b/lib/puppet/feature/rails.rb
@@ -3,35 +3,32 @@
require 'puppet/util/feature'
+Puppet.features.rubygems?
+
Puppet.features.add(:rails) do
begin
require 'active_record'
rescue LoadError => detail
- if Facter["operatingsystem"].value == "Debian" and
- FileTest.exists?("/usr/share/rails")
- count = 0
- Dir.entries("/usr/share/rails").each do |dir|
- libdir = File.join("/usr/share/rails", dir, "lib")
- if FileTest.exists?(libdir) and ! $:.include?(libdir)
- count += 1
- $: << libdir
- end
+ if Facter["operatingsystem"].value == "Debian" and FileTest.exists?("/usr/share/rails")
+ count = 0
+ Dir.entries("/usr/share/rails").each do |dir|
+ libdir = File.join("/usr/share/rails", dir, "lib")
+ if FileTest.exists?(libdir) and ! $:.include?(libdir)
+ count += 1
+ $: << libdir
end
+ end
- if count > 0
- retry
- end
- else
- #If ActiveRecord was installed only via rubygems this is required
- require 'rubygems'
- require 'active_record'
+ if count > 0
+ retry
+ end
end
end
if ! (defined?(::ActiveRecord) and defined?(::ActiveRecord::VERSION) and defined?(::ActiveRecord::VERSION::MAJOR) and defined?(::ActiveRecord::VERSION::MINOR))
- false
- elsif ! ::ActiveRecord::VERSION::MAJOR == 2 and ::ActiveRecord::VERSION::MINOR == 3
- Puppet.info "ActiveRecord 2.3 required for StoreConfigs"
+ true
+ elsif ! (::ActiveRecord::VERSION::MAJOR == 2 and ::ActiveRecord::VERSION::MINOR >= 1)
+ Puppet.info "ActiveRecord 2.1 or later required for StoreConfigs"
false
else
true