chef-dk 1.6.11 → 2.0.26

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +25 -38
  3. data/Gemfile.lock +199 -199
  4. data/README.md +4 -2
  5. data/Rakefile +1 -2
  6. data/acceptance/Gemfile +1 -1
  7. data/acceptance/Gemfile.lock +23 -21
  8. data/chef-dk.gemspec +4 -6
  9. data/lib/chef-dk/builtin_commands.rb +1 -1
  10. data/lib/chef-dk/chef_runner.rb +1 -1
  11. data/lib/chef-dk/cli.rb +1 -0
  12. data/lib/chef-dk/command/generate.rb +5 -2
  13. data/lib/chef-dk/command/generator_commands/helpers.rb +36 -0
  14. data/lib/chef-dk/command/generator_commands/{lwrp.rb → resource.rb} +4 -4
  15. data/lib/chef-dk/command/update.rb +11 -18
  16. data/lib/chef-dk/command/verify.rb +1 -16
  17. data/lib/chef-dk/commands_map.rb +3 -3
  18. data/lib/chef-dk/policyfile/artifactory_cookbook_source.rb +102 -0
  19. data/lib/chef-dk/policyfile/cookbook_location_specification.rb +2 -2
  20. data/lib/chef-dk/policyfile/cookbook_sources.rb +1 -0
  21. data/lib/chef-dk/policyfile/dsl.rb +10 -0
  22. data/lib/chef-dk/policyfile/solution_dependencies.rb +15 -1
  23. data/lib/chef-dk/policyfile_lock.rb +1 -1
  24. data/lib/chef-dk/policyfile_services/install.rb +30 -2
  25. data/lib/chef-dk/skeletons/code_generator/files/default/Berksfile +1 -0
  26. data/lib/chef-dk/skeletons/code_generator/files/default/build_cookbook/test-fixture-recipe.rb +1 -0
  27. data/lib/chef-dk/skeletons/code_generator/files/default/cookbook_readmes/README.md +2 -2
  28. data/lib/chef-dk/skeletons/code_generator/files/default/delivery-config.json +3 -0
  29. data/lib/chef-dk/skeletons/code_generator/files/default/delivery-project.toml +1 -1
  30. data/lib/chef-dk/skeletons/code_generator/files/default/repo/cookbooks/example/attributes/default.rb +1 -0
  31. data/lib/chef-dk/skeletons/code_generator/files/default/repo/cookbooks/example/metadata.rb +2 -1
  32. data/lib/chef-dk/skeletons/code_generator/files/default/repo/cookbooks/example/recipes/default.rb +1 -0
  33. data/lib/chef-dk/skeletons/code_generator/files/default/spec_helper.rb +1 -0
  34. data/lib/chef-dk/skeletons/code_generator/files/default/spec_helper_policyfile.rb +1 -0
  35. data/lib/chef-dk/skeletons/code_generator/metadata.rb +3 -2
  36. data/lib/chef-dk/skeletons/code_generator/recipes/app.rb +1 -1
  37. data/lib/chef-dk/skeletons/code_generator/recipes/attribute.rb +1 -0
  38. data/lib/chef-dk/skeletons/code_generator/recipes/build_cookbook.rb +7 -12
  39. data/lib/chef-dk/skeletons/code_generator/recipes/cookbook.rb +1 -0
  40. data/lib/chef-dk/skeletons/code_generator/recipes/cookbook_file.rb +1 -0
  41. data/lib/chef-dk/skeletons/code_generator/recipes/helpers.rb +21 -0
  42. data/lib/chef-dk/skeletons/code_generator/recipes/policyfile.rb +1 -0
  43. data/lib/chef-dk/skeletons/code_generator/recipes/recipe.rb +1 -0
  44. data/lib/chef-dk/skeletons/code_generator/recipes/repo.rb +1 -0
  45. data/lib/chef-dk/skeletons/code_generator/recipes/{lwrp.rb → resource.rb} +1 -11
  46. data/lib/chef-dk/skeletons/code_generator/recipes/template.rb +3 -3
  47. data/lib/chef-dk/skeletons/code_generator/templates/default/helpers.rb.erb +39 -0
  48. data/lib/chef-dk/skeletons/code_generator/templates/default/metadata.rb.erb +1 -1
  49. data/lib/chef-dk/skeletons/code_generator/templates/default/resource.rb.erb +1 -0
  50. data/lib/chef-dk/version.rb +2 -2
  51. data/omnibus_overrides.rb +14 -12
  52. data/spec/unit/command/generator_commands/cookbook_spec.rb +7 -1
  53. data/spec/unit/command/generator_commands/helpers_spec.rb +31 -0
  54. data/spec/unit/command/generator_commands/{lwrp_spec.rb → resource_spec.rb} +5 -5
  55. data/spec/unit/command/install_spec.rb +2 -2
  56. data/spec/unit/command/update_spec.rb +11 -3
  57. data/spec/unit/command/verify_spec.rb +2 -1
  58. data/spec/unit/policyfile/artifactory_cookbook_source_spec.rb +59 -0
  59. data/spec/unit/policyfile/read_cookbook_for_compat_mode_upload_spec.rb +1 -1
  60. data/spec/unit/policyfile/solution_dependencies_spec.rb +25 -0
  61. data/spec/unit/policyfile_demands_spec.rb +2 -1
  62. data/spec/unit/policyfile_lock_build_spec.rb +23 -21
  63. data/spec/unit/policyfile_lock_install_spec.rb +2 -2
  64. data/spec/unit/policyfile_lock_validation_spec.rb +3 -3
  65. data/spec/unit/policyfile_services/export_repo_spec.rb +6 -6
  66. data/spec/unit/policyfile_services/install_spec.rb +1 -1
  67. data/spec/unit/policyfile_services/update_spec.rb +143 -0
  68. data/tasks/announce.rb +3 -2
  69. data/tasks/dependencies.rb +35 -111
  70. data/tasks/github_changelog_generator.rb +0 -3
  71. data/tasks/templates/prerelease.md.erb +1 -1
  72. data/tasks/templates/release.md.erb +1 -1
  73. metadata +20 -38
  74. data/lib/chef-dk/skeletons/code_generator/templates/default/provider.rb.erb +0 -0
  75. data/spec/unit/gemfile_util_spec.rb +0 -41
  76. data/spec/unit/helpers_spec.rb +0 -120
  77. data/spec/unit/tasks/helpers_spec.rb +0 -75
  78. data/tasks/bin/bundle-platform +0 -19
  79. data/tasks/bin/create-override-gemfile +0 -110
  80. data/tasks/bundle.rb +0 -96
  81. data/tasks/bundle_util.rb +0 -110
  82. data/tasks/gemfile_util.rb +0 -435
  83. data/tasks/helpers.rb +0 -47
  84. data/version_policy.rb +0 -142
@@ -0,0 +1,102 @@
1
+ #
2
+ # Copyright:: Copyright (c) 2017 Chef Software Inc.
3
+ # License:: Apache License, Version 2.0
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+ #
17
+
18
+ require "json"
19
+ require "chef-dk/cookbook_omnifetch"
20
+ require "chef-dk/policyfile/source_uri"
21
+ require "chef-dk/exceptions"
22
+ require "chef/http/simple"
23
+
24
+ module ChefDK
25
+ module Policyfile
26
+ class ArtifactoryCookbookSource
27
+
28
+ attr_reader :uri
29
+ attr_reader :preferred_cookbooks
30
+ attr_reader :chef_config
31
+
32
+ def initialize(uri, chef_config: nil)
33
+ @uri = uri
34
+ @http_connections = {}
35
+ @chef_config = chef_config
36
+ @preferred_cookbooks = []
37
+ yield self if block_given?
38
+ end
39
+
40
+ def default_source_args
41
+ [:artifactory, uri]
42
+ end
43
+
44
+ def ==(other)
45
+ other.kind_of?(self.class) && other.uri == uri && other.preferred_cookbooks == preferred_cookbooks
46
+ end
47
+
48
+ def preferred_for(*cookbook_names)
49
+ preferred_cookbooks.concat(cookbook_names)
50
+ end
51
+
52
+ def preferred_source_for?(cookbook_name)
53
+ preferred_cookbooks.include?(cookbook_name)
54
+ end
55
+
56
+ def universe_graph
57
+ @universe_graph ||= begin
58
+ full_community_graph.inject({}) do |normalized_graph, (cookbook_name, metadata_by_version)|
59
+ normalized_graph[cookbook_name] = metadata_by_version.inject({}) do |deps_by_version, (version, metadata)|
60
+ deps_by_version[version] = metadata["dependencies"]
61
+ deps_by_version
62
+ end
63
+ normalized_graph
64
+ end
65
+ end
66
+ end
67
+
68
+ def source_options_for(cookbook_name, cookbook_version)
69
+ base_uri = full_community_graph[cookbook_name][cookbook_version]["download_url"]
70
+ {
71
+ artifactory: base_uri,
72
+ version: cookbook_version,
73
+ http_client: http_connection_for(base_uri.to_s),
74
+ }
75
+ end
76
+
77
+ def null?
78
+ false
79
+ end
80
+
81
+ def desc
82
+ "artifactory(#{uri})"
83
+ end
84
+
85
+ private
86
+
87
+ def http_connection_for(base_url)
88
+ headers = { 'X-Jfrog-Art-API' => chef_config.artifactory_api_key || ENV["ARTIFACTORY_API_KEY"] }
89
+ @http_connections[base_url] ||= Chef::HTTP::Simple.new(base_url, headers: headers)
90
+ end
91
+
92
+ def full_community_graph
93
+ @full_community_graph ||=
94
+ begin
95
+ graph_json = http_connection_for(uri).get("/universe")
96
+ JSON.parse(graph_json)
97
+ end
98
+ end
99
+
100
+ end
101
+ end
102
+ end
@@ -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]
32
+ SOURCE_TYPES = [:git, :github, :path, :artifactserver, :chef_server, :artifactory]
33
33
 
34
34
  #--
35
35
  # Required by CookbookOmnifetch API contract
@@ -69,7 +69,7 @@ module ChefDK
69
69
  end
70
70
 
71
71
  def mirrors_canonical_upstream?
72
- [:git, :github, :artifactserver, :chef_server].include?(source_type)
72
+ [:git, :github, :artifactserver, :chef_server, :artifactory].include?(source_type)
73
73
  end
74
74
 
75
75
  def installed?
@@ -20,3 +20,4 @@ require "chef-dk/policyfile/community_cookbook_source"
20
20
  require "chef-dk/policyfile/chef_server_cookbook_source"
21
21
  require "chef-dk/policyfile/chef_repo_cookbook_source"
22
22
  require "chef-dk/policyfile/delivery_supermarket_source"
23
+ require "chef-dk/policyfile/artifactory_cookbook_source"
@@ -92,6 +92,8 @@ module ChefDK
92
92
  set_default_chef_server_source(source_argument, &block)
93
93
  when :chef_repo
94
94
  set_default_chef_repo_source(source_argument, &block)
95
+ when :artifactory
96
+ set_default_artifactory_source(source_argument, &block)
95
97
  else
96
98
  @errors << "Invalid default_source type '#{source_type.inspect}'"
97
99
  end
@@ -173,6 +175,14 @@ module ChefDK
173
175
  end
174
176
  end
175
177
 
178
+ def set_default_artifactory_source(source_uri, &block)
179
+ if source_uri.nil?
180
+ @errors << "You must specify the server's URI when using a default_source :artifactory"
181
+ else
182
+ set_default_source(ArtifactoryCookbookSource.new(source_uri, chef_config: chef_config, &block))
183
+ end
184
+ end
185
+
176
186
  def set_default_chef_repo_source(path, &block)
177
187
  if path.nil?
178
188
  @errors << "You must specify the path to the chef-repo when using a default_source :chef_repo"
@@ -109,7 +109,7 @@ module ChefDK
109
109
  def policyfile_dependencies_for_lock
110
110
  policyfile_dependencies.map do |name, constraint|
111
111
  [ name, constraint.to_s ]
112
- end
112
+ end.sort
113
113
  end
114
114
 
115
115
  def cookbook_deps_for_lock
@@ -118,7 +118,21 @@ module ChefDK
118
118
  [ name, constraint.to_s ]
119
119
  end
120
120
  map
121
+ end.sort.to_h
122
+ end
123
+
124
+ def transitive_deps(names)
125
+ require 'set'
126
+ deps = Set.new
127
+ to_explore = names.dup
128
+ until to_explore.empty?
129
+ ck_name = to_explore.shift
130
+ next unless deps.add?(ck_name) # explore each ck only once
131
+ my_deps = find_cookbook_dep_by_name(ck_name)
132
+ dep_names = my_deps[1].map(&:first)
133
+ to_explore += dep_names
121
134
  end
135
+ deps.to_a.sort
122
136
  end
123
137
 
124
138
  private
@@ -193,7 +193,7 @@ module ChefDK
193
193
  location_spec.gather_profile_data
194
194
  locks_map[name] = location_spec.to_lock
195
195
  locks_map
196
- end
196
+ end.sort.to_h
197
197
  end
198
198
 
199
199
  def validate_cookbooks!
@@ -49,7 +49,7 @@ module ChefDK
49
49
  @policyfile_compiler = nil
50
50
  end
51
51
 
52
- def run
52
+ def run(cookbooks_to_update = [])
53
53
  unless File.exist?(policyfile_expanded_path)
54
54
  # TODO: suggest next step. Add a generator/init command? Specify path to Policyfile.rb?
55
55
  # See card CC-232
@@ -58,8 +58,10 @@ module ChefDK
58
58
 
59
59
  if installing_from_lock?
60
60
  install_from_lock
61
- else
61
+ elsif cookbooks_to_update.empty? # means update everything
62
62
  generate_lock_and_install
63
+ else
64
+ update_lock_and_install(cookbooks_to_update)
63
65
  end
64
66
  end
65
67
 
@@ -111,6 +113,32 @@ module ChefDK
111
113
  raise PolicyfileInstallError.new("Failed to generate Policyfile.lock", error)
112
114
  end
113
115
 
116
+ def update_lock_and_install(cookbooks_to_update)
117
+ ui.msg "Updating #{cookbooks_to_update.join(',')} cookbooks"
118
+
119
+ to_update = policyfile_lock.solution_dependencies.transitive_deps(cookbooks_to_update)
120
+ prepare_constraints_for_update(to_update)
121
+ generate_lock_and_install
122
+ end
123
+
124
+ def prepare_constraints_for_update(to_update)
125
+ ui.msg "Will relax constraints on:"
126
+ to_update.each do |ck|
127
+ ui.msg " - #{ck}"
128
+ end
129
+
130
+ policyfile_lock.cookbook_locks.each do |ck_name, location_spec|
131
+ next if to_update.include?(ck_name)
132
+ # we need to feed policyfile_compiler.cookbook_location_spec_for with a CookbookLocationSpecification
133
+ policyfile_compiler.dsl.cookbook_location_specs[ck_name] = Policyfile::CookbookLocationSpecification.new(
134
+ ck_name,
135
+ Semverse::Constraint.new("=#{location_spec.version}"),
136
+ location_spec.source_options,
137
+ location_spec.storage_config
138
+ )
139
+ end
140
+ end
141
+
114
142
  def install_from_lock
115
143
  ui.msg "Installing cookbooks from lock"
116
144
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  source 'https://supermarket.chef.io'
2
3
 
3
4
  metadata
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  %w(unit lint syntax).each do |phase|
2
3
  # TODO: This works on Linux/Unix. Not Windows.
3
4
  execute "HOME=/home/vagrant delivery job verify #{phase} --server localhost --ent test --org kitchen" do
@@ -19,9 +19,9 @@ Configure knife to use your preferred copyright holder, email contact and licens
19
19
 
20
20
  Supported values for `cookbook_license` are "apachev2", "mit","gplv2","gplv3", or "none". These settings are used to prefill comments in the default recipe, and the corresponding values in the metadata.rb. You are free to change the the comments in those files.
21
21
 
22
- Create new cookbooks in this directory with Knife.
22
+ Create new cookbooks in this directory with Chef.
23
23
 
24
- knife cookbook create COOKBOOK
24
+ chef generate cookbook COOKBOOK
25
25
 
26
26
  This will create all the cookbook directory components. You don't need to use them all, and can delete the ones you don't need. It also creates a README file, metadata.rb and default recipe.
27
27
 
@@ -4,6 +4,9 @@
4
4
  "name": "build_cookbook",
5
5
  "path": ".delivery/build_cookbook"
6
6
  },
7
+ "delivery-truck": {
8
+ "enable_cookstyle": true
9
+ },
7
10
  "skip_phases": [],
8
11
  "job_dispatch": {
9
12
  "version": "v2"
@@ -18,7 +18,7 @@ lint = "chef exec cookstyle"
18
18
  # uploaded to Supermarket. We turn off any rules tagged "supermarket"
19
19
  # by default. If you plan to share this cookbook you should remove
20
20
  # '-t ~supermarket' below to enable supermarket rules.
21
- syntax = "chef exec foodcritic . --exclude spec -f any -t ~supermarket"
21
+ syntax = "chef exec foodcritic . -t ~supermarket"
22
22
  provision = "chef exec kitchen create"
23
23
  deploy = "chef exec kitchen converge"
24
24
  smoke = "chef exec kitchen verify"
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # This is a Chef attributes file. It can be used to specify default and override
2
3
  # attributes to be applied to nodes that run this cookbook.
3
4
 
@@ -1,6 +1,7 @@
1
+ # frozen_string_literal: true
1
2
  name 'example'
2
3
  description 'An example cookbook'
3
4
  maintainer 'Example maintainer'
4
5
  maintainer_email 'maintainer@example.com'
5
- license 'Apache v2'
6
+ license 'Apache-2.0'
6
7
  version '1.0.0'
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # This is a Chef recipe file. It can be used to specify resources which will
2
3
  # apply configuration to a server.
3
4
 
@@ -1,2 +1,3 @@
1
+ # frozen_string_literal: true
1
2
  require 'chefspec'
2
3
  require 'chefspec/berkshelf'
@@ -1,2 +1,3 @@
1
+ # frozen_string_literal: true
1
2
  require 'chefspec'
2
3
  require 'chefspec/policyfile'
@@ -1,7 +1,8 @@
1
+ # frozen_string_literal: true
1
2
  name 'code_generator'
2
3
  maintainer 'Chef Software, Inc.'
3
4
  maintainer_email 'dev@chef.io'
4
- license 'Apache 2 License'
5
+ license 'Apache-2.0'
5
6
  description 'Generates Chef code for Chef DK'
6
- long_description 'Generates Chef code for Chef DK'
7
7
  version '0.1.0'
8
+ chef_version '>= 12.0'
@@ -1,4 +1,4 @@
1
-
1
+ # frozen_string_literal: true
2
2
 
3
3
  context = ChefDK::Generator.context
4
4
  app_dir = File.join(context.app_root, context.app_name)
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
 
2
3
  context = ChefDK::Generator.context
3
4
  cookbook_dir = File.join(context.cookbook_root, context.cookbook_name)
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
 
2
3
  context = ChefDK::Generator.context
3
4
  delivery_project_dir = context.delivery_project_dir
@@ -120,15 +121,13 @@ if context.have_git && context.delivery_project_git_initialized && !context.skip
120
121
  execute('git-create-feature-branch') do
121
122
  command('git checkout -t -b add-delivery-configuration')
122
123
  cwd delivery_project_dir
123
-
124
- not_if 'git branch |grep "add-delivery-configuration"'
124
+ not_if { shell_out('git branch', cwd: delivery_project_dir).stdout.match(/add-delivery-configuration/) }
125
125
  end
126
126
 
127
127
  execute('git-add-delivery-config-json') do
128
128
  command('git add .delivery/config.json')
129
129
  cwd delivery_project_dir
130
-
131
- only_if 'git status -u --porcelain |grep ".delivery/config.json"'
130
+ only_if { shell_out('git status -u --porcelain', cwd: delivery_project_dir).stdout.match(%r{.delivery/config.json}) }
132
131
  end
133
132
 
134
133
  # Adding the new prototype file to the feature branch
@@ -136,15 +135,13 @@ if context.have_git && context.delivery_project_git_initialized && !context.skip
136
135
  execute('git-add-delivery-project-toml') do
137
136
  command('git add .delivery/project.toml')
138
137
  cwd delivery_project_dir
139
-
140
- only_if 'git status -u --porcelain |grep ".delivery/project.toml"'
138
+ only_if { shell_out('git status -u --porcelain', cwd: delivery_project_dir).stdout.match(%r{.delivery/project.toml}) }
141
139
  end
142
140
 
143
141
  execute('git-commit-delivery-config') do
144
142
  command('git commit -m "Add generated delivery configuration"')
145
143
  cwd delivery_project_dir
146
-
147
- only_if 'git status -u --porcelain | egrep "config.json|project.toml"'
144
+ only_if { shell_out('git status -u --porcelain', cwd: delivery_project_dir).stdout.match(/config\.json|project\.toml/) }
148
145
  end
149
146
 
150
147
  generator_desc('Adding build cookbook to feature branch')
@@ -152,15 +149,13 @@ if context.have_git && context.delivery_project_git_initialized && !context.skip
152
149
  execute('git-add-delivery-build-cookbook-files') do
153
150
  command('git add .delivery')
154
151
  cwd delivery_project_dir
155
-
156
- only_if 'git status -u --porcelain |grep ".delivery"'
152
+ only_if { shell_out('git status -u --porcelain', cwd: delivery_project_dir).stdout.match(/\.delivery/) }
157
153
  end
158
154
 
159
155
  execute('git-commit-delivery-build-cookbook') do
160
156
  command('git commit -m "Add generated delivery build cookbook"')
161
157
  cwd delivery_project_dir
162
-
163
- only_if 'git status -u --porcelain |grep ".delivery"'
158
+ only_if { shell_out('git status -u --porcelain', cwd: delivery_project_dir).stdout.match(/\.delivery/) }
164
159
  end
165
160
 
166
161
  execute("git-return-to-#{pipeline}-branch") do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
 
2
3
  context = ChefDK::Generator.context
3
4
  cookbook_dir = File.join(context.cookbook_root, context.cookbook_name)
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
 
2
3
  context = ChefDK::Generator.context
3
4
  cookbook_dir = File.join(context.cookbook_root, context.cookbook_name)
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ context = ChefDK::Generator.context
4
+ cookbook_dir = File.join(context.cookbook_root, context.cookbook_name)
5
+ libraries_dir = File.join(cookbook_dir, 'libraries')
6
+ helpers_path = File.join(cookbook_dir, 'libraries', "#{context.new_file_basename}.rb")
7
+
8
+ directory libraries_dir
9
+
10
+ def camelize(name)
11
+ name.to_s.split(/[^a-zA-Z]/).map(&:capitalize).join
12
+ end
13
+
14
+ cookbook_class_name = camelize(context.cookbook_name)
15
+ helper_class_name = "#{camelize(context.new_file_basename)}Helpers"
16
+
17
+ template helpers_path do
18
+ source 'helpers.rb.erb'
19
+ helpers(ChefDK::Generator::TemplateHelper)
20
+ variables(cookbook_class_name: cookbook_class_name, helper_class_name: helper_class_name)
21
+ end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
 
2
3
  context = ChefDK::Generator.context
3
4
  policyfile_path = File.join(context.policyfile_dir, "#{context.new_file_basename}.rb")
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
 
2
3
  context = ChefDK::Generator.context
3
4
  cookbook_dir = File.join(context.cookbook_root, context.cookbook_name)