From 4609e203fd47f8159118bb74a8308f9c6aee179f Mon Sep 17 00:00:00 2001 From: Pieter van de Bruggen Date: Fri, 25 Mar 2011 14:52:48 -0700 Subject: (#6770) Change versioning; adopt :current over :latest. As per discussion with Luke, versions of an interface are first looked up by requiring 'puppet/interface/{name}', and secondarily looked up by requiring '{name}@{version}/puppet/interface/{name}' if the first failed. A version of `:current` can be used to represent the version living in 'puppet/interface/{name}'. Paired-With: Nick Lewis --- lib/puppet/string.rb | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) (limited to 'lib/puppet/string.rb') diff --git a/lib/puppet/string.rb b/lib/puppet/string.rb index b5f7b9048..9a223a40c 100644 --- a/lib/puppet/string.rb +++ b/lib/puppet/string.rb @@ -70,23 +70,25 @@ class Puppet::String # Try to find actions defined in other files. def load_actions - path = "puppet/string/v#{version}/#{name}" + path = "puppet/string/#{name}" loaded = [] - Puppet::String.autoloader.search_directories.each do |dir| - fdir = ::File.join(dir, path) - next unless FileTest.directory?(fdir) - - Dir.chdir(fdir) do - Dir.glob("*.rb").each do |file| - aname = file.sub(/\.rb/, '') - if loaded.include?(aname) - Puppet.debug "Not loading duplicate action '#{aname}' for '#{name}' from '#{fdir}/#{file}'" - next + [path, "#{name}@#{version}/#{path}"].each do |path| + Puppet::String.autoloader.search_directories.each do |dir| + fdir = ::File.join(dir, path) + next unless FileTest.directory?(fdir) + + Dir.chdir(fdir) do + Dir.glob("*.rb").each do |file| + aname = file.sub(/\.rb/, '') + if loaded.include?(aname) + Puppet.debug "Not loading duplicate action '#{aname}' for '#{name}' from '#{fdir}/#{file}'" + next + end + loaded << aname + Puppet.debug "Loading action '#{aname}' for '#{name}' from '#{fdir}/#{file}'" + require "#{path}/#{aname}" end - loaded << aname - Puppet.debug "Loading action '#{aname}' for '#{name}' from '#{fdir}/#{file}'" - require "#{path}/#{aname}" end end end -- cgit From f7f1e5822f3921336872956fe07c4da4406ce8eb Mon Sep 17 00:00:00 2001 From: Pieter van de Bruggen Date: Tue, 29 Mar 2011 13:29:01 -0700 Subject: (#6770) Fix Puppet::String#load_actions. Reviewed-By: Nick Lewis --- lib/puppet/string.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/puppet/string.rb') diff --git a/lib/puppet/string.rb b/lib/puppet/string.rb index 9a223a40c..783b6afe0 100644 --- a/lib/puppet/string.rb +++ b/lib/puppet/string.rb @@ -87,7 +87,7 @@ class Puppet::String end loaded << aname Puppet.debug "Loading action '#{aname}' for '#{name}' from '#{fdir}/#{file}'" - require "#{path}/#{aname}" + require "#{Dir.pwd}/#{aname}" end end end -- cgit