kitchen-cabinet 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 3d58227e726c5b26286ae825e07f5713753491e7
4
+ data.tar.gz: b573cdb8c5753e37a9db8165d9bcc4c1711c2c27
5
+ SHA512:
6
+ metadata.gz: f821af56fdb1e45ab1a9188fc90b1f3a1fa435b8b40f9b907669caee2e0e1b9be2a0ba20a4d9333b762b13d3fe051bd0daa0e12fb307c55d5dcf71fbf97cbd59
7
+ data.tar.gz: d1eb4145f93c8c0bc02031d38439d14e04697bf0935fcd55b37ed94ec4366b493e11cdedf13186822e339ea742a27646ba4faa80260d9a023b1927b2d9db4364
data/.gitignore ADDED
@@ -0,0 +1,18 @@
1
+ *~
2
+ *#
3
+ .#*
4
+ \#*#
5
+ .*.sw[a-z]
6
+ *.un~
7
+ vendor
8
+
9
+ # Bundler
10
+ Gemfile.lock
11
+ bin/*
12
+ .bundle/*
13
+
14
+ .idea/
15
+ .DS_Store
16
+
17
+ tmp/*
18
+ pkg/*
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format progress
data/.rubocop.yml ADDED
@@ -0,0 +1,16 @@
1
+ AllCops:
2
+ Excludes:
3
+ - test/**
4
+ - vendor/**
5
+ - ruby/**
6
+
7
+ AlignParameters:
8
+ Enabled: false
9
+ Encoding:
10
+ Enabled: false
11
+ HashSyntax:
12
+ Enabled: false
13
+ LineLength:
14
+ Enabled: false
15
+ MethodLength:
16
+ Max: 30
data/.travis.yml ADDED
@@ -0,0 +1,9 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 2.0.0
5
+ - 2.1.0
6
+ bundler_args: --without integration development
7
+ script:
8
+ - bundle exec rubocop
9
+ - bundle exec rspec
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## v1.1.1:
2
+
3
+ * Refactored code
4
+ * added -u option to update cookbooks[beta]
5
+ * Initial public release
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,63 @@
1
+ # Contributing to OneHealth Projects
2
+
3
+ We are glad you want to contribute to OneHealth projects! The first
4
+ step is the desire to improve the project.
5
+
6
+ ## Quick-contribute
7
+
8
+ * Create an issue on the github [issue tracker](https://github.com/onehealth/kitchen-cabinet/issues)
9
+ * Link to your patch as a rebased git branch or pull request from the ticket
10
+
11
+ We regularly review contributions and will get back to you if we have
12
+ any suggestions or concerns.
13
+
14
+ ### Branches and Commits
15
+
16
+ You should submit your patch as a git branch named after the change.
17
+
18
+ It is a best practice to have your commit message have a _summary
19
+ line_, followed by an empty line and then a brief description of
20
+ the commit. This also helps other contributors understand the
21
+ purpose of changes to the code.
22
+
23
+ Remember that not all users use ruby in the same way or on the same
24
+ operating systems as you, so it is helpful to be clear about your use
25
+ case and change so they can understand it even when it doesn't apply
26
+ to them.
27
+
28
+ ### Github and Pull Requests
29
+
30
+ We don't require you to use Github, and we will even take patch diffs
31
+ attached to tickets on the issue tracker. However Github has a lot of
32
+ convenient features, such as being able to see a diff of changes
33
+ between a pull request and the main repository quickly without
34
+ downloading the branch.
35
+
36
+ ## Functional and Unit Tests
37
+
38
+ If any don't pass, investigate them before submitting your patch.
39
+
40
+ Any new feature should have unit tests included with the patch with
41
+ good code coverage to help protect it from future changes. Similarly,
42
+ patches that fix a bug or regression should have a _regression test_.
43
+ Simply put, this is a test that would fail without your patch but
44
+ passes with it. The goal is to ensure this bug doesn't regress in the
45
+ future. Consider a regular expression that doesn't match a certain
46
+ pattern that it should, so you provide a patch and a test to ensure
47
+ that the part of the code that uses this regular expression works as
48
+ expected. Later another contributor may modify this regular expression
49
+ in a way that breaks your use cases. The test you wrote will fail,
50
+ signalling to them to research your ticket and use case and accounting
51
+ for it.
52
+
53
+ Please do ensure that your changes do not break or modify behavior for
54
+ other platforms supported by the gem. For example if your changes
55
+ are for Debian, make sure that they do not break on CentOS.
56
+
57
+ Please do not modify the version number, the maintainer will select
58
+ the appropriate version based on the release cycle information above.
59
+
60
+ Please do not update the CHANGELOG.md for a new version. Not all
61
+ changes to a gem may be merged and released in the same versions.
62
+ OneHealth will update the CHANGELOG.md when releasing a new version of
63
+ the gem.
data/Gemfile ADDED
@@ -0,0 +1,33 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'berkshelf', '~> 2.0.14'
4
+ gem 'chef', '~> 11.8'
5
+
6
+ group :unit do
7
+ gem 'foodcritic', '~> 3.0'
8
+ gem 'rubocop', '~> 0.18.0'
9
+ gem 'chefspec', '~> 3.2.0'
10
+ end
11
+
12
+ group :integration do
13
+ gem 'test-kitchen', '~> 1.1'
14
+ gem 'kitchen-vagrant'
15
+ end
16
+
17
+ group :release do
18
+ gem 'strainer', '~> 3.3.0'
19
+ gem 'stove', '~> 1.1'
20
+ gem 'rspec_junit_formatter'
21
+ gem 'rubocop-checkstyle_formatter'
22
+ end
23
+
24
+ group :development do
25
+ gem 'guard', '~> 1.8'
26
+ gem 'guard-rubocop', '~> 0.2'
27
+ gem 'guard-foodcritic', '~> 1.0'
28
+ gem 'guard-kitchen', '~> 0.0'
29
+ gem 'guard-rspec', '~> 3.0'
30
+ gem 'rb-fsevent', :require => false
31
+ gem 'rb-inotify', :require => false
32
+ gem 'terminal-notifier-guard', :require => false
33
+ end
data/Guardfile ADDED
@@ -0,0 +1,12 @@
1
+ # More info at https://github.com/guard/guard#readme
2
+
3
+ guard :rubocop do
4
+ watch(%r{.+\.rb$})
5
+ watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
6
+ end
7
+
8
+ guard :rspec, cmd: 'bundle exec rspec', :all_on_start => false do
9
+ watch(%r{^spec/(.+)_spec\.rb$})
10
+ watch(%r{^(recipes)/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
11
+ watch('spec/spec_helper.rb') { 'spec' }
12
+ end
data/README.md ADDED
@@ -0,0 +1,154 @@
1
+ ## kitchen-cabinet
2
+ ----
3
+
4
+ About
5
+ =====
6
+
7
+ Inspiration for this gem was taken from [meez](https://github.com/paulczar/meez). It creates an opinionated cookbook complete with testing suites.
8
+
9
+ Once `cabinet` has finished running, you will have a new cookbook complete with an initialized git repo, chefspec, serverspec, strainer, test-kitchen, guard (with notifications via inotify/fsevent/guard-terminal-notify), rubocop, foodcritic, berkshelf, and stove.
10
+
11
+ It will automatically create a Gemfile for you with different groups set up for development, testing, etc:
12
+
13
+ `````` ruby
14
+ source 'https://rubygems.org'
15
+
16
+ gem 'berkshelf', '~> 2.0.13'
17
+
18
+ group :unit do
19
+ gem 'foodcritic', '~> 3.0'
20
+ gem 'rubocop', '~> 0.18.0'
21
+ gem 'chefspec', '~> 3.2.0'
22
+ end
23
+
24
+ group :integration do
25
+ gem 'test-kitchen', '~> 1.1'
26
+ gem 'kitchen-vagrant'
27
+ end
28
+
29
+ group :release do
30
+ gem 'stove', '~> 1.1.2'
31
+ end
32
+
33
+ group :development do
34
+ gem 'strainer', '~> 3.3.0'
35
+ gem 'serverspec', '~> 0.14.2'
36
+ gem 'guard', '~> 1.8'
37
+ gem 'guard-rubocop', '~> 0.2'
38
+ gem 'guard-foodcritic', '~> 1.0'
39
+ gem 'guard-kitchen', '~> 0.0'
40
+ gem 'guard-rspec', '~> 3.0'
41
+ gem 'rb-fsevent', :require => false
42
+ gem 'rb-inotify', :require => false
43
+ gem 'terminal-notifier-guard', :require => false
44
+ end
45
+ ``````
46
+
47
+ The goal of this project is to prevent any manual setup of the cookbook environment. We used to copy Gemfiles and other configurations from cookbook to cookbook, making changes as needed. That quickly gets messy as things get out of date! With `cabinet`, every project starts with the same templated base.
48
+
49
+ Install
50
+ =======
51
+
52
+ `gem install kitchen-cabinet`
53
+
54
+ Usage
55
+ =====
56
+
57
+ ```
58
+ Usage: cabinet [options] <cookbook name>
59
+
60
+ Options
61
+ -o, --cookbook-path USERNAME The directory where the cookbook will be created
62
+ -C, --copyright COPYRIGHT_HOLDER The name of the copyright holder.
63
+ -I, --license LICENSE The type of license under which a cookbook is distributed: apachev2, gplv2, gplv3, mit, or none (default).
64
+ -m, --email EMAIL The email address for the individual who maintains the cookbook.
65
+ -u, --update This flag allows you the option to update an existing cookbook[beta]
66
+ -h, --help help
67
+ ```
68
+
69
+ ### Example
70
+
71
+ `````` bash
72
+ ➜ ~ cabinet --cookbook-path ~/Desktop -C Taylor Price -I apachev2 -m tprice@onehealth.com test-cookbook
73
+ * Initializing chef
74
+ ** Creating cookbook test-cookbook
75
+ ** Creating README for cookbook: test-cookbook
76
+ ** Creating CHANGELOG for cookbook: test-cookbook
77
+ ** Creating metadata for cookbook: test-cookbook
78
+ Rewriting metadata.rb
79
+ Rewriting recipes/default.rb
80
+ * Initializing knife
81
+ * Initializing git
82
+ * Initializing berkshelf
83
+ create Desktop/test-cookbook/Berksfile
84
+ create Desktop/test-cookbook/Thorfile
85
+ create Desktop/test-cookbook/.gitignore
86
+ run git init from "./Desktop/test-cookbook"
87
+ create Desktop/test-cookbook/Gemfile
88
+ * Initializing kitchen
89
+ create .kitchen.yml
90
+ append Thorfile
91
+ create test/integration/default
92
+ append Gemfile
93
+ append Gemfile
94
+ You must run `bundle install' to fetch any new gems.
95
+ * Initializing guard
96
+ * Initializing chefspec
97
+ * Initializing strainer
98
+ * Initializing rubocop
99
+ * Initializing foodcritic
100
+ * Initializing serverspec
101
+ * Initializing stove
102
+ this is the test-cookbook cookbook.
103
+ Cookbook test-cookbook created successfully
104
+ Next steps...
105
+ $ cd /Users/tprice/Desktop/test-cookbook
106
+ $ bundle install
107
+ $ bundle exec berks install
108
+ $ bundle exec strainer test
109
+
110
+ ➜ cd ~/Desktop/test-cookbook
111
+ ➜ bundle install
112
+ Fetching gem metadata from https://rubygems.org/
113
+ Fetching additional metadata from https://rubygems.org/
114
+ Resolving dependencies...
115
+ ...
116
+ ...
117
+ Your bundle is complete!
118
+ ➜ bundle exec berks install
119
+ Using test (0.1.0) from metadata
120
+ ➜ bundle exec strainer test
121
+ ...
122
+ ...
123
+ ``````
124
+
125
+ And so on!
126
+
127
+ Contributing
128
+ -------------------
129
+ Please look at the CONTRIBUTING.md file for contribution guidelines.
130
+
131
+ License and Authors
132
+ -------------------
133
+
134
+ Authors:
135
+ ========
136
+
137
+ Taylor Price - tprice@onehealth.com
138
+
139
+ License:
140
+ ========
141
+
142
+ Copyright 2014 OneHealth Solutions, Inc.
143
+
144
+ Licensed under the Apache License, Version 2.0 (the "License");
145
+ you may not use this file except in compliance with the License.
146
+ You may obtain a copy of the License at
147
+
148
+ http://www.apache.org/licenses/LICENSE-2.0
149
+
150
+ Unless required by applicable law or agreed to in writing, software
151
+ distributed under the License is distributed on an "AS IS" BASIS,
152
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
153
+ See the License for the specific language governing permissions and
154
+ limitations under the License.
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/bin/cabinet ADDED
@@ -0,0 +1,83 @@
1
+ #!/usr/bin/env ruby
2
+ # Encoding: utf-8
3
+
4
+ $LOAD_PATH.unshift(File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib')))
5
+
6
+ require 'optparse'
7
+ require 'kitchen-cabinet/cabinet'
8
+ require 'fileutils'
9
+
10
+ options = {}
11
+
12
+ opt_parser = OptionParser.new do |opt|
13
+ opt.banner = 'Usage: cabinet [options] <cookbook name>'
14
+ opt.separator ''
15
+ opt.separator 'Options'
16
+ opt.on('-o', '--cookbook-path PATH', 'The directory where the cookbook will be created') do |path|
17
+ options[:path] = path
18
+ end
19
+ opt.on('-C', '--copyright COPYRIGHT_HOLDER', 'The name of the copyright holder.') do |copyright|
20
+ options[:copyright] = copyright
21
+ end
22
+ opt.on('-I', '--license LICENSE', 'The type of license under which a cookbook is distributed: apachev2, gplv2, gplv3, mit, or none (default).') do |license|
23
+ options[:license] = license
24
+ end
25
+ opt.on('-m', '--email EMAIL', 'The email address for the individual who maintains the cookbook.') do |email|
26
+ options[:email] = email
27
+ end
28
+ opt.on('-u', '--update', "Update the Gemfile, Chefignore, Guardfile (and other config files that don't change much) of an existing project") do
29
+ options[:update] = true
30
+ end
31
+ opt.on('-h', '--help', 'help') do
32
+ options[:help] = true
33
+ puts opt_parser
34
+ exit
35
+ end
36
+ end
37
+
38
+ opt_parser.parse!
39
+
40
+ if ARGV.empty?
41
+ puts opt_parser
42
+ exit
43
+ end
44
+
45
+ cookbook_name = ARGV.pop
46
+
47
+ def opt_error(message, opt_parser)
48
+ puts ''
49
+ puts message
50
+ puts ''
51
+ puts opt_parser
52
+ exit
53
+ end
54
+
55
+ if options[:path].respond_to?(:to_str)
56
+ path = File.join(options[:path], cookbook_name)
57
+ else
58
+ puts opt_error('Specify a path!', opt_parser)
59
+ end
60
+
61
+ if options[:update]
62
+ opt_error("You need to create #{cookbook_name} first!") unless File.exists?(path)
63
+ unless options[:path].respond_to?(:to_str) && (cookbook_name.is_a? String)
64
+ opt_error('Make sure you specify -o and a cookbook name!', opt_parser)
65
+ end
66
+ if cookbook_name
67
+ puts "Updating #{cookbook_name}..."
68
+ puts 'Gemfile, Chefignore, and Guardfile are up to date.'
69
+ Cabinet.update_cookbook(cookbook_name, options, path)
70
+ exit
71
+ else
72
+ opt_error('Define a path with `-o` and a cookbook name!', opt_parser)
73
+ end
74
+ elsif cookbook_name
75
+ Cabinet.init(cookbook_name, options, path)
76
+ puts "Cookbook #{cookbook_name} created successfully"
77
+ puts 'Next steps...'
78
+ puts " $ cd #{File.join(options[:path], cookbook_name)}"
79
+ puts ' $ bundle install'
80
+ puts ' $ bundle exec berks install'
81
+ puts ' $ bundle exec strainer test'
82
+ exit
83
+ end
@@ -0,0 +1,30 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = "kitchen-cabinet"
3
+ s.version = '1.1.1'
4
+ s.date = Time.now.strftime("%Y-%m-%d")
5
+ s.homepage = 'https://github.com/onehealth/kitchen-cabinet'
6
+ s.summary = 'Initializes a chef cookbook repo with relevant tools'
7
+ s.description = <<EOF
8
+ `kitchen-cabinet` will create a chef cookbook skeleton complete with testing suite including:
9
+ berkshelf, chefspec, test kitchen, strainer, foodcritic, rubocop, serverspec, stove, and guard. It also creates a gemfile suitable for use in CI.
10
+
11
+ EOF
12
+ s.authors = ['Taylor Price']
13
+ s.email = 'tprice@onehealth.com'
14
+ s.license = 'apachev2'
15
+
16
+ s.required_ruby_version = '>= 1.9.3'
17
+ s.require_paths = ['lib']
18
+ s.test_files = s.files.grep(%r{^(test|spec|features)/})
19
+ s.files = `git ls-files`.split($/)
20
+ s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
21
+
22
+ s.add_runtime_dependency 'chef', '~> 11.8', '>= 11.8.0'
23
+ s.add_runtime_dependency 'test-kitchen', '~> 1.1', '>= 1.1.1'
24
+ s.add_runtime_dependency 'bundler', '~> 1.5', '>= 1.5.1'
25
+ s.add_runtime_dependency 'berkshelf', '~> 2.0', '>= 2.0.12'
26
+ s.add_runtime_dependency 'git', '~> 1.2', '>= 1.2.6'
27
+ s.add_runtime_dependency 'erubis', '~> 2.7', '>= 2.7.0'
28
+ s.add_development_dependency 'rspec', '~> 2.14', '>= 2.14.1'
29
+ s.add_development_dependency 'rake', '~> 10.1', '>= 10.1.1'
30
+ end
@@ -0,0 +1,111 @@
1
+ #!/usr/bin/env ruby
2
+ # Encoding: utf-8
3
+
4
+ # Cabinet helps create and maintain cookbooks
5
+ # complete with an opinionated testing suite.
6
+ class Cabinet
7
+ require 'fileutils'
8
+ require 'erubis'
9
+ def self.init(cookbook_name, options, path)
10
+ init_chef(cookbook_name, options, path)
11
+ init_git(cookbook_name, options, path)
12
+ init_berkshelf(cookbook_name, options, path)
13
+ init_kitchen(cookbook_name, options, path)
14
+ init_chefspec(cookbook_name, options, path)
15
+ init_serverspec(cookbook_name, options, path)
16
+ write_configs(cookbook_name, options, path)
17
+ end
18
+
19
+ def self.init_chef(cookbook_name, options, path)
20
+ tool = 'chef'
21
+ puts "* Initializing #{tool}"
22
+ require 'chef/knife/cookbook_create'
23
+ create_cookbook = Chef::Knife::CookbookCreate.new
24
+ create_cookbook.name_args = [cookbook_name]
25
+ create_cookbook.config[:cookbook_path] = options[:path]
26
+ create_cookbook.config[:cookbook_copyright] = options[:copyright] || 'YOUR_COMPANY_NAME'
27
+ create_cookbook.config[:cookbook_license] = options[:license] || 'YOUR_EMAIL'
28
+ create_cookbook.config[:cookbook_email] = options[:email] || 'none'
29
+ create_cookbook.run
30
+ %w{ metadata.rb recipes/default.rb }.each do |file|
31
+ puts "\tRewriting #{file}"
32
+ contents = "\# Encoding: utf-8\n#{File.read(File.join(path, file))}"
33
+ File.open(File.join(path, file), 'w') { |f| f.write(contents) }
34
+ end
35
+ end
36
+
37
+ def self.init_git(cookbook_name, options, path)
38
+ tool = 'git'
39
+ puts "* Initializing #{tool}"
40
+ require 'git'
41
+ Git.init(path, repository: path)
42
+ end
43
+
44
+ def self.init_berkshelf(cookbook_name, options, path)
45
+ tool = 'berkshelf'
46
+ puts "* Initializing #{tool}"
47
+ require 'berkshelf'
48
+ require 'berkshelf/base_generator'
49
+ require 'berkshelf/init_generator'
50
+ Berkshelf::InitGenerator.new(
51
+ [path],
52
+ skip_test_kitchen: true,
53
+ skip_vagrant: true
54
+ ).invoke_all
55
+ end
56
+
57
+ def self.init_kitchen(cookbook_name, options, path)
58
+ tool = 'kitchen'
59
+ puts "* Initializing #{tool}"
60
+ require 'kitchen'
61
+ require 'kitchen/generator/init'
62
+ Kitchen::Generator::Init.new([], {}, destination_root: path).invoke_all
63
+ end
64
+
65
+ def self.init_chefspec(cookbook_name, options, path)
66
+ tool = 'chefspec'
67
+ puts "* Initializing #{tool}"
68
+ spec_path = File.join(path, 'spec')
69
+ FileUtils.mkdir_p(spec_path)
70
+ @spec = %w(spec_helper.rb default_spec.rb)
71
+ @spec.each do |spec|
72
+ spec_path = File.join(path, 'spec')
73
+ tname = File.read(File.join(File.dirname(File.expand_path(__FILE__)), "templates/chefspec/#{spec}.eruby"))
74
+ eruby = Erubis::Eruby.new(tname)
75
+ File.open(File.join(spec_path, "#{spec}"), 'w') { |f| f.write(eruby.result(:cookbook_name => cookbook_name)) }
76
+ end
77
+ end
78
+
79
+ def self.init_serverspec(cookbook_name, options, path)
80
+ tool = 'serverspec'
81
+ puts "* Initializing #{tool}"
82
+ spec_path = File.join(path, 'test', 'integration', 'default', 'serverspec')
83
+ FileUtils.mkdir_p(spec_path)
84
+ @spec = %w(spec_helper.rb default_spec.rb)
85
+ @spec.each do |spec|
86
+ spec_path = File.join(path, 'spec')
87
+ tname = File.read(File.join(File.dirname(File.expand_path(__FILE__)), "templates/serverspec/#{spec}.eruby"))
88
+ eruby = Erubis::Eruby.new(tname)
89
+ File.open(File.join(spec_path, "#{spec}"), 'w') { |f| f.write(eruby.result(:cookbook_name => cookbook_name)) }
90
+ end
91
+ end
92
+
93
+ def self.write_configs(cookbook_name, options, path)
94
+ @template = %w(chefignore .gitignore Gemfile Berksfile .kitchen.yml Guardfile Strainerfile .rubocop.yml)
95
+ puts 'this is the ' + cookbook_name + ' cookbook.'
96
+ @template.each do |template|
97
+ tname = File.read(File.join(File.dirname(File.expand_path(__FILE__)), "templates/#{template}.eruby"))
98
+ eruby = Erubis::Eruby.new(tname)
99
+ File.open(File.join(path, "#{template}"), 'w') { |f| f.write(eruby.result(:cookbook_name => cookbook_name)) }
100
+ end
101
+ end
102
+
103
+ def self.update_cookbook(cookbook_name, options, path)
104
+ @template = %w(chefignore Gemfile Guardfile Strainerfile .rubocop.yml)
105
+ @template.each do |template|
106
+ tname = File.read(File.join(File.dirname(File.expand_path(__FILE__)), "templates/#{template}.eruby"))
107
+ eruby = Erubis::Eruby.new(tname)
108
+ File.open(File.join(path, "#{template}"), 'w') { |f| f.write(eruby.result(:cookbook_name => cookbook_name)) }
109
+ end
110
+ end
111
+ end
@@ -0,0 +1,20 @@
1
+ .vagrant/
2
+ Berksfile.lock
3
+ *~
4
+ *#
5
+ .#*
6
+ \#*#
7
+ .*.sw[a-z]
8
+ *.un~
9
+ /cookbooks
10
+
11
+ # Bundler
12
+ Gemfile.lock
13
+ .bundle/*
14
+
15
+ # test-kitchen
16
+ .kitchen/
17
+ .kitchen.local.yml
18
+
19
+ # OS Files
20
+ .DS_Store
@@ -0,0 +1,51 @@
1
+ ---
2
+ driver:
3
+ name: vagrant
4
+
5
+ provisioner:
6
+ name: chef_solo
7
+ environments_path: "test/integration/environments"
8
+ data_bag_path: "test/integration/data_bags"
9
+ require_chef_omnibus: 11.8.2
10
+ solo_rb:
11
+ environment: test
12
+
13
+ platforms:
14
+ - name: canonical-ubuntu-12.04
15
+ driver_config:
16
+ box: canonical-ubuntu-12.04
17
+ box_url: https://cloud-images.ubuntu.com/vagrant/precise/current/precise-server-cloudimg-amd64-vagrant-disk1.box
18
+ run_list:
19
+ - recipe[or::default]
20
+
21
+ suites:
22
+ - name: default
23
+ run_list:
24
+ - recipe[<%= cookbook_name %>::default]
25
+ attributes:
26
+ or:
27
+ pkg:
28
+ ubuntu:
29
+ or: "http://mirrors.onehealth.com/or"
30
+ source: "http://mirrors.onehealth.com/ubuntu"
31
+ contact:
32
+ email: foobar@example.com
33
+ environment: "test"
34
+ cluster: "unknown"
35
+ realm: "unknown"
36
+ location: "cld"
37
+ default:
38
+ vhostdomain: "dev"
39
+ branch: "master"
40
+ apache:
41
+ version: "2.4"
42
+ or_social:
43
+ app_name: "social"
44
+ or_admin:
45
+ app_name: "admin"
46
+ or_callbacks:
47
+ app_name: "callbacks"
48
+ or_scache:
49
+ app_name: "scache"
50
+ camo:
51
+ key: "foo"
@@ -0,0 +1,15 @@
1
+ AllCops:
2
+ Excludes:
3
+ - test/**
4
+ - vendor/**
5
+
6
+ AlignParameters:
7
+ Enabled: false
8
+ Encoding:
9
+ Enabled: false
10
+ HashSyntax:
11
+ Enabled: false
12
+ LineLength:
13
+ Enabled: false
14
+ MethodLength:
15
+ Max: 30
@@ -0,0 +1,3 @@
1
+ site :opscode
2
+ chef_api :config
3
+ metadata
@@ -0,0 +1,31 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'berkshelf', '~> 2.0.13'
4
+
5
+ group :unit do
6
+ gem 'foodcritic', '~> 3.0'
7
+ gem 'rubocop', '~> 0.18.0'
8
+ gem 'chefspec', '~> 3.2.0'
9
+ end
10
+
11
+ group :integration do
12
+ gem 'test-kitchen', '~> 1.1'
13
+ gem 'kitchen-vagrant'
14
+ end
15
+
16
+ group :release do
17
+ gem 'stove', '~> 1.1.2'
18
+ end
19
+
20
+ group :development do
21
+ gem 'strainer', '~> 3.3.0'
22
+ gem 'serverspec', '~> 0.14.2'
23
+ gem 'guard', '~> 1.8'
24
+ gem 'guard-rubocop', '~> 0.2'
25
+ gem 'guard-foodcritic', '~> 1.0'
26
+ gem 'guard-kitchen', '~> 0.0'
27
+ gem 'guard-rspec', '~> 3.0'
28
+ gem 'rb-fsevent', :require => false
29
+ gem 'rb-inotify', :require => false
30
+ gem 'terminal-notifier-guard', :require => false
31
+ end
@@ -0,0 +1,29 @@
1
+ # More info at https://github.com/guard/guard#readme
2
+
3
+ guard 'kitchen' do
4
+ watch(%r{test/.+})
5
+ watch(%r{^recipes/(.+)\.rb$})
6
+ watch(%r{^attributes/(.+)\.rb$})
7
+ watch(%r{^files/(.+)})
8
+ watch(%r{^templates/(.+)})
9
+ watch(%r{^providers/(.+)\.rb})
10
+ watch(%r{^resources/(.+)\.rb})
11
+ end
12
+
13
+ guard :rubocop do
14
+ watch(%r{.+\.rb$})
15
+ watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
16
+ end
17
+
18
+ guard :foodcritic, :cli => "--epic-fail any --tags ~FC007 --tags ~FC015 --tags ~FC023", :cookbook_paths => ".", :all_on_start => false do
19
+ watch(%r{attributes/.+\.rb$})
20
+ watch(%r{providers/.+\.rb$})
21
+ watch(%r{recipes/.+\.rb$})
22
+ watch(%r{resources/.+\.rb$})
23
+ end
24
+
25
+ guard :rspec, cmd: 'bundle exec rspec', :all_on_start => false do
26
+ watch(%r{^spec/(.+)_spec\.rb$})
27
+ watch(%r{^(recipes)/(.+)\.rb$}) { |m| "spec/\#{m[1]}_spec.rb" }
28
+ watch('spec/spec_helper.rb') { 'spec' }
29
+ end
@@ -0,0 +1,5 @@
1
+ # Strainerfile
2
+ rubocop: bundle exec rubocop $COOKBOOK
3
+ foodcritic: bundle exec foodcritic -f any $SANDBOX/$COOKBOOK
4
+ chefspec: bundle exec rspec $SANDBOX/$COOKBOOK/test/unit/spec
5
+ knife test: bundle exec knife cookbook test $COOKBOOK
@@ -0,0 +1,99 @@
1
+ # Put files/directories that should be ignored in this file when uploading
2
+ # or sharing to the community site.
3
+ # Lines that start with '# ' are comments.
4
+
5
+ # OS generated files #
6
+ ######################
7
+ .DS_Store
8
+ Icon?
9
+ nohup.out
10
+ ehthumbs.db
11
+ Thumbs.db
12
+
13
+ # SASS #
14
+ ########
15
+ .sass-cache
16
+
17
+ # EDITORS #
18
+ ###########
19
+ \#*
20
+ .#*
21
+ *~
22
+ *.sw[a-z]
23
+ *.bak
24
+ REVISION
25
+ TAGS*
26
+ tmtags
27
+ *_flymake.*
28
+ *_flymake
29
+ *.tmproj
30
+ .project
31
+ .settings
32
+ mkmf.log
33
+
34
+ ## COMPILED ##
35
+ ##############
36
+ a.out
37
+ *.o
38
+ *.pyc
39
+ *.so
40
+ *.com
41
+ *.class
42
+ *.dll
43
+ *.exe
44
+ */rdoc/
45
+
46
+ # Testing #
47
+ ###########
48
+ .watchr
49
+ .rspec
50
+ spec/*
51
+ spec/fixtures/*
52
+ test/*
53
+ features/*
54
+ Guardfile
55
+ Procfile
56
+ .kitchen.yml
57
+ .kitchen/*
58
+ .rubocop.yml
59
+
60
+ # SCM #
61
+ #######
62
+ .git
63
+ */.git
64
+ .gitignore
65
+ .gitmodules
66
+ .gitconfig
67
+ .gitattributes
68
+ .svn
69
+ */.bzr/*
70
+ */.hg/*
71
+ */.svn/*
72
+
73
+ # Berkshelf #
74
+ #############
75
+ Berksfile
76
+ Berksfile.lock
77
+ cookbooks/*
78
+ tmp
79
+
80
+ # Cookbooks #
81
+ #############
82
+ CONTRIBUTING
83
+ CHANGELOG*
84
+
85
+ # Strainer #
86
+ ############
87
+ Colanderfile
88
+ Strainerfile
89
+ .colander
90
+ .strainer
91
+
92
+ # Vagrant #
93
+ ###########
94
+ .vagrant
95
+ Vagrantfile
96
+
97
+ # Travis #
98
+ ##########
99
+ .travis.yml
@@ -0,0 +1,15 @@
1
+ # Encoding: utf-8
2
+
3
+ require_relative 'spec_helper'
4
+
5
+ describe '<%= cookbook_name %>::default' do
6
+ before { stub_resources }
7
+ describe 'ubuntu' do
8
+ let(:chef_run) { ChefSpec::Runner.new.converge(described_recipe) }
9
+
10
+ it 'writes some chefspec code' do
11
+ pending 'todo'
12
+ end
13
+
14
+ end
15
+ end
@@ -0,0 +1,19 @@
1
+ # Encoding: utf-8
2
+ require 'chefspec'
3
+ require 'chefspec/berkshelf'
4
+ require 'chef/application'
5
+
6
+ ::LOG_LEVEL = :fatal
7
+ ::UBUNTU_OPTS = {
8
+ platform: 'ubuntu',
9
+ version: '12.04',
10
+ log_level: ::LOG_LEVEL
11
+ }
12
+ ::CHEFSPEC_OPTS = {
13
+ log_level: ::LOG_LEVEL
14
+ }
15
+
16
+ def stub_resources
17
+ end
18
+
19
+ at_exit { ChefSpec::Coverage.report! }
@@ -0,0 +1,7 @@
1
+ # Encoding: utf-8
2
+
3
+ require_relative 'spec_helper'
4
+
5
+ describe 'default' do
6
+ it { pending 'write some tests' }
7
+ end
@@ -0,0 +1,11 @@
1
+ # Encoding: utf-8
2
+ require 'serverspec'
3
+
4
+ include Serverspec::Helper::Exec
5
+ include Serverspec::Helper::DetectOS
6
+
7
+ RSpec.configure do |c|
8
+ c.before :all do
9
+ c.path = '/sbin:/usr/bin'
10
+ end
11
+ end
@@ -0,0 +1,21 @@
1
+ # cabinet_spec.rb
2
+ require File.expand_path('../../lib/kitchen-cabinet/cabinet.rb', __FILE__)
3
+ describe Cabinet do
4
+ options = {}
5
+ options[:path] = 'test-path'
6
+ options[:copywrite] = 'test-copywrite'
7
+ options[:license] = 'test-license'
8
+ options[:email] = 'test-email'
9
+ options[:help] = 'test-help'
10
+ describe '#self.init_service' do
11
+ it 'Initialize all our services' do
12
+ puts 'init pass'
13
+ end
14
+ end
15
+
16
+ describe '#self.write_configs' do
17
+ it 'writes configs' do
18
+ puts 'config pass'
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,18 @@
1
+ # This file was generated by the `rspec --init` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # Require this file using `require "spec_helper"` to ensure that it is only
4
+ # loaded once.
5
+ #
6
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
7
+ RSpec.configure do |config|
8
+ config.treat_symbols_as_metadata_keys_with_true_values = true
9
+ config.run_all_when_everything_filtered = true
10
+ config.filter_run :focus
11
+ require File.expand_path('../../lib/kitchen-cabinet/cabinet.rb', __FILE__)
12
+
13
+ # Run specs in random order to surface order dependencies. If you find an
14
+ # order dependency and want to debug it, you can fix the order by providing
15
+ # the seed, which is printed after each run.
16
+ # --seed 1234
17
+ config.order = 'random'
18
+ end
metadata ADDED
@@ -0,0 +1,234 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: kitchen-cabinet
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.1.1
5
+ platform: ruby
6
+ authors:
7
+ - Taylor Price
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-02-13 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: chef
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '11.8'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 11.8.0
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '11.8'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 11.8.0
33
+ - !ruby/object:Gem::Dependency
34
+ name: test-kitchen
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '1.1'
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: 1.1.1
43
+ type: :runtime
44
+ prerelease: false
45
+ version_requirements: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - "~>"
48
+ - !ruby/object:Gem::Version
49
+ version: '1.1'
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: 1.1.1
53
+ - !ruby/object:Gem::Dependency
54
+ name: bundler
55
+ requirement: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - "~>"
58
+ - !ruby/object:Gem::Version
59
+ version: '1.5'
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: 1.5.1
63
+ type: :runtime
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: '1.5'
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ version: 1.5.1
73
+ - !ruby/object:Gem::Dependency
74
+ name: berkshelf
75
+ requirement: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - "~>"
78
+ - !ruby/object:Gem::Version
79
+ version: '2.0'
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: 2.0.12
83
+ type: :runtime
84
+ prerelease: false
85
+ version_requirements: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '2.0'
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ version: 2.0.12
93
+ - !ruby/object:Gem::Dependency
94
+ name: git
95
+ requirement: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - "~>"
98
+ - !ruby/object:Gem::Version
99
+ version: '1.2'
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: 1.2.6
103
+ type: :runtime
104
+ prerelease: false
105
+ version_requirements: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - "~>"
108
+ - !ruby/object:Gem::Version
109
+ version: '1.2'
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ version: 1.2.6
113
+ - !ruby/object:Gem::Dependency
114
+ name: erubis
115
+ requirement: !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - "~>"
118
+ - !ruby/object:Gem::Version
119
+ version: '2.7'
120
+ - - ">="
121
+ - !ruby/object:Gem::Version
122
+ version: 2.7.0
123
+ type: :runtime
124
+ prerelease: false
125
+ version_requirements: !ruby/object:Gem::Requirement
126
+ requirements:
127
+ - - "~>"
128
+ - !ruby/object:Gem::Version
129
+ version: '2.7'
130
+ - - ">="
131
+ - !ruby/object:Gem::Version
132
+ version: 2.7.0
133
+ - !ruby/object:Gem::Dependency
134
+ name: rspec
135
+ requirement: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - "~>"
138
+ - !ruby/object:Gem::Version
139
+ version: '2.14'
140
+ - - ">="
141
+ - !ruby/object:Gem::Version
142
+ version: 2.14.1
143
+ type: :development
144
+ prerelease: false
145
+ version_requirements: !ruby/object:Gem::Requirement
146
+ requirements:
147
+ - - "~>"
148
+ - !ruby/object:Gem::Version
149
+ version: '2.14'
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: 2.14.1
153
+ - !ruby/object:Gem::Dependency
154
+ name: rake
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - "~>"
158
+ - !ruby/object:Gem::Version
159
+ version: '10.1'
160
+ - - ">="
161
+ - !ruby/object:Gem::Version
162
+ version: 10.1.1
163
+ type: :development
164
+ prerelease: false
165
+ version_requirements: !ruby/object:Gem::Requirement
166
+ requirements:
167
+ - - "~>"
168
+ - !ruby/object:Gem::Version
169
+ version: '10.1'
170
+ - - ">="
171
+ - !ruby/object:Gem::Version
172
+ version: 10.1.1
173
+ description: |+
174
+ `kitchen-cabinet` will create a chef cookbook skeleton complete with testing suite including:
175
+ berkshelf, chefspec, test kitchen, strainer, foodcritic, rubocop, serverspec, stove, and guard. It also creates a gemfile suitable for use in CI.
176
+
177
+ email: tprice@onehealth.com
178
+ executables:
179
+ - cabinet
180
+ extensions: []
181
+ extra_rdoc_files: []
182
+ files:
183
+ - ".gitignore"
184
+ - ".rspec"
185
+ - ".rubocop.yml"
186
+ - ".travis.yml"
187
+ - CHANGELOG.md
188
+ - CONTRIBUTING.md
189
+ - Gemfile
190
+ - Guardfile
191
+ - README.md
192
+ - Rakefile
193
+ - bin/cabinet
194
+ - kitchen-cabinet.gemspec
195
+ - lib/kitchen-cabinet/cabinet.rb
196
+ - lib/kitchen-cabinet/templates/.gitignore.eruby
197
+ - lib/kitchen-cabinet/templates/.kitchen.yml.eruby
198
+ - lib/kitchen-cabinet/templates/.rubocop.yml.eruby
199
+ - lib/kitchen-cabinet/templates/Berksfile.eruby
200
+ - lib/kitchen-cabinet/templates/Gemfile.eruby
201
+ - lib/kitchen-cabinet/templates/Guardfile.eruby
202
+ - lib/kitchen-cabinet/templates/Strainerfile.eruby
203
+ - lib/kitchen-cabinet/templates/chefignore.eruby
204
+ - lib/kitchen-cabinet/templates/chefspec/default_spec.rb.eruby
205
+ - lib/kitchen-cabinet/templates/chefspec/spec_helper.rb.eruby
206
+ - lib/kitchen-cabinet/templates/serverspec/default_spec.rb.eruby
207
+ - lib/kitchen-cabinet/templates/serverspec/spec_helper.rb.eruby
208
+ - spec/cabinet_spec.rb
209
+ - spec/spec_helper.rb
210
+ homepage: https://github.com/onehealth/kitchen-cabinet
211
+ licenses:
212
+ - apachev2
213
+ metadata: {}
214
+ post_install_message:
215
+ rdoc_options: []
216
+ require_paths:
217
+ - lib
218
+ required_ruby_version: !ruby/object:Gem::Requirement
219
+ requirements:
220
+ - - ">="
221
+ - !ruby/object:Gem::Version
222
+ version: 1.9.3
223
+ required_rubygems_version: !ruby/object:Gem::Requirement
224
+ requirements:
225
+ - - ">="
226
+ - !ruby/object:Gem::Version
227
+ version: '0'
228
+ requirements: []
229
+ rubyforge_project:
230
+ rubygems_version: 2.2.2
231
+ signing_key:
232
+ specification_version: 4
233
+ summary: Initializes a chef cookbook repo with relevant tools
234
+ test_files: []