summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordanielsdeleo <dan@chef.io>2016-02-08 14:14:53 -0800
committerdanielsdeleo <dan@chef.io>2016-02-16 15:26:43 -0800
commitc5481bf4b86fd10ba634df02793446d88f7c1f88 (patch)
tree2c3a49b949f90aa7dee2e754c0f86e1ec57218e0
parent051fa086c1cbfc66397bc5e080c644b92e8c6910 (diff)
downloadchef-c5481bf4b86fd10ba634df02793446d88f7c1f88.tar.gz
Fix chefstyle issues
-rw-r--r--lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_entry.rb21
-rw-r--r--lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbooks_dir.rb6
-rw-r--r--lib/chef/chef_fs/file_system/repository/chef_repository_file_system_data_bags_dir.rb10
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