diff options
author | danielsdeleo <dan@chef.io> | 2016-02-08 14:14:53 -0800 |
---|---|---|
committer | danielsdeleo <dan@chef.io> | 2016-02-16 11:41:03 -0800 |
commit | 378ac34c757ee521388aa69f1e00b372712d7573 (patch) | |
tree | 3294816bf77e06a7685e172cf24d1a0f3f1e9d98 | |
parent | 5c05097882be5410698088df8756839cfa5f408f (diff) | |
download | chef-378ac34c757ee521388aa69f1e00b372712d7573.tar.gz |
Fix chefstyle issues
3 files changed, 12 insertions, 25 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 5161ca087f..307866c350 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 @@ -50,8 +50,8 @@ class Chef def children begin entries = Dir.entries(file_path).sort. - map { |child_name| make_child_entry(child_name) }. - select { |child| child && can_have_child?(child.name, child.dir?) } + map { |child_name| make_child_entry(child_name) }. + select { |child| child && can_have_child?(child.name, child.dir?) } entries.select { |entry| !(entry.dir? && entry.children.size == 0 ) } rescue Errno::ENOENT raise Chef::ChefFS::FileSystem::NotFoundError.new(self, $!) @@ -94,7 +94,7 @@ class Chef file_path end - def create_child(child_name, file_contents=nil) + def create_child(child_name, file_contents = nil) child = make_child_entry(child_name) if child.exists? raise Chef::ChefFS::FileSystem::AlreadyExistsError.new(:create_child, child) @@ -136,7 +136,7 @@ class Chef def read begin - File.open(file_path, "rb") {|f| f.read} + File.open(file_path, "rb") { |f| f.read } rescue Errno::ENOENT raise Chef::ChefFS::FileSystem::NotFoundError.new(self, $!) end @@ -155,19 +155,6 @@ class Chef result || NonexistentFSObject.new(name, self) end - def path_for_printing - if parent - parent_path = parent.path_for_printing - if parent_path == "." - name - else - Chef::ChefFS::PathUtils::join(parent.path_for_printing, name) - end - else - name - end - end - def root parent.root end diff --git a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbooks_dir.rb b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbooks_dir.rb index 072b36e356..9ebda1a111 100644 --- a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbooks_dir.rb +++ b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbooks_dir.rb @@ -50,8 +50,8 @@ class Chef def children begin cookbooks = Dir.entries(file_path).sort. - map { |child_name| make_child_entry(child_name) }. - select { |child| child && can_have_child?(child.name, child.dir?) } + map { |child_name| make_child_entry(child_name) }. + select { |child| child && can_have_child?(child.name, child.dir?) } # empty cookbooks and cookbook directories are ignored cookbooks.select do |entry| if !entry.can_upload? @@ -98,7 +98,7 @@ class Chef file_path end - def create_child(child_name, file_contents=nil) + def create_child(child_name, file_contents = nil) child = make_child_entry(child_name) if child.exists? raise Chef::ChefFS::FileSystem::AlreadyExistsError.new(:create_child, child) diff --git a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_data_bags_dir.rb b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_data_bags_dir.rb index f28819246d..11072557f5 100644 --- a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_data_bags_dir.rb +++ b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_data_bags_dir.rb @@ -51,12 +51,12 @@ class Chef def children dir_ls.sort. - map { |child_name| make_child_entry(child_name) } + map { |child_name| make_child_entry(child_name) } rescue Errno::ENOENT => e raise Chef::ChefFS::FileSystem::NotFoundError.new(self, e) end - def create_child(child_name, file_contents=nil) + def create_child(child_name, file_contents = nil) make_child_entry(child_name).tap { |c| c.create } end @@ -148,13 +148,13 @@ class Chef def children begin dir_ls.sort. - map { |child_name| make_child_entry(child_name) } + map { |child_name| make_child_entry(child_name) } rescue Errno::ENOENT raise Chef::ChefFS::FileSystem::NotFoundError.new(self, $!) end end - def create_child(child_name, file_contents=nil) + def create_child(child_name, file_contents = nil) make_child_entry(child_name).tap { |c| c.create(file_contents) } end @@ -256,7 +256,7 @@ class Chef def read begin - File.open(file_path, "rb") {|f| f.read} + File.open(file_path, "rb") { |f| f.read } rescue Errno::ENOENT raise Chef::ChefFS::FileSystem::NotFoundError.new(self, $!) end |