summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordanielsdeleo <dan@chef.io>2016-02-05 17:58:33 -0800
committerdanielsdeleo <dan@chef.io>2016-02-16 15:26:43 -0800
commitcd99ce3594d6a1576af08b5a08a8ffe9451f5a63 (patch)
treee4ccbb468fef89433b955796147fc3a3cda8ca25
parent0ec54bd9f92a7c525871ea4b4a408dc8ba22cb1a (diff)
downloadchef-cd99ce3594d6a1576af08b5a08a8ffe9451f5a63.tar.gz
inline cheffs cookbook entry superclasses by 1
-rw-r--r--lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_entry.rb76
1 files changed, 75 insertions, 1 deletions
diff --git a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_entry.rb b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_entry.rb
index 80c3039f4d..0dffc78a4a 100644
--- a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_entry.rb
+++ b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_entry.rb
@@ -24,11 +24,31 @@ class Chef
module ChefFS
module FileSystem
module Repository
- class ChefRepositoryFileSystemCookbookEntry < ChefRepositoryFileSystemEntry
+ # Original
+ #class ChefRepositoryFileSystemCookbookEntry < ChefRepositoryFileSystemEntry
+
+ # With ChefRepositoryFileSystemEntry inlined
+ class ChefRepositoryFileSystemCookbookEntry < FileSystemEntry
+
+ # Original initialize
+ ## def initialize(name, parent, file_path = nil, ruby_only = false, recursive = false)
+ ## super(name, parent, file_path)
+ ## @ruby_only = ruby_only
+ ## @recursive = recursive
+ ## end
+
+ # ChefRepositoryFileSystemEntry#initialize
+ ## def initialize(name, parent, file_path = nil, data_handler = nil)
+ ## super(name, parent, file_path)
+ ## @data_handler = data_handler
+ ## end
+
+ # inlined initialize
def initialize(name, parent, file_path = nil, ruby_only = false, recursive = false)
super(name, parent, file_path)
@ruby_only = ruby_only
@recursive = recursive
+ @data_handler = nil
end
attr_reader :ruby_only
@@ -75,6 +95,60 @@ class Chef
def make_child_entry(child_name)
ChefRepositoryFileSystemCookbookEntry.new(child_name, self, nil, ruby_only, recursive)
end
+
+ public
+
+ ##############################
+ # inlined from ChefRepositoryFileSystemEntry
+ ##############################
+
+ # overriden by superclass
+ ## def write_pretty_json
+ ## @write_pretty_json.nil? ? root.write_pretty_json : @write_pretty_json
+ ## end
+
+ # unused?
+ ## def data_handler
+ ## @data_handler || parent.data_handler
+ ## end
+
+ # unused?
+ ## def chef_object
+ ## begin
+ ## return data_handler.chef_object(Chef::JSONCompat.parse(read))
+ ## rescue
+ ## Chef::Log.error("Could not read #{path_for_printing} into a Chef object: #{$!}")
+ ## end
+ ## nil
+ ## end
+
+ # overriden by superclass
+ ## def can_have_child?(name, is_dir)
+ ## !is_dir && name[-5..-1] == ".json"
+ ## end
+
+ # unused?
+ ## def write(file_contents)
+ ## if file_contents && write_pretty_json && name[-5..-1] == ".json"
+ ## file_contents = minimize(file_contents, self)
+ ## end
+ ## super(file_contents)
+ ## end
+
+ # unused?
+ ## def minimize(file_contents, entry)
+ ## object = Chef::JSONCompat.parse(file_contents)
+ ## object = data_handler.normalize(object, entry)
+ ## object = data_handler.minimize(object, entry)
+ ## Chef::JSONCompat.to_json_pretty(object)
+ ## end
+
+ # overriden by superclass
+ ## protected
+
+ ## def make_child_entry(child_name)
+ ## ChefRepositoryFileSystemEntry.new(child_name, self)
+ ## end
end
end
end