chef-gen-flavors 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +4 -0
- data/History.md +8 -0
- data/Manifest.txt +7 -2
- data/README.md +13 -0
- data/chef-gen-flavors.gemspec +4 -4
- data/features/generate.feature +1 -1
- data/features/support/env.rb +1 -0
- data/lib/chef_gen/flavor_base.rb +9 -1
- data/lib/chef_gen/flavors.rb +1 -1
- data/lib/chef_gen/flavors/cucumber.rb +6 -0
- data/lib/chef_gen/flavors/cucumber/bundle.rb +4 -0
- data/lib/chef_gen/flavors/cucumber/chefdk.rb +3 -0
- data/lib/chef_gen/flavors/cucumber/kitchen.rb +4 -0
- data/{features/step_definitions → lib/chef_gen/flavors/cucumber}/knife.rb +1 -0
- data/lib/chef_gen/flavors/cucumber/rake.rb +14 -0
- data/lib/chef_gen/flavors/cucumber/regex.rb +3 -0
- data/lib/chef_gen/snippet/git_init.rb +2 -1
- data/spec/lib/chef_gen/flavor_base_spec.rb +1 -1
- metadata +9 -4
- data/features/step_definitions/chef.rb +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f72906ef7e1128c8a165ff27e2552452e9dff66d
|
4
|
+
data.tar.gz: 52ff5b57d993cd32c412f05f74ad8f407b308d64
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 44a3d2d8706036b51de5769e26e8746e9a404949d6735563ddc7c23989aeac9dd13041f01fa09fc1a98fe5c1e73e73bed1a1282c381eeccd5227c3ffa4aa938c
|
7
|
+
data.tar.gz: 9350287247b69bcf12a3a80b7099c9cf965b2ca9cff1956958c80b08ce0cba13133d318a7cb8872a9ce22b80ba7f322c6bbff88d6d82c4b9f2b21a1560cd7ad4
|
data/.rubocop.yml
CHANGED
data/History.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# Changelog for chef-gen-template
|
2
2
|
|
3
|
+
## 0.5.0
|
4
|
+
|
5
|
+
* provide some helpful Aruba step definitions for flavors to use in feature tests
|
6
|
+
|
7
|
+
## 0.4.1
|
8
|
+
|
9
|
+
* declare the target path 'directory' before running snippets, which fixes the GitInit snippet trying to run in a directory that hasn't been created yet
|
10
|
+
|
3
11
|
## 0.4.0
|
4
12
|
|
5
13
|
* added a GitInit snippet that runs 'git init .'
|
data/Manifest.txt
CHANGED
@@ -10,12 +10,17 @@ README.md
|
|
10
10
|
Rakefile
|
11
11
|
chef-gen-flavors.gemspec
|
12
12
|
features/generate.feature
|
13
|
-
features/step_definitions/chef.rb
|
14
|
-
features/step_definitions/knife.rb
|
15
13
|
features/support/env.rb
|
16
14
|
lib/chef_gen/flavor.rb
|
17
15
|
lib/chef_gen/flavor_base.rb
|
18
16
|
lib/chef_gen/flavors.rb
|
17
|
+
lib/chef_gen/flavors/cucumber.rb
|
18
|
+
lib/chef_gen/flavors/cucumber/bundle.rb
|
19
|
+
lib/chef_gen/flavors/cucumber/chefdk.rb
|
20
|
+
lib/chef_gen/flavors/cucumber/kitchen.rb
|
21
|
+
lib/chef_gen/flavors/cucumber/knife.rb
|
22
|
+
lib/chef_gen/flavors/cucumber/rake.rb
|
23
|
+
lib/chef_gen/flavors/cucumber/regex.rb
|
19
24
|
lib/chef_gen/snippet/attributes.rb
|
20
25
|
lib/chef_gen/snippet/chef_spec.rb
|
21
26
|
lib/chef_gen/snippet/cookbook_base.rb
|
data/README.md
CHANGED
@@ -291,6 +291,19 @@ like this:
|
|
291
291
|
end
|
292
292
|
end
|
293
293
|
|
294
|
+
## FEATURE TESTING FLAVORS
|
295
|
+
|
296
|
+
chef-gen-flavors provides a number of useful step definitions for Aruba (a CLI
|
297
|
+
driver for Cucumber) to make it easier to test flavors. To access these definitions,
|
298
|
+
add the following line to your `features/support/env.rb` file:
|
299
|
+
|
300
|
+
require 'chef_gen/flavors/cucumber'
|
301
|
+
|
302
|
+
For an example of how to use these steps in your features, refer to the reference
|
303
|
+
implementation of a flavor: [chef-gen-flavor-example](https://github.com/Nordstrom/chef-gen-flavor-example).
|
304
|
+
|
305
|
+
Documentation for the steps themselves is in the file `ARUBA_STEPS.md`
|
306
|
+
|
294
307
|
## AUTHOR
|
295
308
|
|
296
309
|
James FitzGibbon - james.i.fitzgibbon@nordstrom.com - Nordstrom, Inc.
|
data/chef-gen-flavors.gemspec
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
# stub: chef-gen-flavors 0.
|
2
|
+
# stub: chef-gen-flavors 0.5.0.20150518085211 ruby lib
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "chef-gen-flavors"
|
6
|
-
s.version = "0.
|
6
|
+
s.version = "0.5.0.20150518085211"
|
7
7
|
|
8
8
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
9
9
|
s.require_paths = ["lib"]
|
10
10
|
s.authors = ["James FitzGibbon"]
|
11
|
-
s.date = "2015-05-
|
11
|
+
s.date = "2015-05-18"
|
12
12
|
s.description = "chef-gen-flavors is a framework for creating custom templates for the\n'chef generate' command provided by ChefDK.\n\nThis gem simply provides a framework; templates are provided by separate\ngems, which you can host privately for use within your organization or\npublicly for the Chef community to use.\n\nAt present this is focused primarily on providing templates for generation of\ncookbooks, as this is where most organization-specific customization takes place.\nSupport for the other artifacts that ChefDK can generate may work, but is not\nthe focus of early releases."
|
13
13
|
s.email = ["james.i.fitzgibbon@nordstrom.com"]
|
14
14
|
s.extra_rdoc_files = ["History.md", "Manifest.txt", "README.md"]
|
15
|
-
s.files = [".rspec", ".rubocop.yml", ".travis.yml", "Gemfile", "Guardfile", "History.md", "LICENSE", "Manifest.txt", "README.md", "Rakefile", "chef-gen-flavors.gemspec", "features/generate.feature", "features/
|
15
|
+
s.files = [".rspec", ".rubocop.yml", ".travis.yml", "Gemfile", "Guardfile", "History.md", "LICENSE", "Manifest.txt", "README.md", "Rakefile", "chef-gen-flavors.gemspec", "features/generate.feature", "features/support/env.rb", "lib/chef_gen/flavor.rb", "lib/chef_gen/flavor_base.rb", "lib/chef_gen/flavors.rb", "lib/chef_gen/flavors/cucumber.rb", "lib/chef_gen/flavors/cucumber/bundle.rb", "lib/chef_gen/flavors/cucumber/chefdk.rb", "lib/chef_gen/flavors/cucumber/kitchen.rb", "lib/chef_gen/flavors/cucumber/knife.rb", "lib/chef_gen/flavors/cucumber/rake.rb", "lib/chef_gen/flavors/cucumber/regex.rb", "lib/chef_gen/snippet/attributes.rb", "lib/chef_gen/snippet/chef_spec.rb", "lib/chef_gen/snippet/cookbook_base.rb", "lib/chef_gen/snippet/example_file.rb", "lib/chef_gen/snippet/example_template.rb", "lib/chef_gen/snippet/git_init.rb", "lib/chef_gen/snippet/recipes.rb", "lib/chef_gen/snippet/resource_provider.rb", "lib/chef_gen/snippet/standard_ignore.rb", "lib/chef_gen/snippet/style_rubocop.rb", "lib/chef_gen/snippet/test_kitchen.rb", "lib/chef_gen/snippets.rb", "spec/lib/chef_gen/flavor_base_spec.rb", "spec/lib/chef_gen/flavors_spec.rb", "spec/lib/chef_gen/snippet/attributes_spec.rb", "spec/lib/chef_gen/snippet/chef_spec_spec.rb", "spec/lib/chef_gen/snippet/cookbook_base_spec.rb", "spec/lib/chef_gen/snippet/example_file_spec.rb", "spec/lib/chef_gen/snippet/example_template_spec.rb", "spec/lib/chef_gen/snippet/git_init_spec.rb", "spec/lib/chef_gen/snippet/recipes_spec.rb", "spec/lib/chef_gen/snippet/resource_provider_spec.rb", "spec/lib/chef_gen/snippet/standard_ignore_spec.rb", "spec/lib/chef_gen/snippet/style_rubocop_spec.rb", "spec/lib/chef_gen/snippet/test_kitchen_spec.rb", "spec/spec_helper.rb", "spec/support/fixtures/code_generator/metadata.rb", "spec/support/fixtures/code_generator/recipes/cookbook.rb", "spec/support/fixtures/code_generator_2/metadata.rb", "spec/support/fixtures/code_generator_2/recipes/cookbook.rb", "spec/support/fixtures/code_generator_2/templates/default/README_md.erb", "spec/support/fixtures/lib/chef_gen/flavor/bar.rb", "spec/support/fixtures/lib/chef_gen/flavor/baz.rb", "spec/support/fixtures/lib/chef_gen/flavor/foo.rb"]
|
16
16
|
s.homepage = "https://github.com/Nordstrom/chef-gen-flavors"
|
17
17
|
s.licenses = ["apache2"]
|
18
18
|
s.rdoc_options = ["--main", "README.md"]
|
data/features/generate.feature
CHANGED
@@ -10,7 +10,7 @@ Feature: chef generate
|
|
10
10
|
|----------------|----------------------------------|
|
11
11
|
| CHEFGEN_FLAVOR | bar |
|
12
12
|
| RUBYLIB | ../../spec/support/fixtures/lib |
|
13
|
-
When I generate a cookbook named
|
13
|
+
When I generate a cookbook named "foo"
|
14
14
|
Then the exit status should be 0
|
15
15
|
And the output should match /using ChefGen flavor 'bar'/
|
16
16
|
And the output should match /Recipe: code_generator_2::cookbook/
|
data/features/support/env.rb
CHANGED
data/lib/chef_gen/flavor_base.rb
CHANGED
@@ -64,7 +64,7 @@ module ChefGen
|
|
64
64
|
# set defaults
|
65
65
|
@report_actions = true
|
66
66
|
@fail_on_clobber = !ctx.respond_to?(:clobber)
|
67
|
-
@directories = [
|
67
|
+
@directories = []
|
68
68
|
%w(files files_if_missing templates templates_if_missing
|
69
69
|
chefignore_files gitignore_files actions_taken failures)
|
70
70
|
.each do |varname|
|
@@ -81,6 +81,7 @@ module ChefGen
|
|
81
81
|
# generates the Chef resources that the plugin has declared
|
82
82
|
# @return [void]
|
83
83
|
def generate
|
84
|
+
add_target_path
|
84
85
|
run_snippets
|
85
86
|
add_directories
|
86
87
|
add_files
|
@@ -108,6 +109,13 @@ module ChefGen
|
|
108
109
|
|
109
110
|
private
|
110
111
|
|
112
|
+
# creates a directory resource for the target
|
113
|
+
# @return [void]
|
114
|
+
def add_target_path
|
115
|
+
@recipe.send(:directory, @target_path)
|
116
|
+
@actions_taken << "create directory #{@target_path}"
|
117
|
+
end
|
118
|
+
|
111
119
|
# find all public methods of the plugin starting with snippet_
|
112
120
|
# and calls them
|
113
121
|
# @return [void]
|
data/lib/chef_gen/flavors.rb
CHANGED
@@ -0,0 +1,14 @@
|
|
1
|
+
Given(/^I run a style test$/) do
|
2
|
+
unset_bundler_env_vars
|
3
|
+
run_simple 'bundle exec rake style', true, 10
|
4
|
+
end
|
5
|
+
|
6
|
+
Given(/^I run a unit test$/) do
|
7
|
+
unset_bundler_env_vars
|
8
|
+
run_simple 'bundle exec rake spec', true, 10
|
9
|
+
end
|
10
|
+
|
11
|
+
Given(/^I list the rake tasks$/) do
|
12
|
+
unset_bundler_env_vars
|
13
|
+
run_simple 'bundle exec rake -T'
|
14
|
+
end
|
@@ -8,9 +8,10 @@ module ChefGen
|
|
8
8
|
# @return [void]
|
9
9
|
def snippet_gitinit(recipe)
|
10
10
|
c = generator_context
|
11
|
+
target_path = @target_path
|
11
12
|
recipe.send(:execute, 'initialize git repo') do
|
12
13
|
command('git init .')
|
13
|
-
cwd
|
14
|
+
cwd target_path
|
14
15
|
end if c.have_git && !c.skip_git_init
|
15
16
|
end
|
16
17
|
end
|
@@ -130,7 +130,7 @@ RSpec.describe ChefGen::FlavorBase do
|
|
130
130
|
end
|
131
131
|
|
132
132
|
it 'calls mixin methods' do
|
133
|
-
expect(@recipe).to receive(:directory).with(
|
133
|
+
expect(@recipe).to receive(:directory).with(/foo$/)
|
134
134
|
expect(@recipe).to receive(:directory).with(%r{foo/bar$})
|
135
135
|
template = ChefGen::Flavor::Amazing.new(@recipe)
|
136
136
|
template.extend ChefGen::Snippet::Bar
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chef-gen-flavors
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James FitzGibbon
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: little-plugger
|
@@ -267,12 +267,17 @@ files:
|
|
267
267
|
- Rakefile
|
268
268
|
- chef-gen-flavors.gemspec
|
269
269
|
- features/generate.feature
|
270
|
-
- features/step_definitions/chef.rb
|
271
|
-
- features/step_definitions/knife.rb
|
272
270
|
- features/support/env.rb
|
273
271
|
- lib/chef_gen/flavor.rb
|
274
272
|
- lib/chef_gen/flavor_base.rb
|
275
273
|
- lib/chef_gen/flavors.rb
|
274
|
+
- lib/chef_gen/flavors/cucumber.rb
|
275
|
+
- lib/chef_gen/flavors/cucumber/bundle.rb
|
276
|
+
- lib/chef_gen/flavors/cucumber/chefdk.rb
|
277
|
+
- lib/chef_gen/flavors/cucumber/kitchen.rb
|
278
|
+
- lib/chef_gen/flavors/cucumber/knife.rb
|
279
|
+
- lib/chef_gen/flavors/cucumber/rake.rb
|
280
|
+
- lib/chef_gen/flavors/cucumber/regex.rb
|
276
281
|
- lib/chef_gen/snippet/attributes.rb
|
277
282
|
- lib/chef_gen/snippet/chef_spec.rb
|
278
283
|
- lib/chef_gen/snippet/cookbook_base.rb
|