chef-flavor-flay 0.1.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +171 -4
- data/exe/flay +29 -0
- data/flay.gemspec +1 -1
- data/lib/chef_gen/flavor/flay.rb +1 -1
- data/shared/flavor/flay/files/default/Rakefile +0 -7
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 72a4968a59440447aba15bd5968661d3c803c6f7
|
4
|
+
data.tar.gz: 593a0bb8a01c0e24f7b8ff91bc844dbdcaa65eb2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 278387eb05fa6dbb09e661374b7691876ea5bdf79ba89ca3fcad15ab4c9a92eccf9a8802c4ee742b0bdd7177f992d23810f62a5a5de3ced0a66cd5eeb36b31fe
|
7
|
+
data.tar.gz: 21b49512d6eaa44f0de31a1ee453f02425ed0889bebf396a48756a138c7af1520bfed2432da629140aabd94186f2d87f38538e651ce114debb7c5299a52dbc3c
|
data/README.md
CHANGED
@@ -1,10 +1,55 @@
|
|
1
|
-
# Flay -
|
1
|
+
# Flay - A Customizable Chef Cookbook Template
|
2
2
|
|
3
3
|
[![Build Status](https://travis-ci.org/sweeperio/flay.svg?branch=master)](https://travis-ci.org/sweeperio/flay)
|
4
4
|
|
5
|
-
This repo is a custom cookbook/recipe template for use with the [ChefDK].
|
5
|
+
This repo is a custom cookbook/recipe template for use with the [ChefDK]. It uses [chef-gen-flavors] to create a custom
|
6
|
+
template that can be used with `chef generate [cookbook|recipe]` commands.
|
7
|
+
|
8
|
+
It's pretty opinionated, but you could easily modify it to suit your needs, by modifying things in the
|
9
|
+
`shared/flavor/flay` directory.
|
6
10
|
|
7
11
|
[ChefDK]: https://downloads.chef.io/chef-dk/
|
12
|
+
[chef-gen-flavors]: https://github.com/jf647/chef-gen-flavors
|
13
|
+
|
14
|
+
## Why?
|
15
|
+
|
16
|
+
* Automatically create boilerplate cookbook code/files
|
17
|
+
* Put some standards in place that are used consistently across all cookbooks
|
18
|
+
* Generate simple, good examples for devs that are new to chef
|
19
|
+
|
20
|
+
## What?
|
21
|
+
|
22
|
+
* Normal setup in place...[Berkshelf], [ChefSpec], [Test Kitchen], etc.
|
23
|
+
* Only ubuntu is supported and setup in ChefSpec and Test Kitchen (I said it was opinionated)
|
24
|
+
* Adds [core] cookbook to the Berksfile
|
25
|
+
* Adds [rubocop] with some updated (opinionated) settings
|
26
|
+
* Updates all templates to pass `bundle exec rubocop && bundle exec rspec`
|
27
|
+
* Adds a travis file for CI that will cache it's bundle for #webscale
|
28
|
+
* Ensures `berks`, `chef`, `chefspec` and `rubocop` are in the Gemfile (pessimistically locked to current major version)
|
29
|
+
* Creates a single `test` directory rather than spec/unit and test/integration
|
30
|
+
* Adds a _dummy_ `encrypted_data_bag_secret` file for [Test Kitchen]
|
31
|
+
* Adds `encrypt_data_bag` rake task for working with encrypted data bags in [Test Kitchen] (see note below)
|
32
|
+
|
33
|
+
### Testing Encrypted Data Bags
|
34
|
+
|
35
|
+
In order to make testing encrypted data bags easier, there's a convention (and rake task) in place in this template.
|
36
|
+
|
37
|
+
The _test/integration/data_bags_ directory should contain subdirectories for each data bag you want to test (just like
|
38
|
+
your chef repo would).
|
39
|
+
|
40
|
+
**To create an encrypted data bag item, follow these steps (assuming you're testing ejson/keys):**
|
41
|
+
|
42
|
+
* Create `test/integration/data_bags/ejson/keys.plaintext.json` and add your items
|
43
|
+
* Run `bundle exec rake encrypt_data_bag[ejson,keys]` (zsh users, you'll need to quote, escape or `unsetopt nomatch`)
|
44
|
+
* Notice that `test/integration/data_bags/ejson/keys.json` has been created and contains the encrypted contents
|
45
|
+
|
46
|
+
Updating follows the exact same process.
|
47
|
+
|
48
|
+
[Berkshelf]: https://docs.chef.io/berkshelf.html
|
49
|
+
[ChefSpec]: https://docs.chef.io/chefspec.html
|
50
|
+
[Test Kitchen]: https://docs.chef.io/kitchen.html
|
51
|
+
[core]: https://github.com/sweeperio/chef-core
|
52
|
+
[rubocop]: https://docs.chef.io/rubocop.html
|
8
53
|
|
9
54
|
## Installation
|
10
55
|
|
@@ -25,9 +70,131 @@ Celebrate! :rocket:
|
|
25
70
|
## Usage
|
26
71
|
|
27
72
|
* `chef generate cookbook my_cookbook`
|
28
|
-
* `chef generate recipe my_recipe`
|
73
|
+
* `chef generate recipe my_recipe` (from within the cookbook directory)
|
29
74
|
|
30
|
-
|
75
|
+
If you're using this for sweeper cookbooks you should use these instead. They simply call the normal generate methods
|
76
|
+
but pass parameters for maintainer, email and license.
|
77
|
+
|
78
|
+
* `chef exec flay cookbook my_cookbook`
|
79
|
+
* `chef exec flay recipe my_cookbook`
|
80
|
+
|
81
|
+
### Example
|
82
|
+
|
83
|
+
```
|
84
|
+
$ chef generate cookbook chef-demo-flay
|
85
|
+
|
86
|
+
using ChefGen flavor 'flay'
|
87
|
+
Compiling Cookbooks...
|
88
|
+
Recipe: flay::cookbook
|
89
|
+
* directory[/Users/pseudomuto/chef-demo-flay] action create
|
90
|
+
- create new directory /Users/pseudomuto/chef-demo-flay
|
91
|
+
* directory[/Users/pseudomuto/chef-demo-flay/.bundle] action create
|
92
|
+
- create new directory /Users/pseudomuto/chef-demo-flay/.bundle
|
93
|
+
* directory[/Users/pseudomuto/chef-demo-flay/recipes] action create
|
94
|
+
- create new directory /Users/pseudomuto/chef-demo-flay/recipes
|
95
|
+
* cookbook_file[/Users/pseudomuto/chef-demo-flay/.gitignore] action create
|
96
|
+
- create new file /Users/pseudomuto/chef-demo-flay/.gitignore
|
97
|
+
- update content in file /Users/pseudomuto/chef-demo-flay/.gitignore from none to 93f78f
|
98
|
+
(diff output suppressed by config)
|
99
|
+
* cookbook_file[/Users/pseudomuto/chef-demo-flay/.rubocop.yml] action create
|
100
|
+
- create new file /Users/pseudomuto/chef-demo-flay/.rubocop.yml
|
101
|
+
- update content in file /Users/pseudomuto/chef-demo-flay/.rubocop.yml from none to 53e0ba
|
102
|
+
(diff output suppressed by config)
|
103
|
+
* cookbook_file[/Users/pseudomuto/chef-demo-flay/Berksfile] action create_if_missing
|
104
|
+
- create new file /Users/pseudomuto/chef-demo-flay/Berksfile
|
105
|
+
- update content in file /Users/pseudomuto/chef-demo-flay/Berksfile from none to dcbbf1
|
106
|
+
(diff output suppressed by config)
|
107
|
+
* cookbook_file[/Users/pseudomuto/chef-demo-flay/.bundle/config] action create
|
108
|
+
- create new file /Users/pseudomuto/chef-demo-flay/.bundle/config
|
109
|
+
- update content in file /Users/pseudomuto/chef-demo-flay/.bundle/config from none to f7385e
|
110
|
+
(diff output suppressed by config)
|
111
|
+
* cookbook_file[/Users/pseudomuto/chef-demo-flay/chefignore] action create
|
112
|
+
- create new file /Users/pseudomuto/chef-demo-flay/chefignore
|
113
|
+
- update content in file /Users/pseudomuto/chef-demo-flay/chefignore from none to 51b09a
|
114
|
+
(diff output suppressed by config)
|
115
|
+
* cookbook_file[/Users/pseudomuto/chef-demo-flay/Gemfile] action create
|
116
|
+
- create new file /Users/pseudomuto/chef-demo-flay/Gemfile
|
117
|
+
- update content in file /Users/pseudomuto/chef-demo-flay/Gemfile from none to ebb472
|
118
|
+
(diff output suppressed by config)
|
119
|
+
* cookbook_file[/Users/pseudomuto/chef-demo-flay/Rakefile] action create
|
120
|
+
- create new file /Users/pseudomuto/chef-demo-flay/Rakefile
|
121
|
+
- update content in file /Users/pseudomuto/chef-demo-flay/Rakefile from none to b03f32
|
122
|
+
(diff output suppressed by config)
|
123
|
+
* flay_template[/Users/pseudomuto/chef-demo-flay/metadata.rb] action create_if_missing
|
124
|
+
* template[/Users/pseudomuto/chef-demo-flay/metadata.rb] action create_if_missing
|
125
|
+
- create new file /Users/pseudomuto/chef-demo-flay/metadata.rb
|
126
|
+
- update content in file /Users/pseudomuto/chef-demo-flay/metadata.rb from none to 74ceb0
|
127
|
+
(diff output suppressed by config)
|
128
|
+
|
129
|
+
* flay_template[/Users/pseudomuto/chef-demo-flay/README.md] action create_if_missing
|
130
|
+
* template[/Users/pseudomuto/chef-demo-flay/README.md] action create_if_missing
|
131
|
+
- create new file /Users/pseudomuto/chef-demo-flay/README.md
|
132
|
+
- update content in file /Users/pseudomuto/chef-demo-flay/README.md from none to a6b92d
|
133
|
+
(diff output suppressed by config)
|
134
|
+
|
135
|
+
* directory[/Users/pseudomuto/chef-demo-flay/test/unit/recipes] action create
|
136
|
+
- create new directory /Users/pseudomuto/chef-demo-flay/test/unit/recipes
|
137
|
+
* cookbook_file[/Users/pseudomuto/chef-demo-flay/.rspec] action create
|
138
|
+
- create new file /Users/pseudomuto/chef-demo-flay/.rspec
|
139
|
+
- update content in file /Users/pseudomuto/chef-demo-flay/.rspec from none to c64d5e
|
140
|
+
(diff output suppressed by config)
|
141
|
+
* cookbook_file[/Users/pseudomuto/chef-demo-flay/.travis.yml] action create
|
142
|
+
- create new file /Users/pseudomuto/chef-demo-flay/.travis.yml
|
143
|
+
- update content in file /Users/pseudomuto/chef-demo-flay/.travis.yml from none to 1d91c7
|
144
|
+
(diff output suppressed by config)
|
145
|
+
* flay_template[/Users/pseudomuto/chef-demo-flay/recipes/default.rb] action create_if_missing
|
146
|
+
* template[/Users/pseudomuto/chef-demo-flay/recipes/default.rb] action create_if_missing
|
147
|
+
- create new file /Users/pseudomuto/chef-demo-flay/recipes/default.rb
|
148
|
+
- update content in file /Users/pseudomuto/chef-demo-flay/recipes/default.rb from none to ad3596
|
149
|
+
(diff output suppressed by config)
|
150
|
+
|
151
|
+
* flay_template[/Users/pseudomuto/chef-demo-flay/test/unit/recipes/default_spec.rb] action create_if_missing
|
152
|
+
* template[/Users/pseudomuto/chef-demo-flay/test/unit/recipes/default_spec.rb] action create_if_missing
|
153
|
+
- create new file /Users/pseudomuto/chef-demo-flay/test/unit/recipes/default_spec.rb
|
154
|
+
- update content in file /Users/pseudomuto/chef-demo-flay/test/unit/recipes/default_spec.rb from none to c1956b
|
155
|
+
(diff output suppressed by config)
|
156
|
+
|
157
|
+
* directory[/Users/pseudomuto/chef-demo-flay/test/integration/data_bags/ejson] action create
|
158
|
+
- create new directory /Users/pseudomuto/chef-demo-flay/test/integration/data_bags/ejson
|
159
|
+
* directory[/Users/pseudomuto/chef-demo-flay/test/integration/default/serverspec] action create
|
160
|
+
- create new directory /Users/pseudomuto/chef-demo-flay/test/integration/default/serverspec
|
161
|
+
* directory[/Users/pseudomuto/chef-demo-flay/test/integration/helpers/serverspec] action create
|
162
|
+
- create new directory /Users/pseudomuto/chef-demo-flay/test/integration/helpers/serverspec
|
163
|
+
* cookbook_file[/Users/pseudomuto/chef-demo-flay/test/integration/encrypted_data_bag_secret] action create
|
164
|
+
- create new file /Users/pseudomuto/chef-demo-flay/test/integration/encrypted_data_bag_secret
|
165
|
+
- update content in file /Users/pseudomuto/chef-demo-flay/test/integration/encrypted_data_bag_secret from none to 4299f4
|
166
|
+
(diff output suppressed by config)
|
167
|
+
* cookbook_file[/Users/pseudomuto/chef-demo-flay/test/integration/data_bags/ejson/keys.json] action create
|
168
|
+
- create new file /Users/pseudomuto/chef-demo-flay/test/integration/data_bags/ejson/keys.json
|
169
|
+
- update content in file /Users/pseudomuto/chef-demo-flay/test/integration/data_bags/ejson/keys.json from none to 3e325d
|
170
|
+
(diff output suppressed by config)
|
171
|
+
* cookbook_file[/Users/pseudomuto/chef-demo-flay/test/integration/data_bags/ejson/keys.plaintext.json] action create
|
172
|
+
- create new file /Users/pseudomuto/chef-demo-flay/test/integration/data_bags/ejson/keys.plaintext.json
|
173
|
+
- update content in file /Users/pseudomuto/chef-demo-flay/test/integration/data_bags/ejson/keys.plaintext.json from none to 179a27
|
174
|
+
(diff output suppressed by config)
|
175
|
+
* cookbook_file[/Users/pseudomuto/chef-demo-flay/test/integration/helpers/serverspec/spec_helper.rb] action create_if_missing
|
176
|
+
- create new file /Users/pseudomuto/chef-demo-flay/test/integration/helpers/serverspec/spec_helper.rb
|
177
|
+
- update content in file /Users/pseudomuto/chef-demo-flay/test/integration/helpers/serverspec/spec_helper.rb from none to bef02f
|
178
|
+
(diff output suppressed by config)
|
179
|
+
* cookbook_file[/Users/pseudomuto/chef-demo-flay/test/unit/spec_helper.rb] action create_if_missing
|
180
|
+
- create new file /Users/pseudomuto/chef-demo-flay/test/unit/spec_helper.rb
|
181
|
+
- update content in file /Users/pseudomuto/chef-demo-flay/test/unit/spec_helper.rb from none to 918ad3
|
182
|
+
(diff output suppressed by config)
|
183
|
+
* flay_template[/Users/pseudomuto/chef-demo-flay/.kitchen.yml] action create_if_missing
|
184
|
+
* template[/Users/pseudomuto/chef-demo-flay/.kitchen.yml] action create_if_missing
|
185
|
+
- create new file /Users/pseudomuto/chef-demo-flay/.kitchen.yml
|
186
|
+
- update content in file /Users/pseudomuto/chef-demo-flay/.kitchen.yml from none to dd0b56
|
187
|
+
(diff output suppressed by config)
|
188
|
+
|
189
|
+
* flay_template[/Users/pseudomuto/chef-demo-flay/test/integration/default/serverspec/default_spec.rb] action create_if_missing
|
190
|
+
* template[/Users/pseudomuto/chef-demo-flay/test/integration/default/serverspec/default_spec.rb] action create_if_missing
|
191
|
+
- create new file /Users/pseudomuto/chef-demo-flay/test/integration/default/serverspec/default_spec.rb
|
192
|
+
- update content in file /Users/pseudomuto/chef-demo-flay/test/integration/default/serverspec/default_spec.rb from none to 7fcaa4
|
193
|
+
(diff output suppressed by config)
|
194
|
+
|
195
|
+
* execute[initialize-git] action run
|
196
|
+
- execute git init .
|
197
|
+
```
|
31
198
|
|
32
199
|
## License
|
33
200
|
|
data/exe/flay
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
ARGS = "-C sweeper.io -m developers@sweeper.io -I mit".freeze
|
4
|
+
|
5
|
+
def cookbook(name)
|
6
|
+
`chef generate cookbook #{name} #{ARGS}`
|
7
|
+
end
|
8
|
+
|
9
|
+
def recipe(name)
|
10
|
+
`chef generate recipe #{name} #{ARGS}`
|
11
|
+
end
|
12
|
+
|
13
|
+
def usage
|
14
|
+
puts "USAGE:"
|
15
|
+
puts "flay cookbook NAME"
|
16
|
+
puts "flay recipe NAME"
|
17
|
+
exit 1
|
18
|
+
end
|
19
|
+
|
20
|
+
type, name = ARGV
|
21
|
+
usage if ARGV.size != 2
|
22
|
+
usage if type.nil? || name.nil?
|
23
|
+
|
24
|
+
case type
|
25
|
+
when "cookbook" then cookbook(name)
|
26
|
+
when "recipe" then recipe(name)
|
27
|
+
else
|
28
|
+
usage
|
29
|
+
end
|
data/flay.gemspec
CHANGED
data/lib/chef_gen/flavor/flay.rb
CHANGED
@@ -1,12 +1,5 @@
|
|
1
1
|
require "bundler/setup"
|
2
2
|
require "chef"
|
3
|
-
require "rspec/core/rake_task"
|
4
|
-
require "rubocop/rake_task"
|
5
|
-
|
6
|
-
RuboCop::RakeTask.new(:rubocop)
|
7
|
-
RSpec::Core::RakeTask.new(:spec)
|
8
|
-
|
9
|
-
task default: [:rubocop, :spec]
|
10
3
|
|
11
4
|
SECRET_FILE = "./test/integration/encrypted_data_bag_secret".freeze
|
12
5
|
INPUT_PATH_FORMAT = "./test/integration/data_bags/%s/%s.plaintext.json".freeze
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chef-flavor-flay
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- pseudomuto
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-12-
|
11
|
+
date: 2015-12-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chef-gen-flavors
|
@@ -27,7 +27,8 @@ dependencies:
|
|
27
27
|
description: A Chef cookbook generator using [chef-gen-flavors](https://rubygems.org/gems/chef-gen-flavors)
|
28
28
|
email:
|
29
29
|
- developers@sweeper.io
|
30
|
-
executables:
|
30
|
+
executables:
|
31
|
+
- flay
|
31
32
|
extensions: []
|
32
33
|
extra_rdoc_files: []
|
33
34
|
files:
|
@@ -42,6 +43,7 @@ files:
|
|
42
43
|
- Rakefile
|
43
44
|
- bin/console
|
44
45
|
- bin/setup
|
46
|
+
- exe/flay
|
45
47
|
- flay.gemspec
|
46
48
|
- lib/chef_gen/flavor/flay.rb
|
47
49
|
- shared/flavor/flay/files/default/Berksfile
|