summaryrefslogtreecommitdiff
path: root/lib/chef/cookbook_version.rb
diff options
context:
space:
mode:
authorBryan McLellan <btm@opscode.com>2013-07-03 07:39:59 -0700
committerBryan McLellan <btm@opscode.com>2013-07-03 07:39:59 -0700
commit39f8848aac823bbd2c5186e0454da3a0fb8e8b0e (patch)
treef938f9b84ab0bd96e3f7e21b79d34b6859eadc3a /lib/chef/cookbook_version.rb
parent302c3c6cdf592a677d957975a9d2dc31435e12a8 (diff)
downloadchef-39f8848aac823bbd2c5186e0454da3a0fb8e8b0e.tar.gz
Revert "Merge branch 'CHEF-3307'"
This reverts commit 5713a002062c762e40e4378be6d7763eb3dd61a2, reversing changes made to 4079a344f2001c1927132e7ed6b63453f459609f. Conflicts: spec/unit/cookbook_loader_spec.rb
Diffstat (limited to 'lib/chef/cookbook_version.rb')
-rw-r--r--lib/chef/cookbook_version.rb16
1 files changed, 6 insertions, 10 deletions
diff --git a/lib/chef/cookbook_version.rb b/lib/chef/cookbook_version.rb
index 31ccbabe59..4e8b2a048e 100644
--- a/lib/chef/cookbook_version.rb
+++ b/lib/chef/cookbook_version.rb
@@ -50,7 +50,7 @@ class Chef
attr_accessor :resource_filenames
attr_accessor :provider_filenames
attr_accessor :root_filenames
- attr_accessor :pathname
+ attr_accessor :name
attr_accessor :metadata
attr_accessor :metadata_filenames
attr_accessor :status
@@ -83,8 +83,8 @@ class Chef
#
# === Returns
# object<Chef::CookbookVersion>:: Duh. :)
- def initialize(pathname)
- @pathname = pathname
+ def initialize(name)
+ @name = name
@frozen = false
@attribute_filenames = Array.new
@definition_filenames = Array.new
@@ -104,10 +104,6 @@ class Chef
@metadata = Chef::Cookbook::Metadata.new
end
- def name
- metadata.name || @pathname
- end
-
def version
metadata.version
end
@@ -602,11 +598,11 @@ class Chef
specificity = "default"
if segment == :root_files
- matcher = segment_file.match(".+/#{Regexp.escape(pathname.to_s)}/(.+)")
+ matcher = segment_file.match(".+/#{Regexp.escape(name.to_s)}/(.+)")
file_name = matcher[1]
path = file_name
elsif segment == :templates || segment == :files
- matcher = segment_file.match("/#{Regexp.escape(pathname.to_s)}/(#{Regexp.escape(segment.to_s)}/(.+?)/(.+))")
+ matcher = segment_file.match("/#{Regexp.escape(name.to_s)}/(#{Regexp.escape(segment.to_s)}/(.+?)/(.+))")
unless matcher
Chef::Log.debug("Skipping file #{segment_file}, as it isn't in any of the proper directories (platform-version, platform or default)")
Chef::Log.debug("You probably need to move #{segment_file} into the 'default' sub-directory")
@@ -616,7 +612,7 @@ class Chef
specificity = matcher[2]
file_name = matcher[3]
else
- matcher = segment_file.match("/#{Regexp.escape(pathname.to_s)}/(#{Regexp.escape(segment.to_s)}/(.+))")
+ matcher = segment_file.match("/#{Regexp.escape(name.to_s)}/(#{Regexp.escape(segment.to_s)}/(.+))")
path = matcher[1]
file_name = matcher[2]
end