chef-dk 4.1.7 → 4.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +4 -2
  3. data/Gemfile.lock +113 -17
  4. data/lib/chef-dk/builtin_commands.rb +3 -0
  5. data/lib/chef-dk/cli.rb +3 -1
  6. data/lib/chef-dk/command/clean_policy_cookbooks.rb +1 -0
  7. data/lib/chef-dk/command/clean_policy_revisions.rb +1 -0
  8. data/lib/chef-dk/command/delete_policy.rb +1 -0
  9. data/lib/chef-dk/command/delete_policy_group.rb +1 -0
  10. data/lib/chef-dk/command/describe_cookbook.rb +1 -0
  11. data/lib/chef-dk/command/diff.rb +5 -3
  12. data/lib/chef-dk/command/env.rb +6 -6
  13. data/lib/chef-dk/command/export.rb +1 -0
  14. data/lib/chef-dk/command/generate.rb +1 -0
  15. data/lib/chef-dk/command/generator_commands/chef_exts/quieter_doc_formatter.rb +2 -4
  16. data/lib/chef-dk/command/generator_commands/generator_generator.rb +1 -0
  17. data/lib/chef-dk/command/install.rb +1 -0
  18. data/lib/chef-dk/command/push.rb +1 -0
  19. data/lib/chef-dk/command/push_archive.rb +1 -1
  20. data/lib/chef-dk/command/shell_init.rb +3 -2
  21. data/lib/chef-dk/command/show_policy.rb +1 -0
  22. data/lib/chef-dk/command/undelete.rb +1 -0
  23. data/lib/chef-dk/command/update.rb +1 -0
  24. data/lib/chef-dk/command/verify.rb +1 -1
  25. data/lib/chef-dk/component_test.rb +2 -1
  26. data/lib/chef-dk/configurable.rb +3 -2
  27. data/lib/chef-dk/cookbook_profiler/null_scm.rb +1 -2
  28. data/lib/chef-dk/generator.rb +1 -1
  29. data/lib/chef-dk/helpers.rb +2 -1
  30. data/lib/chef-dk/policyfile/artifactory_cookbook_source.rb +1 -1
  31. data/lib/chef-dk/policyfile/attribute_merge_checker.rb +1 -1
  32. data/lib/chef-dk/policyfile/chef_repo_cookbook_source.rb +1 -1
  33. data/lib/chef-dk/policyfile/chef_server_cookbook_source.rb +3 -3
  34. data/lib/chef-dk/policyfile/chef_server_lock_fetcher.rb +5 -5
  35. data/lib/chef-dk/policyfile/community_cookbook_source.rb +1 -1
  36. data/lib/chef-dk/policyfile/comparison_base.rb +1 -0
  37. data/lib/chef-dk/policyfile/cookbook_location_specification.rb +4 -4
  38. data/lib/chef-dk/policyfile/cookbook_locks.rb +8 -5
  39. data/lib/chef-dk/policyfile/delivery_supermarket_source.rb +1 -1
  40. data/lib/chef-dk/policyfile/differ.rb +6 -2
  41. data/lib/chef-dk/policyfile/dsl.rb +4 -2
  42. data/lib/chef-dk/policyfile/git_lock_fetcher.rb +2 -2
  43. data/lib/chef-dk/policyfile/included_policies_cookbook_source.rb +1 -1
  44. data/lib/chef-dk/policyfile/lister.rb +2 -2
  45. data/lib/chef-dk/policyfile/local_lock_fetcher.rb +7 -5
  46. data/lib/chef-dk/policyfile/lock_applier.rb +1 -1
  47. data/lib/chef-dk/policyfile/null_cookbook_source.rb +1 -2
  48. data/lib/chef-dk/policyfile/policyfile_location_specification.rb +3 -3
  49. data/lib/chef-dk/policyfile/remote_lock_fetcher.rb +1 -1
  50. data/lib/chef-dk/policyfile/solution_dependencies.rb +13 -11
  51. data/lib/chef-dk/policyfile/storage_config.rb +1 -0
  52. data/lib/chef-dk/policyfile/undo_record.rb +10 -8
  53. data/lib/chef-dk/policyfile/uploader.rb +3 -1
  54. data/lib/chef-dk/policyfile_compiler.rb +17 -13
  55. data/lib/chef-dk/policyfile_lock.rb +17 -15
  56. data/lib/chef-dk/policyfile_services/clean_policies.rb +3 -3
  57. data/lib/chef-dk/policyfile_services/clean_policy_cookbooks.rb +2 -2
  58. data/lib/chef-dk/policyfile_services/export_repo.rb +4 -2
  59. data/lib/chef-dk/policyfile_services/install.rb +3 -1
  60. data/lib/chef-dk/policyfile_services/push.rb +6 -5
  61. data/lib/chef-dk/policyfile_services/push_archive.rb +6 -5
  62. data/lib/chef-dk/policyfile_services/rm_policy.rb +6 -2
  63. data/lib/chef-dk/policyfile_services/rm_policy_group.rb +2 -2
  64. data/lib/chef-dk/policyfile_services/show_policy.rb +2 -2
  65. data/lib/chef-dk/policyfile_services/undelete.rb +2 -2
  66. data/lib/chef-dk/version.rb +1 -1
  67. data/lib/kitchen/provisioner/policyfile_zero.rb +3 -6
  68. data/spec/unit/cli_spec.rb +6 -6
  69. data/spec/unit/command/base_spec.rb +1 -1
  70. data/spec/unit/command/env_spec.rb +1 -1
  71. data/spec/unit/command/exec_spec.rb +1 -1
  72. data/spec/unit/command/export_spec.rb +1 -1
  73. data/spec/unit/command/generator_commands/recipe_spec.rb +2 -1
  74. data/spec/unit/command/generator_commands/repo_spec.rb +6 -6
  75. data/spec/unit/command/verify_spec.rb +1 -1
  76. data/spec/unit/policyfile/attribute_merge_checker_spec.rb +10 -8
  77. data/spec/unit/policyfile/chef_server_lock_fetcher_spec.rb +4 -2
  78. data/spec/unit/policyfile/cookbook_locks_spec.rb +9 -9
  79. data/spec/unit/policyfile/git_lock_fetcher_spec.rb +5 -5
  80. data/spec/unit/policyfile/included_policies_cookbook_source_spec.rb +5 -3
  81. data/spec/unit/policyfile/lister_spec.rb +5 -5
  82. data/spec/unit/policyfile/local_lock_fetcher_spec.rb +1 -1
  83. data/spec/unit/policyfile/lock_applier_spec.rb +2 -2
  84. data/spec/unit/policyfile/reports/install_spec.rb +14 -14
  85. data/spec/unit/policyfile/reports/upload_spec.rb +3 -3
  86. data/spec/unit/policyfile/uploader_spec.rb +13 -12
  87. data/spec/unit/policyfile_demands_spec.rb +4 -4
  88. data/spec/unit/policyfile_includes_spec.rb +14 -7
  89. data/spec/unit/policyfile_install_with_includes_spec.rb +8 -7
  90. data/spec/unit/policyfile_lock_build_spec.rb +17 -18
  91. data/spec/unit/policyfile_services/clean_policy_cookbooks_spec.rb +5 -5
  92. data/spec/unit/policyfile_services/push_archive_spec.rb +6 -6
  93. data/spec/unit/policyfile_services/push_spec.rb +8 -8
  94. data/spec/unit/policyfile_services/rm_policy_group_spec.rb +5 -5
  95. data/spec/unit/policyfile_services/rm_policy_spec.rb +5 -5
  96. data/spec/unit/policyfile_services/update_attributes_spec.rb +2 -1
  97. data/spec/unit/service_exception_inspectors/http_spec.rb +7 -7
  98. metadata +2 -2
@@ -84,6 +84,7 @@ module ChefDK
84
84
 
85
85
  def run(params = [])
86
86
  return 1 unless apply_params!(params)
87
+
87
88
  export_service.run
88
89
  ui.msg("Exported policy '#{export_service.policyfile_lock.name}' to #{export_target}")
89
90
  unless archive?
@@ -111,6 +111,7 @@ module ChefDK
111
111
  # we delegate the request to the specified generator.
112
112
  def needs_help?(params)
113
113
  return false if have_generator?(params[0])
114
+
114
115
  super
115
116
  end
116
117
 
@@ -28,11 +28,9 @@ module ChefDK
28
28
  cli_name(:chefdk_doc)
29
29
 
30
30
  # Called when starting to collect gems from the cookbooks
31
- def cookbook_gem_start(gems)
32
- end
31
+ def cookbook_gem_start(gems); end
33
32
 
34
33
  # Called when cookbook loading starts.
35
- def library_load_start(file_count)
36
- end
34
+ def library_load_start(file_count); end
37
35
  end
38
36
  end
@@ -47,6 +47,7 @@ module ChefDK
47
47
 
48
48
  def run
49
49
  return 1 unless verify_params!
50
+
50
51
  FileUtils.cp_r(source, destination_dir)
51
52
  update_metadata_rb
52
53
  ui.msg("Copied built-in generator cookbook to #{created_cookbook_path}")
@@ -71,6 +71,7 @@ module ChefDK
71
71
 
72
72
  def run(params = [])
73
73
  return 1 unless apply_params!(params)
74
+
74
75
  # Force config file to be loaded. We don't use the configuration
75
76
  # directly, but the user may have SSL configuration options that they
76
77
  # need to talk to a private supermarket (e.g., trusted_certs or
@@ -72,6 +72,7 @@ module ChefDK
72
72
 
73
73
  def run(params = [])
74
74
  return 1 unless apply_params!(params)
75
+
75
76
  push.run
76
77
  0
77
78
  rescue PolicyfileServiceError => e
@@ -98,7 +98,7 @@ module ChefDK
98
98
  policy_group: policy_group,
99
99
  ui: ui,
100
100
  config: chef_config
101
- )
101
+ )
102
102
  end
103
103
 
104
104
  def archive_file
@@ -95,7 +95,7 @@ module ChefDK
95
95
  return 1
96
96
  elsif !SUPPORTED_SHELLS.include?(shell_name)
97
97
  err("Shell `#{shell_name}' is not currently supported")
98
- err("Supported shells are: #{SUPPORTED_SHELLS.join(' ')}")
98
+ err("Supported shells are: #{SUPPORTED_SHELLS.join(" ")}")
99
99
  return 1
100
100
  end
101
101
 
@@ -116,6 +116,7 @@ module ChefDK
116
116
 
117
117
  def completion_for(shell)
118
118
  return "" unless (completion_template_basename = completion_template_for(shell))
119
+
119
120
  completion_template_path = expand_completion_template_path(completion_template_basename)
120
121
  erb = ERB.new(File.read(completion_template_path), nil, "-")
121
122
  context_binding = shell_completion_template_context.get_binding
@@ -165,7 +166,7 @@ module ChefDK
165
166
  # /dev/null to avoid Fish's helpful warnings about nonexistent
166
167
  # PATH elements.
167
168
  if var == "PATH"
168
- emit_shell_cmd(%Q{set -gx #{var} "#{val.split(':').join('" "')}" 2>/dev/null;})
169
+ emit_shell_cmd(%Q{set -gx #{var} "#{val.split(":").join('" "')}" 2>/dev/null;})
169
170
  else
170
171
  emit_shell_cmd(%Q{set -gx #{var} "#{val}";})
171
172
  end
@@ -87,6 +87,7 @@ module ChefDK
87
87
 
88
88
  def run(params)
89
89
  return 1 unless apply_params!(params)
90
+
90
91
  show_policy_service.run
91
92
  0
92
93
  rescue PolicyfileServiceError => e
@@ -89,6 +89,7 @@ module ChefDK
89
89
 
90
90
  def run(params)
91
91
  return 1 unless apply_params!(params)
92
+
92
93
  if list_undo_records?
93
94
  undelete_service.list
94
95
  else
@@ -90,6 +90,7 @@ module ChefDK
90
90
 
91
91
  def run(params = [])
92
92
  return 1 unless apply_params!(params)
93
+
93
94
  attributes_updater.run
94
95
  installer.run(@cookbooks_to_update, config[:exclude_deps]) unless update_attributes_only?
95
96
  0
@@ -71,7 +71,7 @@ module ChefDK
71
71
  bundle_install_mutex = Mutex.new
72
72
 
73
73
  #
74
- # Components included in Chef Development kit:
74
+ # Components included in ChefDK:
75
75
  # :base_dir => Relative path of the component w.r.t. omnibus_apps_dir
76
76
  # :gem_base_dir => Takes a gem name instead and uses first gem found
77
77
  # :test_cmd => Test command to be launched for the component
@@ -125,7 +125,7 @@ module ChefDK
125
125
  # the return value of the test block. For tests that run a lot of commands,
126
126
  # this is inconvenient so you can use #sh! instead.
127
127
  def sh!(*args)
128
- sh(*args).tap { |result| result.error! }
128
+ sh(*args).tap(&:error!)
129
129
  end
130
130
 
131
131
  # Run a command, if the command returns zero, raise an error,
@@ -197,6 +197,7 @@ module ChefDK
197
197
 
198
198
  def gem_base_dir
199
199
  return nil if @gem_name_for_base_dir.nil?
200
+
200
201
  # There is no way to say "give me the latest prerelease OR normal version of this gem.
201
202
  # So we first ask if there is a normal version, and if there is not, we ask if there
202
203
  # is a prerelease version. ">= 0.a" is how we ask for a prerelease version, because a
@@ -49,6 +49,7 @@ module ChefDK
49
49
 
50
50
  def chef_config
51
51
  return @chef_config if @chef_config
52
+
52
53
  config_loader.load
53
54
  @chef_config = Chef::Config
54
55
  CookbookOmnifetch.integration.default_chef_server_http_client = default_chef_server_http_client
@@ -79,8 +80,8 @@ module ChefDK
79
80
  def default_chef_server_http_client
80
81
  lambda do
81
82
  ChefServerAPIMulti.new(@chef_config.chef_server_url,
82
- signing_key_filename: @chef_config.client_key,
83
- client_name: @chef_config.node_name)
83
+ signing_key_filename: @chef_config.client_key,
84
+ client_name: @chef_config.node_name)
84
85
  end
85
86
  end
86
87
 
@@ -19,8 +19,7 @@ module ChefDK
19
19
  module CookbookProfiler
20
20
  class NullSCM
21
21
 
22
- def initialize(cookbook_path)
23
- end
22
+ def initialize(cookbook_path); end
24
23
 
25
24
  def profile_data
26
25
  nil
@@ -24,7 +24,7 @@ module ChefDK
24
24
  def self.add_attr(name)
25
25
  @attributes ||= [ ]
26
26
 
27
- if !@attributes.include?(name)
27
+ unless @attributes.include?(name)
28
28
  @attributes << name
29
29
  attr_accessor(name)
30
30
  end
@@ -136,7 +136,8 @@ module ChefDK
136
136
 
137
137
  def omnibus_expand_path(*paths)
138
138
  dir = File.expand_path(File.join(paths))
139
- raise OmnibusInstallNotFound.new() unless dir && File.directory?(dir)
139
+ raise OmnibusInstallNotFound.new unless dir && File.directory?(dir)
140
+
140
141
  dir
141
142
  end
142
143
 
@@ -42,7 +42,7 @@ module ChefDK
42
42
  end
43
43
 
44
44
  def ==(other)
45
- other.kind_of?(self.class) && other.uri == uri && other.preferred_cookbooks == preferred_cookbooks
45
+ other.is_a?(self.class) && other.uri == uri && other.preferred_cookbooks == preferred_cookbooks
46
46
  end
47
47
 
48
48
  def preferred_for(*cookbook_names)
@@ -89,7 +89,7 @@ module ChefDK
89
89
  def fill!(acc, source_name, path, hash)
90
90
  hash.each do |(key, val)|
91
91
  new_path = "#{path}[#{key}]"
92
- if val.kind_of?(Hash)
92
+ if val.is_a?(Hash)
93
93
  acc[key] ||= Mash.new
94
94
  fill!(acc[key], source_name, new_path, val)
95
95
  else
@@ -54,7 +54,7 @@ module ChefDK
54
54
  end
55
55
 
56
56
  def ==(other)
57
- other.kind_of?(self.class) && other.path == path && other.preferred_cookbooks == preferred_cookbooks
57
+ other.is_a?(self.class) && other.path == path && other.preferred_cookbooks == preferred_cookbooks
58
58
  end
59
59
 
60
60
  # Calls the slurp_metadata! helper once to calculate the @universe_graph
@@ -40,7 +40,7 @@ module ChefDK
40
40
  end
41
41
 
42
42
  def ==(other)
43
- other.kind_of?(self.class) && other.uri == uri && other.preferred_cookbooks == preferred_cookbooks
43
+ other.is_a?(self.class) && other.uri == uri && other.preferred_cookbooks == preferred_cookbooks
44
44
  end
45
45
 
46
46
  def preferred_for(*cookbook_names)
@@ -84,8 +84,8 @@ module ChefDK
84
84
  def http_connection_for(base_url)
85
85
  @http_connections[base_url] ||=
86
86
  ChefServerAPIMulti.new(base_url,
87
- signing_key_filename: chef_config.client_key,
88
- client_name: chef_config.node_name)
87
+ signing_key_filename: chef_config.client_key,
88
+ client_name: chef_config.node_name)
89
89
  end
90
90
 
91
91
  def full_chef_server_graph
@@ -73,11 +73,11 @@ module ChefDK
73
73
  def errors
74
74
  error_messages = []
75
75
 
76
- [:server, :policy_name].each do |key|
76
+ %i{server policy_name}.each do |key|
77
77
  error_messages << "include_policy for #{name} is missing key #{key}" unless source_options[key]
78
78
  end
79
79
 
80
- if [:policy_revision_id, :policy_group].all? { |key| source_options[key].nil? }
80
+ if %i{policy_revision_id policy_group}.all? { |key| source_options[key].nil? }
81
81
  error_messages << "include_policy for #{name} must specify policy_revision_id or policy_group"
82
82
  end
83
83
 
@@ -101,7 +101,7 @@ module ChefDK
101
101
  acc
102
102
  end
103
103
  source_options.merge!(options)
104
- raise ChefDK::InvalidLockfile, "Invalid source_options provided from lock data: #{options_from_lock_file.inspect}" if !valid?
104
+ raise ChefDK::InvalidLockfile, "Invalid source_options provided from lock data: #{options_from_lock_file.inspect}" unless valid?
105
105
  end
106
106
 
107
107
  # @return [String] of the policyfile lock data
@@ -158,8 +158,8 @@ module ChefDK
158
158
  # @return [Hash] Returns a parsed JSON object... I think.
159
159
  def http_client
160
160
  @http_client ||= Chef::ServerAPI.new(source_options[:server],
161
- signing_key_filename: chef_config.client_key,
162
- client_name: chef_config.node_name)
161
+ signing_key_filename: chef_config.client_key,
162
+ client_name: chef_config.node_name)
163
163
  end
164
164
 
165
165
  end
@@ -48,7 +48,7 @@ module ChefDK
48
48
  end
49
49
 
50
50
  def ==(other)
51
- other.kind_of?(self.class) && other.uri == uri && other.preferred_cookbooks == preferred_cookbooks
51
+ other.is_a?(self.class) && other.uri == uri && other.preferred_cookbooks == preferred_cookbooks
52
52
  end
53
53
 
54
54
  def universe_graph
@@ -38,6 +38,7 @@ module ChefDK
38
38
  def lock
39
39
  raise LockfileNotFound, "Expected lockfile at #{policyfile_lock_relpath} does not exist" unless File.exist?(policyfile_lock_relpath)
40
40
  raise LockfileNotFound, "Expected lockfile at #{policyfile_lock_relpath} cannot be read" unless File.readable?(policyfile_lock_relpath)
41
+
41
42
  FFI_Yajl::Parser.parse(IO.read(policyfile_lock_relpath))
42
43
  rescue FFI_Yajl::ParseError => e
43
44
  raise MalformedLockfile, "Invalid JSON in lockfile at #{policyfile_lock_relpath}:\n #{e.message}"
@@ -29,7 +29,7 @@ module ChefDK
29
29
  # API contract
30
30
  include StorageConfigDelegation
31
31
 
32
- SOURCE_TYPES = [:git, :github, :path, :artifactserver, :chef_server, :chef_server_artifact, :artifactory].freeze
32
+ SOURCE_TYPES = %i{git github path artifactserver chef_server chef_server_artifact artifactory}.freeze
33
33
 
34
34
  #--
35
35
  # Required by CookbookOmnifetch API contract
@@ -54,7 +54,7 @@ module ChefDK
54
54
  end
55
55
 
56
56
  def ==(other)
57
- other.kind_of?(self.class) &&
57
+ other.is_a?(self.class) &&
58
58
  other.name == name &&
59
59
  other.version_constraint == version_constraint &&
60
60
  other.source_options == source_options
@@ -69,7 +69,7 @@ module ChefDK
69
69
  end
70
70
 
71
71
  def mirrors_canonical_upstream?
72
- [:git, :github, :artifactserver, :chef_server, :chef_server_artifact, :artifactory].include?(source_type)
72
+ %i{git github artifactserver chef_server chef_server_artifact artifactory}.include?(source_type)
73
73
  end
74
74
 
75
75
  def installed?
@@ -112,7 +112,7 @@ module ChefDK
112
112
  end
113
113
 
114
114
  def version_fixed?
115
- [:git, :github, :path, :chef_server_artifact].include?(@source_type)
115
+ %i{git github path chef_server_artifact}.include?(@source_type)
116
116
  end
117
117
 
118
118
  def version
@@ -82,6 +82,7 @@ module ChefDK
82
82
  def cookbook_location_spec
83
83
  raise InvalidCookbookLockData, "Cannot create CookbookLocationSpecification for #{name} without version" if version.nil?
84
84
  raise InvalidCookbookLockData, "Cannot create CookbookLocationSpecification for #{name} without source options" if source_options.nil?
85
+
85
86
  @location_spec ||= CookbookLocationSpecification.new(name, "= #{version}", source_options, storage_config)
86
87
  end
87
88
 
@@ -170,22 +171,22 @@ module ChefDK
170
171
  end
171
172
 
172
173
  version = lock_data["version"]
173
- unless version.kind_of?(String)
174
+ unless version.is_a?(String)
174
175
  raise InvalidLockfile, "Lockfile cookbook_lock for #{name} `version' attribute must be a string (got: #{version})"
175
176
  end
176
177
 
177
178
  identifier = lock_data["identifier"]
178
- unless identifier.kind_of?(String)
179
+ unless identifier.is_a?(String)
179
180
  raise InvalidLockfile, "Lockfile cookbook_lock for #{name} `identifier' attribute must be a string (got: #{identifier})"
180
181
  end
181
182
 
182
183
  cache_key = lock_data["cache_key"]
183
- unless cache_key.kind_of?(String) || cache_key.nil?
184
+ unless cache_key.is_a?(String) || cache_key.nil?
184
185
  raise InvalidLockfile, "Lockfile cookbook_lock for #{name} `cache_key' attribute must be a string (got: #{cache_key})"
185
186
  end
186
187
 
187
188
  source_options = lock_data["source_options"]
188
- unless source_options.kind_of?(Hash)
189
+ unless source_options.is_a?(Hash)
189
190
  raise InvalidLockfile, "Lockfile cookbook_lock for #{name} `source_options' attribute must be a Hash (JSON object) (got: #{source_options})"
190
191
  end
191
192
  end
@@ -220,6 +221,7 @@ module ChefDK
220
221
  if cache_key.nil?
221
222
  raise MissingCookbookLockData, "Cannot locate cached cookbook `#{name}' because the `cache_key' attribute is not set"
222
223
  end
224
+
223
225
  File.join(cache_path, cache_key)
224
226
  end
225
227
 
@@ -340,6 +342,7 @@ module ChefDK
340
342
  unless File.exist?(cookbook_path)
341
343
  raise LocalCookbookNotFound, "Cookbook `#{name}' not found at path source `#{source}` (full path: `#{cookbook_path}')"
342
344
  end
345
+
343
346
  unless cookbook_version.name.to_s == name
344
347
  msg = "The cookbook at path source `#{source}' is expected to be named `#{name}', but is now named `#{cookbook_version.name}' (full path: #{cookbook_path})"
345
348
  raise MalformedCookbook, msg
@@ -385,7 +388,7 @@ module ChefDK
385
388
  raise InvalidLockfile, "Lockfile cookbook_lock for #{name} is invalid. Lock data for a local cookbook must have a `source' attribute"
386
389
  end
387
390
 
388
- unless source.kind_of?(String)
391
+ unless source.is_a?(String)
389
392
  raise InvalidLockfile, "Lockfile cookbook_lock for #{name} is invalid: `source' attribute must be a String (got: #{source.inspect})"
390
393
  end
391
394
  end
@@ -60,7 +60,7 @@ module ChefDK
60
60
  end
61
61
 
62
62
  def ==(other)
63
- other.kind_of?(self.class) && other.uri == uri
63
+ other.is_a?(self.class) && other.uri == uri
64
64
  end
65
65
 
66
66
  def default_source_args
@@ -95,6 +95,7 @@ module ChefDK
95
95
 
96
96
  def report_run_list_changes
97
97
  return nil unless updated_sections.include?("run_list")
98
+
98
99
  h1("RUN LIST CHANGED")
99
100
 
100
101
  old_run_list = old_lock["run_list"]
@@ -105,6 +106,7 @@ module ChefDK
105
106
 
106
107
  def report_removed_cookbooks
107
108
  return nil if removed_cookbooks.empty?
109
+
108
110
  h1("REMOVED COOKBOOKS")
109
111
  removed_cookbooks.each do |cb_name|
110
112
  ui.print("\n")
@@ -117,6 +119,7 @@ module ChefDK
117
119
 
118
120
  def report_added_cookbooks
119
121
  return nil if added_cookbooks.empty?
122
+
120
123
  h1("ADDED COOKBOOKS")
121
124
  added_cookbooks.each do |cb_name|
122
125
  ui.print("\n")
@@ -129,6 +132,7 @@ module ChefDK
129
132
 
130
133
  def report_modified_cookbooks
131
134
  return nil if modified_cookbooks.empty?
135
+
132
136
  h1("MODIFIED COOKBOOKS")
133
137
  modified_cookbooks.each do |cb_name|
134
138
  ui.print("\n")
@@ -202,7 +206,7 @@ module ChefDK
202
206
 
203
207
  maybe_contiguous_hunks = (previous_hunk.nil? || hunk.merge(previous_hunk))
204
208
 
205
- if !maybe_contiguous_hunks
209
+ unless maybe_contiguous_hunks
206
210
  print_color_diff("#{previous_hunk.diff(FORMAT)}\n")
207
211
  end
208
212
  previous_hunk = hunk
@@ -231,7 +235,7 @@ module ChefDK
231
235
  end
232
236
 
233
237
  def pretty_json(data)
234
- FFI_Yajl::Encoder.encode(data, pretty: true).lines.map { |l| l.chomp }
238
+ FFI_Yajl::Encoder.encode(data, pretty: true).lines.map(&:chomp)
235
239
  end
236
240
 
237
241
  def detect_cookbook_changes