chef-flavor-flay 0.3.2 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 312ca9891aec8e1d22c7152b2b724da2fff7fe51
4
- data.tar.gz: 23c89bbd5d72452143c9816d9ec40f2f36f08070
3
+ metadata.gz: 1d4b88000fcba519db2b2cdbeaa9fbf9e7b5cff6
4
+ data.tar.gz: b3ab490cb4ca32b39224719afdd80275a32b78e3
5
5
  SHA512:
6
- metadata.gz: 1fc58324e14fca32555fc35d976845cb7e073e18219b2412c730a10b62c9185b298bae005867412e119f4b74f480dd6f32033b9b6397cc5582ed71def2db4195
7
- data.tar.gz: e0437f1a756f0021b89cdf2d02d9131d4f0900077240de72baf2f06189351566ebb592c08f313ddc3efa2555b3ea2bfdc754b7893109602973a88f44c025798b
6
+ metadata.gz: 122d01ba1d27fbf5fa90f30963d5e7d3384b9f821e9e011ff15dcf0e21af2021cac61642528a1cceafc784a29d938a9d42d8982b5bc08566aac1d7ef61ce6245
7
+ data.tar.gz: 36c895f4e86bc37ee158be8be4910d2b14fa46fa03f29fc7d6f4b090039a3400806703845be88876c74a03cbe0d2e4d6560cfe73a68af9007d29533092b3f0a1
data/Gemfile CHANGED
@@ -6,6 +6,7 @@ group :development, :test do
6
6
  gem "bundler", "~> 1.11"
7
7
  gem "chef-dk", "~> 0.0"
8
8
  gem "coveralls", require: false
9
+ gem "foodcritic", "~> 5.0"
9
10
  gem "pry-byebug", "~> 3.0"
10
11
  gem "rake", "~> 10.0"
11
12
  gem "rspec", "~> 3.0"
data/README.md CHANGED
@@ -5,10 +5,9 @@
5
5
  [![Coverage Status](https://coveralls.io/repos/sweeperio/flay/badge.svg?branch=master&service=github)](https://coveralls.io/github/sweeperio/flay?branch=master)
6
6
 
7
7
  This repo is a custom cookbook/recipe template for use with the [ChefDK]. It uses [chef-gen-flavors] to create a custom
8
- template that can be used with `chef generate [cookbook|recipe]` commands.
8
+ template that can be used with `chef generate [cookbook|recipe]` commands.
9
9
 
10
- It's pretty opinionated, but you could easily modify it to suit your needs, by modifying things in the
11
- `shared/flavor/flay` directory.
10
+ It's very opinionated and works with the sweeperio infrastructure specifically.
12
11
 
13
12
  [ChefDK]: https://downloads.chef.io/chef-dk/
14
13
  [chef-gen-flavors]: https://github.com/jf647/chef-gen-flavors
@@ -22,12 +21,12 @@ It's pretty opinionated, but you could easily modify it to suit your needs, by m
22
21
  ## What?
23
22
 
24
23
  * Normal setup in place...[Berkshelf], [ChefSpec], [Test Kitchen], etc.
25
- * Only ubuntu is supported and setup in ChefSpec and Test Kitchen (I said it was opinionated)
26
- * Adds [core] cookbook to the Berksfile
24
+ * _**Only ubuntu**_ is supported and setup in ChefSpec and Test Kitchen (I said it was opinionated)
25
+ * Sets up berks to use our berks api
26
+ * Adds [core] cookbook to metadata.rb
27
27
  * Adds [rubocop] with some updated (opinionated) settings
28
28
  * Updates all templates to pass `bundle exec rubocop && bundle exec rspec`
29
- * Adds a travis file for CI that will cache it's bundle for #webscale
30
- * Ensures `berks`, `chef`, `chefspec` and `rubocop` are in the Gemfile (pessimistically locked to current major version)
29
+ * Adds a travis file for CI that will use the chefdk to run tests
31
30
  * Creates a single `test` directory rather than spec/unit and test/integration
32
31
  * Adds a _dummy_ `encrypted_data_bag_secret` file for [Test Kitchen]
33
32
  * Adds `encrypt_data_bag` rake task for working with encrypted data bags in [Test Kitchen] (see note below)
@@ -1,3 +1,3 @@
1
1
  module Flay
2
- VERSION = "0.3.2".freeze
2
+ VERSION = "0.4.0".freeze
3
3
  end
@@ -0,0 +1,49 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, and in the interest of
4
+ fostering an open and welcoming community, we pledge to respect all people who
5
+ contribute through reporting issues, posting feature requests, updating
6
+ documentation, submitting pull requests or patches, and other activities.
7
+
8
+ We are committed to making participation in this project a harassment-free
9
+ experience for everyone, regardless of level of experience, gender, gender
10
+ identity and expression, sexual orientation, disability, personal appearance,
11
+ body size, race, ethnicity, age, religion, or nationality.
12
+
13
+ Examples of unacceptable behavior by participants include:
14
+
15
+ * The use of sexualized language or imagery
16
+ * Personal attacks
17
+ * Trolling or insulting/derogatory comments
18
+ * Public or private harassment
19
+ * Publishing other's private information, such as physical or electronic
20
+ addresses, without explicit permission
21
+ * Other unethical or unprofessional conduct
22
+
23
+ Project maintainers have the right and responsibility to remove, edit, or
24
+ reject comments, commits, code, wiki edits, issues, and other contributions
25
+ that are not aligned to this Code of Conduct, or to ban temporarily or
26
+ permanently any contributor for other behaviors that they deem inappropriate,
27
+ threatening, offensive, or harmful.
28
+
29
+ By adopting this Code of Conduct, project maintainers commit themselves to
30
+ fairly and consistently applying these principles to every aspect of managing
31
+ this project. Project maintainers who do not follow or enforce the Code of
32
+ Conduct may be permanently removed from the project team.
33
+
34
+ This code of conduct applies both within project spaces and in public spaces
35
+ when an individual is representing the project or its community.
36
+
37
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
38
+ reported by contacting a project maintainer at david.muto@gmail.com. All
39
+ complaints will be reviewed and investigated and will result in a response that
40
+ is deemed necessary and appropriate to the circumstances. Maintainers are
41
+ obligated to maintain confidentiality with regard to the reporter of an
42
+ incident.
43
+
44
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
45
+ version 1.3.0, available at
46
+ [http://contributor-covenant.org/version/1/3/0/][version]
47
+
48
+ [homepage]: http://contributor-covenant.org
49
+ [version]: http://contributor-covenant.org/version/1/3/0/
@@ -0,0 +1,36 @@
1
+ # Contributing
2
+
3
+ First off, glad you're here and want to contribute! :heart:
4
+
5
+ ## Getting Started
6
+
7
+ You'll need to have the [chefdk] and [vagrant] installed to work on this repo. For installation and setup details,
8
+ check out the links.
9
+
10
+ ## Making Changes
11
+
12
+ * If necessary, [fork this repo]
13
+ * Create a branch off of master
14
+ * Make focused commits with descriptive messages
15
+ * Add tests that will fail without your code, and pass with it
16
+ * Push your branch and submit a pull request indicating the problem you're addressing and the solution you're proposing
17
+ * **Ping someone on the PR!** - Most of us only get notifications if we're pinged directly
18
+
19
+ ### Running Tests
20
+
21
+ * Style (rubocop/foodcritic) - `chef exec rake style`
22
+ * RSpec/ChefSpec - `chef exec rake rspec`
23
+ * Style and Specs - `chef exec rake`
24
+ * Integration Tests (Test Kitchen) - `chef exec kitchen test`
25
+
26
+ Generally, during development, it's faster to run `chef exec kitchen converge && chef exec kitchen verify` after each
27
+ change. That's totally cool, just be sure to run a clean test with `chef exec kitchen test` before submitting a PR.
28
+
29
+ #### Tip
30
+
31
+ If you get sick of typing `chef exec` in front of these commands, you can run `eval "$(chef shell-init SHELL)"` to
32
+ update your current shell to use the [chefdk] by default (you can remove `chef exec` from all these).
33
+
34
+ [chefdk]: https://downloads.chef.io/chef-dk/
35
+ [vagrant]: https://www.vagrantup.com/
36
+ [fork this repo]: https://help.github.com/articles/fork-a-repo
@@ -1,6 +1,9 @@
1
- require "bundler/setup"
2
1
  require "chef"
2
+ require "foodcritic"
3
+ require "rspec/core/rake_task"
4
+ require "rubocop/rake_task"
3
5
 
6
+ # Data Bag Helpers
4
7
  SECRET_FILE = "./test/integration/encrypted_data_bag_secret".freeze
5
8
  INPUT_PATH_FORMAT = "./test/integration/data_bags/%s/%s.plaintext.json".freeze
6
9
  OUTPUT_PATH_FORMAT = "./test/integration/data_bags/%s/%s.json".freeze
@@ -12,6 +15,15 @@ def raw_bag_item(args)
12
15
  Chef::DataBagItem.from_hash(hash)
13
16
  end
14
17
 
18
+ RSpec::Core::RakeTask.new { |rspec| rspec.rspec_opts = File.read("./.rspec").split("\n") }
19
+
20
+ RuboCop::RakeTask.new { |rubocop| rubocop.options = %w(-D) }
21
+
22
+ FoodCritic::Rake::LintTask.new do |foodcritic|
23
+ foodcritic.options[:progress] = true
24
+ foodcritic.options[:fail_tags] = "any"
25
+ end
26
+
15
27
  desc "encrypts a data bag item for integration tests"
16
28
  task :encrypt_data_bag, [:bag, :item] do |_, args|
17
29
  data_bag_item = raw_bag_item(args)
@@ -24,3 +36,11 @@ task :encrypt_data_bag, [:bag, :item] do |_, args|
24
36
 
25
37
  puts format("encrypted test data bag: %s", output_path)
26
38
  end
39
+
40
+ desc "Run Rubocop and Foodcritic style checks"
41
+ task style: [:rubocop, :foodcritic]
42
+
43
+ desc "Run all style checks and unit tests"
44
+ task test: [:style, :spec]
45
+
46
+ task default: :test
@@ -1,3 +1,4 @@
1
+ --pattern test/unit/**/*_spec.rb
1
2
  --default-path test/unit
2
3
  --order rand
3
4
  --color
@@ -0,0 +1,4 @@
1
+ current_dir = File.dirname(__FILE__)
2
+ node_name "travis"
3
+ client_key "#{current_dir}/client.pem"
4
+ chef_server_url "https://chef.sweeper.io/organizations/sweeper"
@@ -1,9 +1,22 @@
1
1
  ---
2
- language: ruby
3
- cache: bundler
4
- rvm:
5
- - 2.2.3
2
+ addons:
3
+ apt:
4
+ sources:
5
+ - chef-current-precise
6
+ packages:
7
+ - chefdk
8
+
9
+ install: echo "skipping bundle install"
10
+
11
+ before_script:
12
+ - eval "$(/opt/chefdk/bin/chef shell-init bash)"
13
+ - cp -r test/chef .chef
14
+ - openssl enc -d -aes-256-cbc -k $CLIENT_PASSPHRASE -in .chef/client.enc -out .chef/client.pem
6
15
 
7
16
  script:
8
- - bundle exec rubocop
9
- - bundle exec rspec
17
+ - chef --version
18
+ - rubocop --version
19
+ - foodcritic --version
20
+ - rspec --version
21
+ - rake --version
22
+ - rake
@@ -1,5 +1,6 @@
1
1
  context = ChefDK::Generator.context
2
2
  cookbook_dir = File.join(context.cookbook_root, context.cookbook_name)
3
+ kitchen_dir = File.join(cookbook_dir, "test", "integration")
3
4
 
4
5
  # Common Cookbook Things
5
6
  directory cookbook_dir
@@ -10,43 +11,56 @@ cookbook_file("#{cookbook_dir}/.gitignore") { source "gitignore" }
10
11
  cookbook_file("#{cookbook_dir}/.rubocop.yml") { source "rubocop.yml" }
11
12
  cookbook_file("#{cookbook_dir}/Berksfile") { action :create_if_missing }
12
13
  cookbook_file "#{cookbook_dir}/chefignore"
13
- cookbook_file "#{cookbook_dir}/Gemfile"
14
+ cookbook_file "#{cookbook_dir}/CODE_OF_CONDUCT.md"
15
+ cookbook_file "#{cookbook_dir}/CONTRIBUTING.md"
14
16
  cookbook_file "#{cookbook_dir}/Rakefile"
15
17
 
16
18
  flay_template "#{cookbook_dir}/metadata.rb"
17
19
  flay_template "#{cookbook_dir}/README.md"
20
+ flay_template "#{cookbook_dir}/LICENSE"
18
21
 
19
22
  # ChefSpec
23
+ directory("#{cookbook_dir}/test/chef") { recursive true }
20
24
  directory("#{cookbook_dir}/test/unit/recipes") { recursive true }
21
25
 
26
+ cookbook_file("#{cookbook_dir}/.rspec") { source "rspec" }
27
+ cookbook_file("#{cookbook_dir}/.travis.yml") { source "travis.yml" }
28
+ cookbook_file("#{cookbook_dir}/test/chef/client.enc") { source "test/chef/client.enc" }
29
+ cookbook_file("#{cookbook_dir}/test/chef/knife.rb") { source "test/chef/knife.rb" }
30
+
22
31
  cookbook_file "#{cookbook_dir}/test/unit/spec_helper.rb" do
23
- source "spec_helper.rb"
32
+ source "test/unit/spec_helper.rb"
24
33
  action :create_if_missing
25
34
  end
26
35
 
27
- cookbook_file("#{cookbook_dir}/.rspec") { source "rspec" }
28
- cookbook_file("#{cookbook_dir}/.travis.yml") { source "travis.yml" }
29
-
30
36
  flay_template("#{cookbook_dir}/recipes/default.rb") { source "recipe.rb.erb" }
31
37
  flay_template("#{cookbook_dir}/test/unit/recipes/default_spec.rb") { source "recipe_spec.rb.erb" }
32
38
 
33
39
  # Test Kitchen
34
- directory("#{cookbook_dir}/test/integration/data_bags/ejson") { recursive true }
35
- directory("#{cookbook_dir}/test/integration/default/serverspec") { recursive true }
36
- directory("#{cookbook_dir}/test/integration/helpers/serverspec") { recursive true }
40
+ directory("#{kitchen_dir}/data_bags/ejson") { recursive true }
41
+ directory("#{kitchen_dir}/default/serverspec") { recursive true }
42
+ directory("#{kitchen_dir}/helpers/serverspec") { recursive true }
37
43
 
38
- cookbook_file("#{cookbook_dir}/test/integration/encrypted_data_bag_secret") { source "encrypted_data_bag_secret" }
39
- cookbook_file("#{cookbook_dir}/test/integration/data_bags/ejson/keys.json") { source "keys.json" }
40
- cookbook_file("#{cookbook_dir}/test/integration/data_bags/ejson/keys.plaintext.json") { source "keys.plaintext.json" }
44
+ cookbook_file("#{kitchen_dir}/encrypted_data_bag_secret") do
45
+ source "test/integration/encrypted_data_bag_secret"
46
+ end
47
+
48
+ cookbook_file("#{kitchen_dir}/data_bags/ejson/keys.json") do
49
+ source "test/integration/data_bags/ejson/keys.json"
50
+ end
51
+
52
+ cookbook_file("#{kitchen_dir}/data_bags/ejson/keys.plaintext.json") do
53
+ source "test/integration/data_bags/ejson/keys.plaintext.json"
54
+ end
41
55
 
42
- cookbook_file "#{cookbook_dir}/test/integration/helpers/serverspec/spec_helper.rb" do
43
- source "serverspec_spec_helper.rb"
56
+ cookbook_file "#{kitchen_dir}/helpers/serverspec/spec_helper.rb" do
57
+ source "test/integration/helpers/serverspec/spec_helper.rb"
44
58
  action :create_if_missing
45
59
  end
46
60
 
47
61
  flay_template("#{cookbook_dir}/.kitchen.yml") { source "kitchen.yml.erb" }
48
62
 
49
- flay_template "#{cookbook_dir}/test/integration/default/serverspec/default_spec.rb" do
63
+ flay_template "#{kitchen_dir}/default/serverspec/default_spec.rb" do
50
64
  source "serverspec_default_spec.rb.erb"
51
65
  end
52
66
 
@@ -7,7 +7,7 @@ spec_path = File.join(cookbook_dir, "test", "unit", "recipes", "#{context
7
7
  directory("#{cookbook_dir}/test/unit/recipes") { recursive true }
8
8
 
9
9
  cookbook_file spec_helper_path do
10
- source "spec_helper.rb"
10
+ source "test/unit/spec_helper.rb"
11
11
  action :create_if_missing
12
12
  end
13
13
 
@@ -0,0 +1 @@
1
+ <%= license_description("#").rstrip %>
@@ -1,3 +1,31 @@
1
1
  # <%= sanitized_cookbook_name %>
2
2
 
3
- TODO: Enter the cookbook description here.
3
+ [![Build Status](https://travis-ci.org/sweeperio/<%= cookbook_name %>.svg?branch=master)](https://travis-ci.org/sweeperio/<%= cookbook_name %>)
4
+
5
+ Install/configure <%= sanitized_cookbook_name %>
6
+
7
+ ## What This Does
8
+
9
+ * Thing 1
10
+ * Thing 2
11
+
12
+ * Add the cookbook description here.
13
+ * Add status badge once travis is setup
14
+
15
+ ## Attributes
16
+
17
+ | attribute | description | default |
18
+ |-----------|-------------|---------|
19
+ | `node["<%= sanitized_cookbook_name %>"]["value"]` | some description | `""` |
20
+
21
+ ## Recipes
22
+
23
+ ### <%= sanitized_cookbook_name %>::default
24
+
25
+ TODO: description
26
+
27
+ **Usage:** add `recipe[<%= sanitized_cookbook_name %>]` to your run list.
28
+
29
+ ## License
30
+
31
+ <%= license_description.rstrip %>
@@ -4,7 +4,7 @@ maintainer "<%= copyright_holder %>"
4
4
  maintainer_email "<%= email %>"
5
5
  license "<%= license %>"
6
6
  description "Installs/Configures <%= sanitized_cookbook_name %>"
7
- long_description "Installs/Configures <%= sanitized_cookbook_name %>"
7
+ long_description IO.read(File.join(File.dirname(__FILE__), "README.md"))
8
8
  version "0.1.0"
9
9
  # rubocop:enable Style/SingleSpaceBeforeFirstArg
10
10
 
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.3.2
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - pseudomuto
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-01-06 00:00:00.000000000 Z
11
+ date: 2016-01-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chef-gen-flavors
@@ -70,22 +70,26 @@ files:
70
70
  - lib/flay/helpers.rb
71
71
  - lib/flay/version.rb
72
72
  - shared/flavor/flay/files/default/Berksfile
73
- - shared/flavor/flay/files/default/Gemfile
73
+ - shared/flavor/flay/files/default/CODE_OF_CONDUCT.md
74
+ - shared/flavor/flay/files/default/CONTRIBUTING.md
74
75
  - shared/flavor/flay/files/default/Rakefile
75
76
  - shared/flavor/flay/files/default/chefignore
76
- - shared/flavor/flay/files/default/encrypted_data_bag_secret
77
77
  - shared/flavor/flay/files/default/gitignore
78
- - shared/flavor/flay/files/default/keys.json
79
- - shared/flavor/flay/files/default/keys.plaintext.json
80
78
  - shared/flavor/flay/files/default/rspec
81
79
  - shared/flavor/flay/files/default/rubocop.yml
82
- - shared/flavor/flay/files/default/serverspec_spec_helper.rb
83
- - shared/flavor/flay/files/default/spec_helper.rb
80
+ - shared/flavor/flay/files/default/test/chef/client.enc
81
+ - shared/flavor/flay/files/default/test/chef/knife.rb
82
+ - shared/flavor/flay/files/default/test/integration/data_bags/ejson/keys.json
83
+ - shared/flavor/flay/files/default/test/integration/data_bags/ejson/keys.plaintext.json
84
+ - shared/flavor/flay/files/default/test/integration/encrypted_data_bag_secret
85
+ - shared/flavor/flay/files/default/test/integration/helpers/serverspec/spec_helper.rb
86
+ - shared/flavor/flay/files/default/test/unit/spec_helper.rb
84
87
  - shared/flavor/flay/files/default/travis.yml
85
88
  - shared/flavor/flay/metadata.rb
86
89
  - shared/flavor/flay/recipes/cookbook.rb
87
90
  - shared/flavor/flay/recipes/recipe.rb
88
91
  - shared/flavor/flay/resources/template.rb
92
+ - shared/flavor/flay/templates/default/LICENSE.erb
89
93
  - shared/flavor/flay/templates/default/README.md.erb
90
94
  - shared/flavor/flay/templates/default/kitchen.yml.erb
91
95
  - shared/flavor/flay/templates/default/metadata.rb.erb
@@ -1,6 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- gem "berkshelf", "~> 4.0"
4
- gem "chef", "~> 12.0"
5
- gem "chefspec", "~> 4.0"
6
- gem "rubocop", "~> 0.0"