Sha256: 9c56962a7ac6fd8dccf237a35f05e77c2a1a13d7d35f48e6701a650192d41663
Contents?: true
Size: 1.46 KB
Versions: 10
Compression:
Stored size: 1.46 KB
Contents
# Created by Luke Kanies on 2006-11-07. # Copyright (c) 2006. All rights reserved. require 'puppet/util/feature' 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 end if count > 0 retry end else #If ActiveRecord was installed only via rubygems this is required require 'rubygems' require 'active_record' end end # If we couldn't find it the normal way, try using a Gem. unless defined? ActiveRecord begin require 'rubygems' require 'rails' rescue LoadError # Nothing end end # We check a fairly specific class, so that we can be sure that we've # loaded a new enough version of AR that will support the features we # actually use. if defined? ActiveRecord::Associations::BelongsToPolymorphicAssociation require 'puppet/rails' true else false end end
Version data entries
10 entries across 10 versions & 1 rubygems