Ignore this. Found more twisty paths and going to do a new patch that fixes some other issues that popped up too. On May 19, 2011 4:47 PM, "James Turnbull" <[email protected]> wrote: > In ticket #1064 we made the use of 'plugins' directories in modules > deprecated. This was released in 0.25.0 in 2009. This commit removes > this deprecation warning and defaults the plugin directory to 'lib'. > > All tests also fixed. > > Signed-off-by: James Turnbull <[email protected]> > --- > Local-branch: tickets/master/7591 > lib/puppet/file_serving/mount/plugins.rb | 2 +- > lib/puppet/module.rb | 19 ++--------- > spec/unit/file_serving/mount/plugins_spec.rb | 4 +- > spec/unit/module_spec.rb | 40 +++++-------------------- > 4 files changed, 15 insertions(+), 50 deletions(-) > > diff --git a/lib/puppet/file_serving/mount/plugins.rb b/lib/puppet/file_serving/mount/plugins.rb > index d21d6e9..b0dd985 100644 > --- a/lib/puppet/file_serving/mount/plugins.rb > +++ b/lib/puppet/file_serving/mount/plugins.rb > @@ -16,7 +16,7 @@ class Puppet::FileServing::Mount::Plugins < Puppet::FileServing::Mount > def search(relative_path, request) > # We currently only support one kind of search on plugins - return > # them all. > - paths = request.environment.modules.find_all { |mod| mod.plugins? }.collect { |mod| mod.plugin_directory } > + paths = request.environment.modules.find_all { |mod| mod.plugins? }.collect { |mod| mod.lib_directory } > return(paths.empty? ? nil : paths) > end > > diff --git a/lib/puppet/module.rb b/lib/puppet/module.rb > index 059591e..7534b59 100644 > --- a/lib/puppet/module.rb > +++ b/lib/puppet/module.rb > @@ -15,7 +15,7 @@ class Puppet::Module > TEMPLATES = "templates" > FILES = "files" > MANIFESTS = "manifests" > - PLUGINS = "plugins" > + PLUGINS = "lib" > > FILETYPES = [MANIFESTS, FILES, TEMPLATES, PLUGINS] > > @@ -142,8 +142,8 @@ class Puppet::Module > end > > # Find all plugin directories. This is used by the Plugins fileserving mount. > - def plugin_directory > - subpath("plugins") > + def lib_directory > + subpath("lib") > end > > def requires(name, version = nil) > @@ -184,18 +184,7 @@ class Puppet::Module > private > > def subpath(type) > - return File.join(path, type) unless type.to_s == "plugins" > - > - backward_compatible_plugins_dir > - end > - > - def backward_compatible_plugins_dir > - if dir = File.join(path, "plugins") and FileTest.exist?(dir) > - Puppet.warning "using the deprecated 'plugins' directory for ruby extensions; please move to 'lib'" > - return dir > - else > - return File.join(path, "lib") > - end > + return File.join(path, type) > end > > def assert_validity > diff --git a/spec/unit/file_serving/mount/plugins_spec.rb b/spec/unit/file_serving/mount/plugins_spec.rb > index b6bed72..29908a9 100755 > --- a/spec/unit/file_serving/mount/plugins_spec.rb > +++ b/spec/unit/file_serving/mount/plugins_spec.rb > @@ -50,8 +50,8 @@ describe Puppet::FileServing::Mount::Plugins do > end > > it "should return the plugin paths for each module that has plugins" do > - one = stub 'module', :plugins? => true, :plugin_directory => "/one" > - two = stub 'module', :plugins? => true, :plugin_directory => "/two" > + one = stub 'module', :plugins? => true, :lib_directory => "/one" > + two = stub 'module', :plugins? => true, :lib_directory => "/two" > > @environment.stubs(:modules).returns [one, two] > @mount.search("foo/bar", @request).should == %w{/one /two} > diff --git a/spec/unit/module_spec.rb b/spec/unit/module_spec.rb > index 8d38657..7db3a8d 100755 > --- a/spec/unit/module_spec.rb > +++ b/spec/unit/module_spec.rb > @@ -5,12 +5,6 @@ require 'puppet_spec/files' > describe Puppet::Module do > include PuppetSpec::Files > > - before do > - # This is necessary because of the extra checks we have for the deprecated > - # 'plugins' directory > - FileTest.stubs(:exist?).returns false > - end > - > it "should have a class method that returns a named module from a given environment" do > env = mock 'module' > env.expects(:module).with("mymod").returns "yep" > @@ -316,12 +310,11 @@ describe Puppet::Module do > mod.should_not be_exist > end > > - [:plugins, :templates, :files, :manifests].each do |filetype| > - dirname = filetype == :plugins ? "lib" : filetype.to_s > + [:lib, :templates, :files, :manifests].each do |filetype| > it "should be able to return individual #{filetype}" do > mod = Puppet::Module.new("foo") > mod.stubs(:path).returns "/a/foo" > - path = File.join("/a/foo", dirname, "my/file") > + path = File.join("/a/foo", filetype.to_s, "my/file") > FileTest.expects(:exist?).with(path).returns true > mod.send(filetype.to_s.sub(/s$/, ''), "my/file").should == path > end > @@ -329,7 +322,7 @@ describe Puppet::Module do > it "should consider #{filetype} to be present if their base directory exists" do > mod = Puppet::Module.new("foo") > mod.stubs(:path).returns "/a/foo" > - path = File.join("/a/foo", dirname) > + path = File.join("/a/foo", filetype.to_s) > FileTest.expects(:exist?).with(path).returns true > mod.send(filetype.to_s + "?").should be_true > end > @@ -337,7 +330,7 @@ describe Puppet::Module do > it "should consider #{filetype} to be absent if their base directory does not exist" do > mod = Puppet::Module.new("foo") > mod.stubs(:path).returns "/a/foo" > - path = File.join("/a/foo", dirname) > + path = File.join("/a/foo", filetype.to_s) > FileTest.expects(:exist?).with(path).returns false > mod.send(filetype.to_s + "?").should be_false > end > @@ -351,7 +344,7 @@ describe Puppet::Module do > it "should return nil if asked to return individual #{filetype} that don't exist" do > mod = Puppet::Module.new("foo") > mod.stubs(:path).returns "/a/foo" > - path = File.join("/a/foo", dirname, "my/file") > + path = File.join("/a/foo", filetype.to_s, "my/file") > FileTest.expects(:exist?).with(path).returns false > mod.send(filetype.to_s.sub(/s$/, ''), "my/file").should be_nil > end > @@ -365,15 +358,14 @@ describe Puppet::Module do > it "should return the base directory if asked for a nil path" do > mod = Puppet::Module.new("foo") > mod.stubs(:path).returns "/a/foo" > - base = File.join("/a/foo", dirname) > + base = File.join("/a/foo", filetype.to_s) > FileTest.expects(:exist?).with(base).returns true > mod.send(filetype.to_s.sub(/s$/, ''), nil).should == base > end > end > > - %w{plugins files}.each do |filetype| > + %w{lib files}.each do |filetype| > short = filetype.sub(/s$/, '') > - dirname = filetype == "plugins" ? "lib" : filetype.to_s > it "should be able to return the #{short} directory" do > Puppet::Module.new("foo").should respond_to(short + "_directory") > end > @@ -382,25 +374,9 @@ describe Puppet::Module do > mod = Puppet::Module.new("foo") > mod.stubs(:path).returns "/a/foo" > > - mod.send(short + "_directory").should == "/a/foo/#{dirname}" > + mod.send(short + "_directory").should == "/a/foo/#{filetype}" > end > end > - > - it "should throw a warning if plugins are in a 'plugins' directory rather than a 'lib' directory" do > - mod = Puppet::Module.new("foo") > - mod.stubs(:path).returns "/a/foo" > - FileTest.expects(:exist?).with("/a/foo/plugins").returns true > - > - mod.plugin_directory.should == "/a/foo/plugins" > - @logs.first.message.should == "using the deprecated 'plugins' directory for ruby extensions; please move to 'lib'" > - @logs.first.level.should == :warning > - end > - > - it "should default to 'lib' for the plugins directory" do > - mod = Puppet::Module.new("foo") > - mod.stubs(:path).returns "/a/foo" > - mod.plugin_directory.should == "/a/foo/lib" > - end > end > > describe Puppet::Module, " when building its search path" do > -- > 1.7.1 > > -- > You received this message because you are subscribed to the Google Groups "Puppet Developers" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to [email protected]. > For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en. >
-- You received this message because you are subscribed to the Google Groups "Puppet Developers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.
