cookbook_creator 0.0.3 → 0.0.4

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/cookbook_creator.gemspec +2 -2
  3. data/lib/cookbook_creator/skeletons/code_generator/files/default/gitignore +2 -0
  4. data/lib/cookbook_creator/skeletons/code_generator/metadata.rb +4 -4
  5. data/lib/cookbook_creator/skeletons/code_generator/recipes/cookbook.rb +12 -3
  6. data/lib/cookbook_creator/skeletons/code_generator/templates/default/Berksfile.erb +3 -0
  7. metadata +2 -79
  8. data/lib/cookbook_creator/.config_loader.rb.swp +0 -0
  9. data/lib/cookbook_creator/skeletons/code_generator/files/default/Berksfile +0 -3
  10. data/lib/cookbook_creator/skeletons/code_generator/files/default/cookbook_readmes/README-policy.md +0 -9
  11. data/lib/cookbook_creator/skeletons/code_generator/files/default/repo/README.md +0 -28
  12. data/lib/cookbook_creator/skeletons/code_generator/files/default/repo/cookbooks/example/README.md +0 -27
  13. data/lib/cookbook_creator/skeletons/code_generator/files/default/repo/cookbooks/example/attributes/default.rb +0 -7
  14. data/lib/cookbook_creator/skeletons/code_generator/files/default/repo/cookbooks/example/metadata.rb +0 -3
  15. data/lib/cookbook_creator/skeletons/code_generator/files/default/repo/cookbooks/example/recipes/default.rb +0 -8
  16. data/lib/cookbook_creator/skeletons/code_generator/files/default/repo/data_bags/README.md +0 -58
  17. data/lib/cookbook_creator/skeletons/code_generator/files/default/repo/data_bags/example/example_item.json +0 -4
  18. data/lib/cookbook_creator/skeletons/code_generator/files/default/repo/dot-chef-repo.txt +0 -6
  19. data/lib/cookbook_creator/skeletons/code_generator/files/default/repo/environments/README.md +0 -9
  20. data/lib/cookbook_creator/skeletons/code_generator/files/default/repo/environments/example.json +0 -13
  21. data/lib/cookbook_creator/skeletons/code_generator/files/default/repo/policies/README.md +0 -24
  22. data/lib/cookbook_creator/skeletons/code_generator/files/default/repo/roles/README.md +0 -9
  23. data/lib/cookbook_creator/skeletons/code_generator/files/default/repo/roles/example.json +0 -13
  24. data/lib/cookbook_creator/skeletons/code_generator/files/default/spec_helper_policyfile.rb +0 -2
  25. data/lib/cookbook_creator/skeletons/code_generator/recipes/app.rb +0 -97
  26. data/lib/cookbook_creator/skeletons/code_generator/recipes/attribute.rb +0 -12
  27. data/lib/cookbook_creator/skeletons/code_generator/recipes/cookbook_file.rb +0 -24
  28. data/lib/cookbook_creator/skeletons/code_generator/recipes/lwrp.rb +0 -23
  29. data/lib/cookbook_creator/skeletons/code_generator/recipes/policyfile.rb +0 -8
  30. data/lib/cookbook_creator/skeletons/code_generator/recipes/recipe.rb +0 -27
  31. data/lib/cookbook_creator/skeletons/code_generator/recipes/repo.rb +0 -67
  32. data/lib/cookbook_creator/skeletons/code_generator/recipes/template.rb +0 -32
  33. data/lib/cookbook_creator/skeletons/code_generator/templates/default/cookbook_file.erb +0 -1
  34. data/lib/cookbook_creator/skeletons/code_generator/templates/default/repo/gitignore.erb +0 -11
  35. data/lib/skeletons/code_generator/files/default/Berksfile +0 -3
  36. data/lib/skeletons/code_generator/files/default/chefignore +0 -100
  37. data/lib/skeletons/code_generator/files/default/cookbook_readmes/README-policy.md +0 -9
  38. data/lib/skeletons/code_generator/files/default/cookbook_readmes/README.md +0 -54
  39. data/lib/skeletons/code_generator/files/default/gitignore +0 -16
  40. data/lib/skeletons/code_generator/files/default/repo/README.md +0 -28
  41. data/lib/skeletons/code_generator/files/default/repo/cookbooks/example/README.md +0 -27
  42. data/lib/skeletons/code_generator/files/default/repo/cookbooks/example/attributes/default.rb +0 -7
  43. data/lib/skeletons/code_generator/files/default/repo/cookbooks/example/metadata.rb +0 -3
  44. data/lib/skeletons/code_generator/files/default/repo/cookbooks/example/recipes/default.rb +0 -8
  45. data/lib/skeletons/code_generator/files/default/repo/data_bags/README.md +0 -58
  46. data/lib/skeletons/code_generator/files/default/repo/data_bags/example/example_item.json +0 -4
  47. data/lib/skeletons/code_generator/files/default/repo/dot-chef-repo.txt +0 -6
  48. data/lib/skeletons/code_generator/files/default/repo/environments/README.md +0 -9
  49. data/lib/skeletons/code_generator/files/default/repo/environments/example.json +0 -13
  50. data/lib/skeletons/code_generator/files/default/repo/policies/README.md +0 -24
  51. data/lib/skeletons/code_generator/files/default/repo/roles/README.md +0 -9
  52. data/lib/skeletons/code_generator/files/default/repo/roles/example.json +0 -13
  53. data/lib/skeletons/code_generator/files/default/serverspec_spec_helper.rb +0 -8
  54. data/lib/skeletons/code_generator/files/default/spec_helper.rb +0 -2
  55. data/lib/skeletons/code_generator/files/default/spec_helper_policyfile.rb +0 -2
  56. data/lib/skeletons/code_generator/metadata.rb +0 -8
  57. data/lib/skeletons/code_generator/recipes/app.rb +0 -97
  58. data/lib/skeletons/code_generator/recipes/attribute.rb +0 -12
  59. data/lib/skeletons/code_generator/recipes/cookbook.rb +0 -94
  60. data/lib/skeletons/code_generator/recipes/cookbook_file.rb +0 -24
  61. data/lib/skeletons/code_generator/recipes/lwrp.rb +0 -23
  62. data/lib/skeletons/code_generator/recipes/policyfile.rb +0 -8
  63. data/lib/skeletons/code_generator/recipes/recipe.rb +0 -27
  64. data/lib/skeletons/code_generator/recipes/repo.rb +0 -67
  65. data/lib/skeletons/code_generator/recipes/template.rb +0 -32
  66. data/lib/skeletons/code_generator/templates/default/LICENSE.all_rights.erb +0 -3
  67. data/lib/skeletons/code_generator/templates/default/LICENSE.apache2.erb +0 -201
  68. data/lib/skeletons/code_generator/templates/default/LICENSE.gplv2.erb +0 -339
  69. data/lib/skeletons/code_generator/templates/default/LICENSE.gplv3.erb +0 -674
  70. data/lib/skeletons/code_generator/templates/default/LICENSE.mit.erb +0 -21
  71. data/lib/skeletons/code_generator/templates/default/Policyfile.rb.erb +0 -25
  72. data/lib/skeletons/code_generator/templates/default/README.md.erb +0 -4
  73. data/lib/skeletons/code_generator/templates/default/attribute.rb.erb +0 -0
  74. data/lib/skeletons/code_generator/templates/default/cookbook_file.erb +0 -0
  75. data/lib/skeletons/code_generator/templates/default/kitchen.yml.erb +0 -21
  76. data/lib/skeletons/code_generator/templates/default/kitchen_policyfile.yml.erb +0 -32
  77. data/lib/skeletons/code_generator/templates/default/metadata.rb.erb +0 -7
  78. data/lib/skeletons/code_generator/templates/default/provider.rb.erb +0 -0
  79. data/lib/skeletons/code_generator/templates/default/recipe.rb.erb +0 -5
  80. data/lib/skeletons/code_generator/templates/default/recipe_spec.rb.erb +0 -20
  81. data/lib/skeletons/code_generator/templates/default/repo/gitignore.erb +0 -11
  82. data/lib/skeletons/code_generator/templates/default/resource.rb.erb +0 -0
  83. data/lib/skeletons/code_generator/templates/default/serverspec_default_spec.rb.erb +0 -9
  84. data/lib/skeletons/code_generator/templates/default/template.erb +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 66e5138d92d0ac03392039c671d1da32d1c24bcb
4
- data.tar.gz: 09708e4e04721354600873cd900c397d418940bd
3
+ metadata.gz: 02d1b44357cede5a6082d6255ead6b6838c25dbb
4
+ data.tar.gz: 1f98078b101ff6c1c3fce8ce946e4e1961c127c7
5
5
  SHA512:
6
- metadata.gz: a3f8a0e55be8be87b6b497d5d635c9fd182cb2e834a6a27dbb183b7232a06d7cbc91530fdd76c087f4768273b3dfc9c32ea4aaa1568631d7d5a5d25e0c7b3ed9
7
- data.tar.gz: a392f6165c2af8ad965e6084200284b9d91d184119f7cc511609a70bdb6072055839e7c396d7a1c27a691964f63b504d44ef9671928d4c68f6c680ef9221f654
6
+ metadata.gz: 89a35b03372770744f2806ecb2bab0edc6092eaaf145da87b068fa407b9ef561afd127a9d61dcb709f880d8732f4b483ae2c285369de33ebbf78cab935a8a911
7
+ data.tar.gz: 23a771531b7662abd2374147c07fec258ef3d7c87811edc6c72c0cd05e272a58542377297da4b833f3bc950d949e72169ba9c6bf25fb99376849698a66dde3f8
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'cookbook_creator'
3
- s.version = '0.0.3'
4
- s.date = '2016-01-11'
3
+ s.version = '0.0.4'
4
+ s.date = '2016-01-25'
5
5
  s.summary = "Everything required for cookbook generation"
6
6
  s.description = "This gem is used to generate cookbook skeleton"
7
7
  s.authors = ['Serghei Anicheev']
@@ -14,3 +14,5 @@ bin/*
14
14
 
15
15
  .kitchen/
16
16
  .kitchen.local.yml
17
+
18
+ .chef/
@@ -1,8 +1,8 @@
1
1
  name 'code_generator'
2
- maintainer 'Chef Software, Inc.'
3
- maintainer_email 'dev@chef.io'
2
+ maintainer 'Tacit Knowledge'
3
+ maintainer_email 'operator@tacitknowledge.com'
4
4
  license 'Apache 2 License'
5
- description 'Generates Chef code for Chef DK'
6
- long_description 'Generates Chef code for Chef DK'
5
+ description 'Generates Chef code for new project'
6
+ long_description 'Generates Chef code for new project'
7
7
  version '0.1.0'
8
8
 
@@ -106,7 +106,16 @@ if context.lwrp
106
106
  end
107
107
  end
108
108
 
109
- # git
110
- cookbook_file "#{cookbook_dir}/.gitignore" do
111
- source "gitignore"
109
+ # Attributes
110
+ directory "#{cookbook_dir}/attributes"
111
+
112
+ template "#{cookbook_dir}/attributes/default.rb" do
113
+ source "attribute.rb.erb"
114
+ helpers(CookbookCreator::Generator::TemplateHelper)
115
+ action :create_if_missing
116
+ end
117
+
118
+ # Cookbook Files
119
+ directory "#{cookbook_dir}/files/default" do
120
+ recursive true
112
121
  end
@@ -1,3 +1,6 @@
1
+ source 'https://supermarket.chef.io'
2
+ <% unless supermarket_url.eql?('https://supermarket.chef.io') %>
1
3
  source '<%= supermarket_url %>'
4
+ <% end %>
2
5
 
3
6
  metadata
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cookbook_creator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Serghei Anicheev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-11 00:00:00.000000000 Z
11
+ date: 2016-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chef
@@ -216,7 +216,6 @@ files:
216
216
  - README.md
217
217
  - bin/cookbook_create
218
218
  - cookbook_creator.gemspec
219
- - lib/cookbook_creator/.config_loader.rb.swp
220
219
  - lib/cookbook_creator/cli.rb
221
220
  - lib/cookbook_creator/config.rb
222
221
  - lib/cookbook_creator/config_loader.rb
@@ -226,37 +225,13 @@ files:
226
225
  - lib/cookbook_creator/null_logger.rb
227
226
  - lib/cookbook_creator/pathhelper.rb
228
227
  - lib/cookbook_creator/runner.rb
229
- - lib/cookbook_creator/skeletons/code_generator/files/default/Berksfile
230
228
  - lib/cookbook_creator/skeletons/code_generator/files/default/chefignore
231
- - lib/cookbook_creator/skeletons/code_generator/files/default/cookbook_readmes/README-policy.md
232
229
  - lib/cookbook_creator/skeletons/code_generator/files/default/cookbook_readmes/README.md
233
230
  - lib/cookbook_creator/skeletons/code_generator/files/default/gitignore
234
- - lib/cookbook_creator/skeletons/code_generator/files/default/repo/README.md
235
- - lib/cookbook_creator/skeletons/code_generator/files/default/repo/cookbooks/example/README.md
236
- - lib/cookbook_creator/skeletons/code_generator/files/default/repo/cookbooks/example/attributes/default.rb
237
- - lib/cookbook_creator/skeletons/code_generator/files/default/repo/cookbooks/example/metadata.rb
238
- - lib/cookbook_creator/skeletons/code_generator/files/default/repo/cookbooks/example/recipes/default.rb
239
- - lib/cookbook_creator/skeletons/code_generator/files/default/repo/data_bags/README.md
240
- - lib/cookbook_creator/skeletons/code_generator/files/default/repo/data_bags/example/example_item.json
241
- - lib/cookbook_creator/skeletons/code_generator/files/default/repo/dot-chef-repo.txt
242
- - lib/cookbook_creator/skeletons/code_generator/files/default/repo/environments/README.md
243
- - lib/cookbook_creator/skeletons/code_generator/files/default/repo/environments/example.json
244
- - lib/cookbook_creator/skeletons/code_generator/files/default/repo/policies/README.md
245
- - lib/cookbook_creator/skeletons/code_generator/files/default/repo/roles/README.md
246
- - lib/cookbook_creator/skeletons/code_generator/files/default/repo/roles/example.json
247
231
  - lib/cookbook_creator/skeletons/code_generator/files/default/serverspec_spec_helper.rb
248
232
  - lib/cookbook_creator/skeletons/code_generator/files/default/spec_helper.rb
249
- - lib/cookbook_creator/skeletons/code_generator/files/default/spec_helper_policyfile.rb
250
233
  - lib/cookbook_creator/skeletons/code_generator/metadata.rb
251
- - lib/cookbook_creator/skeletons/code_generator/recipes/app.rb
252
- - lib/cookbook_creator/skeletons/code_generator/recipes/attribute.rb
253
234
  - lib/cookbook_creator/skeletons/code_generator/recipes/cookbook.rb
254
- - lib/cookbook_creator/skeletons/code_generator/recipes/cookbook_file.rb
255
- - lib/cookbook_creator/skeletons/code_generator/recipes/lwrp.rb
256
- - lib/cookbook_creator/skeletons/code_generator/recipes/policyfile.rb
257
- - lib/cookbook_creator/skeletons/code_generator/recipes/recipe.rb
258
- - lib/cookbook_creator/skeletons/code_generator/recipes/repo.rb
259
- - lib/cookbook_creator/skeletons/code_generator/recipes/template.rb
260
235
  - lib/cookbook_creator/skeletons/code_generator/templates/default/Berksfile.erb
261
236
  - lib/cookbook_creator/skeletons/code_generator/templates/default/LICENSE.all_rights.erb
262
237
  - lib/cookbook_creator/skeletons/code_generator/templates/default/LICENSE.apache2.erb
@@ -265,67 +240,15 @@ files:
265
240
  - lib/cookbook_creator/skeletons/code_generator/templates/default/LICENSE.mit.erb
266
241
  - lib/cookbook_creator/skeletons/code_generator/templates/default/README.md.erb
267
242
  - lib/cookbook_creator/skeletons/code_generator/templates/default/attribute.rb.erb
268
- - lib/cookbook_creator/skeletons/code_generator/templates/default/cookbook_file.erb
269
243
  - lib/cookbook_creator/skeletons/code_generator/templates/default/kitchen.yml.erb
270
244
  - lib/cookbook_creator/skeletons/code_generator/templates/default/library.rb.erb
271
245
  - lib/cookbook_creator/skeletons/code_generator/templates/default/metadata.rb.erb
272
246
  - lib/cookbook_creator/skeletons/code_generator/templates/default/provider.rb.erb
273
247
  - lib/cookbook_creator/skeletons/code_generator/templates/default/recipe.rb.erb
274
248
  - lib/cookbook_creator/skeletons/code_generator/templates/default/recipe_spec.rb.erb
275
- - lib/cookbook_creator/skeletons/code_generator/templates/default/repo/gitignore.erb
276
249
  - lib/cookbook_creator/skeletons/code_generator/templates/default/resource.rb.erb
277
250
  - lib/cookbook_creator/skeletons/code_generator/templates/default/serverspec_default_spec.rb.erb
278
251
  - lib/cookbook_creator/skeletons/code_generator/templates/default/template.erb
279
- - lib/skeletons/code_generator/files/default/Berksfile
280
- - lib/skeletons/code_generator/files/default/chefignore
281
- - lib/skeletons/code_generator/files/default/cookbook_readmes/README-policy.md
282
- - lib/skeletons/code_generator/files/default/cookbook_readmes/README.md
283
- - lib/skeletons/code_generator/files/default/gitignore
284
- - lib/skeletons/code_generator/files/default/repo/README.md
285
- - lib/skeletons/code_generator/files/default/repo/cookbooks/example/README.md
286
- - lib/skeletons/code_generator/files/default/repo/cookbooks/example/attributes/default.rb
287
- - lib/skeletons/code_generator/files/default/repo/cookbooks/example/metadata.rb
288
- - lib/skeletons/code_generator/files/default/repo/cookbooks/example/recipes/default.rb
289
- - lib/skeletons/code_generator/files/default/repo/data_bags/README.md
290
- - lib/skeletons/code_generator/files/default/repo/data_bags/example/example_item.json
291
- - lib/skeletons/code_generator/files/default/repo/dot-chef-repo.txt
292
- - lib/skeletons/code_generator/files/default/repo/environments/README.md
293
- - lib/skeletons/code_generator/files/default/repo/environments/example.json
294
- - lib/skeletons/code_generator/files/default/repo/policies/README.md
295
- - lib/skeletons/code_generator/files/default/repo/roles/README.md
296
- - lib/skeletons/code_generator/files/default/repo/roles/example.json
297
- - lib/skeletons/code_generator/files/default/serverspec_spec_helper.rb
298
- - lib/skeletons/code_generator/files/default/spec_helper.rb
299
- - lib/skeletons/code_generator/files/default/spec_helper_policyfile.rb
300
- - lib/skeletons/code_generator/metadata.rb
301
- - lib/skeletons/code_generator/recipes/app.rb
302
- - lib/skeletons/code_generator/recipes/attribute.rb
303
- - lib/skeletons/code_generator/recipes/cookbook.rb
304
- - lib/skeletons/code_generator/recipes/cookbook_file.rb
305
- - lib/skeletons/code_generator/recipes/lwrp.rb
306
- - lib/skeletons/code_generator/recipes/policyfile.rb
307
- - lib/skeletons/code_generator/recipes/recipe.rb
308
- - lib/skeletons/code_generator/recipes/repo.rb
309
- - lib/skeletons/code_generator/recipes/template.rb
310
- - lib/skeletons/code_generator/templates/default/LICENSE.all_rights.erb
311
- - lib/skeletons/code_generator/templates/default/LICENSE.apache2.erb
312
- - lib/skeletons/code_generator/templates/default/LICENSE.gplv2.erb
313
- - lib/skeletons/code_generator/templates/default/LICENSE.gplv3.erb
314
- - lib/skeletons/code_generator/templates/default/LICENSE.mit.erb
315
- - lib/skeletons/code_generator/templates/default/Policyfile.rb.erb
316
- - lib/skeletons/code_generator/templates/default/README.md.erb
317
- - lib/skeletons/code_generator/templates/default/attribute.rb.erb
318
- - lib/skeletons/code_generator/templates/default/cookbook_file.erb
319
- - lib/skeletons/code_generator/templates/default/kitchen.yml.erb
320
- - lib/skeletons/code_generator/templates/default/kitchen_policyfile.yml.erb
321
- - lib/skeletons/code_generator/templates/default/metadata.rb.erb
322
- - lib/skeletons/code_generator/templates/default/provider.rb.erb
323
- - lib/skeletons/code_generator/templates/default/recipe.rb.erb
324
- - lib/skeletons/code_generator/templates/default/recipe_spec.rb.erb
325
- - lib/skeletons/code_generator/templates/default/repo/gitignore.erb
326
- - lib/skeletons/code_generator/templates/default/resource.rb.erb
327
- - lib/skeletons/code_generator/templates/default/serverspec_default_spec.rb.erb
328
- - lib/skeletons/code_generator/templates/default/template.erb
329
252
  homepage: http://rubygems.org/gems/cookbook_creator
330
253
  licenses:
331
254
  - Free License
@@ -1,3 +0,0 @@
1
- source 'https://supermarket.chef.io'
2
-
3
- metadata
@@ -1,9 +0,0 @@
1
- This directory typically contains Chef cookbooks. This repository was
2
- generated with the '--policy-only' option, which means you have chosen
3
- to use a workflow where each cookbook is treated as an independent
4
- software project. As a result, any cookbooks present in this directory
5
- are independent git projects, and the contents of this directory have
6
- been added to .gitignore.
7
-
8
- Love,
9
- Chef
@@ -1,28 +0,0 @@
1
- Overview
2
- ========
3
-
4
- Every Chef installation needs a Chef Repository. This is the place where cookbooks, roles, config files and other artifacts for managing systems with Chef will live. We strongly recommend storing this repository in a version control system such as Git and treat it like source code.
5
-
6
- While we prefer Git, and make this repository available via GitHub, you are welcome to download a tar or zip archive and use your favorite version control system to manage the code.
7
-
8
- Repository Directories
9
- ======================
10
-
11
- This repository contains several directories, and each directory contains a README file that describes what it is for in greater detail, and how to use it for managing your systems with Chef.
12
-
13
- * `cookbooks/` - Cookbooks you download or create.
14
- * `data_bags/` - Store data bags and items in .json in the repository.
15
- * `roles/` - Store roles in .rb or .json in the repository.
16
- * `environments/` - Store environments in .rb or .json in the repository.
17
-
18
- Configuration
19
- =============
20
-
21
- The config file, `.chef/knife.rb` is a repository specific configuration file for knife. If you're using the Chef Platform, you can download one for your organization from the management console. If you're using the Open Source Chef Server, you can generate a new one with `knife configure`. For more information about configuring Knife, see the Knife documentation.
22
-
23
- https://docs.chef.io/knife.html
24
-
25
- Next Steps
26
- ==========
27
-
28
- Read the README file in each of the subdirectories for more information about what goes in those directories.
@@ -1,27 +0,0 @@
1
- # Example
2
-
3
- An example cookbook
4
-
5
- ## Requirements
6
-
7
- ### Platform:
8
-
9
- *No platforms defined*
10
-
11
- ### Cookbooks:
12
-
13
- *No dependencies defined*
14
-
15
- ## Attributes
16
-
17
- * `node['example']['name']` - Defaults to `Sam Doe`.
18
-
19
- ## Recipes
20
-
21
- * example::default
22
-
23
- ## License and Maintainer
24
-
25
- Maintainer:: (<>)
26
-
27
- License:: All rights reserved
@@ -1,7 +0,0 @@
1
- # This is a Chef attributes file. It can be used to specify default and override
2
- # attributes to be applied to nodes that run this cookbook.
3
-
4
- # Set a default name
5
- default["example"]["name"] = "Sam Doe"
6
-
7
- # For further information, see the Chef documentation (https://docs.chef.io/essentials_cookbook_attribute_files.html).
@@ -1,3 +0,0 @@
1
- name 'example'
2
- description 'An example cookbook'
3
- version '1.0.0'
@@ -1,8 +0,0 @@
1
- # This is a Chef recipe file. It can be used to specify resources which will
2
- # apply configuration to a server.
3
-
4
- log "Welcome to Chef, #{node["example"]["name"]}!" do
5
- level :info
6
- end
7
-
8
- # For more information, see the documentation: https://docs.chef.io/essentials_cookbook_recipes.html
@@ -1,58 +0,0 @@
1
- Data Bags
2
- ---------
3
-
4
- This directory contains directories of the various data bags you create for your infrastructure. Each subdirectory corresponds to a data bag on the Chef Server, and contains JSON files of the items that go in the bag.
5
-
6
- For example, in this directory you'll find an example data bag directory called `example`, which contains an item definition called `example_item.json`
7
-
8
- Before uploading this item to the server, we must first create the data bag on the Chef Server.
9
-
10
- knife data bag create example
11
-
12
- Then we can upload the items in the data bag's directory to the Chef Server.
13
-
14
- knife data bag from file example example_item.json
15
-
16
- For more information on data bags, see the Chef wiki page:
17
-
18
- https://docs.chef.io/essentials_data_bags.html
19
-
20
- Encrypted Data Bags
21
- -------------------
22
-
23
- Added in Chef 0.10, encrypted data bags allow you to encrypt the contents of your data bags. The content of attributes will no longer be searchable. To use encrypted data bags, first you must have or create a secret key.
24
-
25
- openssl rand -base64 512 > secret_key
26
-
27
- You may use this secret_key to add items to a data bag during a create.
28
-
29
- knife data bag create --secret-file secret_key passwords mysql
30
-
31
- You may also use it when adding ITEMs from files,
32
-
33
- knife data bag create passwords
34
- knife data bag from file passwords data_bags/passwords/mysql.json --secret-file secret_key
35
-
36
- The JSON for the ITEM must contain a key named "id" with a value equal to "ITEM" and the contents will be encrypted when uploaded. For example,
37
-
38
- {
39
- "id": "mysql",
40
- "password": "abc123"
41
- }
42
-
43
- Without the secret_key, the contents are encrypted.
44
-
45
- knife data bag show passwords mysql
46
- id: mysql
47
- password: 2I0XUUve1TXEojEyeGsjhw==
48
-
49
- Use the secret_key to view the contents.
50
-
51
- knife data bag show passwords mysql --secret-file secret_key
52
- id: mysql
53
- password: abc123
54
-
55
-
56
- For more information on encrypted data bags, see the Chef wiki page:
57
-
58
- https://docs.chef.io/essentials_data_bags.html
@@ -1,4 +0,0 @@
1
- {
2
- "id": "example_item",
3
- "key": "value"
4
- }
@@ -1,6 +0,0 @@
1
- .chef-repo.txt
2
- ==============
3
-
4
- This file gives ChefDK's generators a hint that you are using a Chef Repo and
5
- this is the root directory of your Chef Repo. ChefDK's generators use this to
6
- generate code that is designed to work with the Chef Repo workflow.
@@ -1,9 +0,0 @@
1
- Create environments here, in either the Role Ruby DSL (.rb) or JSON (.json) files. To install environments on the server, use knife.
2
-
3
- For example, in this directory you'll find an example environment file called `example.json` which can be uploaded to the Chef Server:
4
-
5
- knife environment from file environments/example.json
6
-
7
- For more information on environments, see the Chef wiki page:
8
-
9
- https://docs.chef.io/environments.html
@@ -1,13 +0,0 @@
1
- {
2
- "name": "example",
3
- "description": "This is an example environment defined as JSON",
4
- "chef_type": "environment",
5
- "json_class": "Chef::Environment",
6
- "default_attributes": {
7
- },
8
- "override_attributes": {
9
- },
10
- "cookbook_versions": {
11
- "example": "= 1.0.0"
12
- }
13
- }
@@ -1,24 +0,0 @@
1
- Create policyfiles here. When using a chef-repo, give your policyfiles
2
- the same filename as the name set in the policyfile itself, and use the
3
- `.rb` file extension.
4
-
5
- Compile the policy with a command like this:
6
-
7
- ```
8
- chef install policies/my-app-frontend.rb
9
- ```
10
-
11
- This will create a lockfile `policies/my-app-frontend.lock.json`.
12
-
13
- To update locked dependencies, run `chef update` like this:
14
-
15
- ```
16
- chef update policies/my-app-fronend.rb
17
- ```
18
-
19
- You can upload the policy (with associated cookbooks) to the server
20
- using a command like:
21
-
22
- ```
23
- chef push staging policies/my-app-frontend.rb
24
- ```
@@ -1,9 +0,0 @@
1
- Create roles here, in either the Role Ruby DSL (.rb) or JSON (.json) files. To install roles on the server, use knife.
2
-
3
- For example, in this directory you'll find an example role file called `example.json` which can be uploaded to the Chef Server:
4
-
5
- knife role from file roles/example.json
6
-
7
- For more information on roles, see the Chef wiki page:
8
-
9
- https://docs.chef.io/essentials_roles.html
@@ -1,13 +0,0 @@
1
- {
2
- "name": "example",
3
- "description": "This is an example role defined as JSON",
4
- "chef_type": "role",
5
- "json_class": "Chef::Role",
6
- "default_attributes": {
7
- },
8
- "override_attributes": {
9
- },
10
- "run_list": [
11
- "recipe[example]"
12
- ]
13
- }
@@ -1,2 +0,0 @@
1
- require 'chefspec'
2
- require 'chefspec/policyfile'
@@ -1,97 +0,0 @@
1
-
2
-
3
- context = ChefDK::Generator.context
4
- app_dir = File.join(context.app_root, context.app_name)
5
- cookbooks_dir = context.cookbook_root
6
- cookbook_dir = File.join(cookbooks_dir, context.cookbook_name)
7
-
8
- # app root dir
9
- directory app_dir
10
-
11
- # Top level files
12
-
13
- # TK
14
- template "#{app_dir}/.kitchen.yml" do
15
- source 'kitchen.yml.erb'
16
- helpers(ChefDK::Generator::TemplateHelper)
17
- end
18
-
19
- directory "#{app_dir}/test/integration/default/serverspec" do
20
- recursive true
21
- end
22
-
23
- directory "#{app_dir}/test/integration/helpers/serverspec" do
24
- recursive true
25
- end
26
-
27
- cookbook_file "#{app_dir}/test/integration/helpers/serverspec/spec_helper.rb" do
28
- source 'serverspec_spec_helper.rb'
29
- action :create_if_missing
30
- end
31
-
32
- template "#{app_dir}/test/integration/default/serverspec/default_spec.rb" do
33
- source 'serverspec_default_spec.rb.erb'
34
- helpers(ChefDK::Generator::TemplateHelper)
35
- action :create_if_missing
36
- end
37
-
38
- # README
39
- template "#{app_dir}/README.md" do
40
- helpers(ChefDK::Generator::TemplateHelper)
41
- end
42
-
43
- # Generated Cookbook:
44
-
45
- # cookbook collection dir
46
- directory cookbooks_dir
47
-
48
- # cookbook collection dir
49
- directory cookbook_dir
50
-
51
- # metadata.rb
52
- template "#{cookbook_dir}/metadata.rb" do
53
- helpers(ChefDK::Generator::TemplateHelper)
54
- end
55
-
56
- # chefignore
57
- cookbook_file "#{cookbook_dir}/chefignore"
58
-
59
- # Berks
60
- cookbook_file "#{cookbook_dir}/Berksfile"
61
-
62
- # Recipes
63
-
64
- directory "#{cookbook_dir}/recipes"
65
-
66
- template "#{cookbook_dir}/recipes/default.rb" do
67
- source "recipe.rb.erb"
68
- helpers(ChefDK::Generator::TemplateHelper)
69
- end
70
-
71
- # Chefspec
72
- directory "#{cookbook_dir}/spec/unit/recipes" do
73
- recursive true
74
- end
75
-
76
- cookbook_file "#{cookbook_dir}/spec/spec_helper.rb" do
77
- action :create_if_missing
78
- end
79
-
80
- template "#{cookbook_dir}/spec/unit/recipes/default_spec.rb" do
81
- source "recipe_spec.rb.erb"
82
- helpers(ChefDK::Generator::TemplateHelper)
83
- action :create_if_missing
84
- end
85
-
86
- # git
87
- if context.have_git
88
- if !context.skip_git_init
89
- execute("initialize-git") do
90
- command("git init .")
91
- cwd app_dir
92
- end
93
- end
94
- cookbook_file "#{app_dir}/.gitignore" do
95
- source "gitignore"
96
- end
97
- end
@@ -1,12 +0,0 @@
1
-
2
- context = ChefDK::Generator.context
3
- cookbook_dir = File.join(context.cookbook_root, context.cookbook_name)
4
- attribute_dir = File.join(cookbook_dir, "attributes")
5
- attribute_path = File.join(cookbook_dir, "attributes", "#{context.new_file_basename}.rb")
6
-
7
- directory attribute_dir
8
-
9
- template attribute_path do
10
- source "attribute.rb.erb"
11
- helpers(ChefDK::Generator::TemplateHelper)
12
- end
@@ -1,24 +0,0 @@
1
-
2
- context = ChefDK::Generator.context
3
- cookbook_dir = File.join(context.cookbook_root, context.cookbook_name)
4
- files_dir = File.join(cookbook_dir, "files", "default")
5
- cookbook_file_path = File.join(cookbook_dir, "files", "default", "#{context.new_file_basename}")
6
-
7
- directory files_dir do
8
- recursive true
9
- end
10
-
11
- if source_file = context.content_source
12
-
13
- file cookbook_file_path do
14
- content(IO.read(source_file))
15
- end
16
-
17
- else
18
-
19
- template cookbook_file_path do
20
- source "cookbook_file.erb"
21
- helpers(ChefDK::Generator::TemplateHelper)
22
- end
23
-
24
- end
@@ -1,23 +0,0 @@
1
-
2
- context = ChefDK::Generator.context
3
- cookbook_dir = File.join(context.cookbook_root, context.cookbook_name)
4
-
5
- resource_dir = File.join(cookbook_dir, "resources")
6
- resource_path = File.join(resource_dir, "#{context.new_file_basename}.rb")
7
-
8
- provider_dir = File.join(cookbook_dir, "providers")
9
- provider_path = File.join(provider_dir, "#{context.new_file_basename}.rb")
10
-
11
- directory resource_dir
12
-
13
- template resource_path do
14
- source "resource.rb.erb"
15
- helpers(ChefDK::Generator::TemplateHelper)
16
- end
17
-
18
- directory provider_dir
19
-
20
- template provider_path do
21
- source "provider.rb.erb"
22
- helpers(ChefDK::Generator::TemplateHelper)
23
- end
@@ -1,8 +0,0 @@
1
-
2
- context = ChefDK::Generator.context
3
- policyfile_path = File.join(context.policyfile_dir, "#{context.new_file_basename}.rb")
4
-
5
- template policyfile_path do
6
- source "Policyfile.rb.erb"
7
- helpers(ChefDK::Generator::TemplateHelper)
8
- end