4
4
require 'puppet/util/feature'
6
Puppet.features.rubygems?
6
8
Puppet.features.add(:rails) do
8
10
require 'active_record'
11
require 'active_record/version'
9
12
rescue LoadError => detail
10
if Facter["operatingsystem"].value == "Debian" and
11
FileTest.exists?("/usr/share/rails")
13
Dir.entries("/usr/share/rails").each do |dir|
14
libdir = File.join("/usr/share/rails", dir, "lib")
15
if FileTest.exists?(libdir) and ! $:.include?(libdir)
25
#If ActiveRecord was installed only via rubygems this is required
27
require 'active_record'
31
# If we couldn't find it the normal way, try using a Gem.
32
unless defined? ActiveRecord
41
# We check a fairly specific class, so that we can be sure that we've
42
# loaded a new enough version of AR that will support the features we
44
if defined? ActiveRecord::Associations::BelongsToPolymorphicAssociation
45
require 'puppet/rails'
13
if FileTest.exists?("/usr/share/rails")
15
Dir.entries("/usr/share/rails").each do |dir|
16
libdir = File.join("/usr/share/rails", dir, "lib")
17
if FileTest.exists?(libdir) and ! $:.include?(libdir)
29
if ! (defined?(::ActiveRecord) and defined?(::ActiveRecord::VERSION) and defined?(::ActiveRecord::VERSION::MAJOR) and defined?(::ActiveRecord::VERSION::MINOR))
31
elsif ! (::ActiveRecord::VERSION::MAJOR == 2 and ::ActiveRecord::VERSION::MINOR >= 1)
32
Puppet.info "ActiveRecord 2.1 or later required for StoreConfigs"