kitchen-cabinet 1.2.1.dev → 2.0.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 44302f9d56d8ce49112cf18c66679dad6595ee56
4
- data.tar.gz: 9992ee0534e54e308c98c14dc800e738e7a0ce79
3
+ metadata.gz: 99aea26399fc3f69deb9108743f3dee9e385ca89
4
+ data.tar.gz: f10a08c659ec3b682e33b4ffffb10d0e10fe4df7
5
5
  SHA512:
6
- metadata.gz: eca3b94d3f72f0c3753c49b9e49ca5ea458c394a503a52501c721ade59fd7f0f6f3bba8fef89d2394fdfb87cffdff73aaa3f8ebdf751404b7ea8fe50ca294abd
7
- data.tar.gz: 0233443bc85e4e8aa32451881434f81fd933fd91599d298ef0cd797d30df3fa07d472f7a86bc090ac70dc8623f5d7a39a8947c670ae6a80b0270d3744e970272
6
+ metadata.gz: d143919033ca700ee42de22ad8123eea75743f94713684d3966b7e4251563345b02bbbcbd924177ccbd4471877bb4b852b592fe8a73de4f65a8b5a2c6b30164e
7
+ data.tar.gz: e55c4b8115dd3640a18686cbb41e115cfe4bc43f12a7e639dca22c3d1eefca355046a1443f9e33da98291eb10a17ba3455f76b8106af1f62f97de6b7a247b173
data/CHANGELOG.md CHANGED
@@ -1,5 +1,6 @@
1
-
1
+ ## v2.0.0
2
2
  * Read knife.rb config for cookbook values if no cli overrides are used
3
+ * Uses Rake to execute tests instead of Strainer (Strainer is being phased out)
3
4
 
4
5
  ## v1.2.0:
5
6
 
data/README.md CHANGED
@@ -7,7 +7,7 @@ About
7
7
 
8
8
  Inspiration for this gem was taken from [meez](https://github.com/paulczar/meez). It creates an opinionated cookbook complete with testing suites.
9
9
 
10
- 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/terminal-notifier), rubocop, foodcritic, berkshelf, and stove.
10
+ Once `cabinet` has finished running, you will have a new cookbook complete with an initialized git repo, chefspec, serverspec, test-kitchen, guard (with notifications via inotify/fsevent/terminal-notifier), rubocop, foodcritic, berkshelf, and stove.
11
11
 
12
12
  It will automatically create a Gemfile for you with different groups set up for development, testing, etc:
13
13
 
@@ -34,7 +34,7 @@ group :release do
34
34
  end
35
35
 
36
36
  group :development do
37
- gem 'strainer', '~> 3.3.0'
37
+ gem 'rake, '~> 10.1'
38
38
  gem 'serverspec', '~> 0.14.2'
39
39
  gem 'guard', '~> 1.8'
40
40
  gem 'guard-rubocop', '~> 0.2'
@@ -72,22 +72,21 @@ Options
72
72
  ### Example
73
73
 
74
74
  `````` bash
75
- ➜ ~ cabinet --cookbook-path ~/Desktop -C Taylor Price -I apachev2 -m tprice@onehealth.com test-cookbook
75
+ ➜ ~ cabinet --cookbook-path ~/Desktop -C Taylor Price -I apachev2 -m tprice@onehealth.com test
76
76
  * Initializing chef
77
- ** Creating cookbook test-cookbook
78
- ** Creating README for cookbook: test-cookbook
79
- ** Creating CHANGELOG for cookbook: test-cookbook
80
- ** Creating metadata for cookbook: test-cookbook
77
+ ** Creating cookbook test
78
+ ** Creating README for cookbook: test
79
+ ** Creating CHANGELOG for cookbook: test
80
+ ** Creating metadata for cookbook: test
81
81
  Rewriting metadata.rb
82
82
  Rewriting recipes/default.rb
83
- * Initializing knife
84
83
  * Initializing git
85
84
  * Initializing berkshelf
86
- create Desktop/test-cookbook/Berksfile
87
- create Desktop/test-cookbook/Thorfile
88
- create Desktop/test-cookbook/.gitignore
89
- run git init from "./Desktop/test-cookbook"
90
- create Desktop/test-cookbook/Gemfile
85
+ create /Users/tprice/Desktop/test/Berksfile
86
+ create /Users/tprice/Desktop/test/Thorfile
87
+ create /Users/tprice/Desktop/test/.gitignore
88
+ run git init from "/Users/tprice/Desktop/test"
89
+ create /Users/tprice/Desktop/test/Gemfile
91
90
  * Initializing kitchen
92
91
  create .kitchen.yml
93
92
  append Thorfile
@@ -95,34 +94,16 @@ Options
95
94
  append Gemfile
96
95
  append Gemfile
97
96
  You must run `bundle install' to fetch any new gems.
98
- * Initializing guard
99
97
  * Initializing chefspec
100
- * Initializing strainer
101
- * Initializing rubocop
102
- * Initializing foodcritic
103
98
  * Initializing serverspec
104
- * Initializing stove
105
- this is the test-cookbook cookbook.
106
- Cookbook test-cookbook created successfully
99
+ this is the test cookbook.
100
+ Cookbook test created successfully
107
101
  Next steps...
108
- $ cd /Users/tprice/Desktop/test-cookbook
102
+ $ cd /Users/tprice/Desktop/test
109
103
  $ bundle install
110
104
  $ bundle exec berks install
111
- $ bundle exec strainer test
112
-
113
- ➜ cd ~/Desktop/test-cookbook
114
- ➜ bundle install
115
- Fetching gem metadata from https://rubygems.org/
116
- Fetching additional metadata from https://rubygems.org/
117
- Resolving dependencies...
118
- ...
119
- ...
120
- Your bundle is complete!
121
- ➜ bundle exec berks install
122
- Using test (0.1.0) from metadata
123
- ➜ bundle exec strainer test
124
- ...
125
- ...
105
+ $ bundle exec rake -T
106
+ ...
126
107
  ``````
127
108
 
128
109
  And so on!
data/bin/cabinet CHANGED
@@ -26,7 +26,7 @@ opt_parser = OptionParser.new do |opt|
26
26
  opt.on('-m', '--email EMAIL', 'The email address for the individual who maintains the cookbook.') do |email|
27
27
  options[:email] = email
28
28
  end
29
- opt.on('-u', '--update', 'Update the Gemfile, Chefignore, Guardfile, rubocop.yml, and the Strainerfile.') do
29
+ opt.on('-u', '--update', 'Update the Gemfile, Chefignore, Guardfile, rubocop.yml, and the Rakefile.') do
30
30
  options[:update] = true
31
31
  end
32
32
  opt.on('-h', '--help', 'help') do
@@ -87,6 +87,13 @@ elsif cookbook_name
87
87
  puts " $ cd #{cookbook_path}"
88
88
  puts ' $ bundle install'
89
89
  puts ' $ bundle exec berks install'
90
- puts ' $ bundle exec strainer test'
90
+ puts ' $ bundle exec rake -T'
91
+ puts 'rake integration # Run Test Kitchen integration tests'
92
+ puts 'rake kitchen:all # Run all test instances'
93
+ puts 'rake kitchen:default-ubuntu-1204 # Run default-ubuntu-1204 test instance'
94
+ puts 'rake spec # Run ChefSpec unit tests'
95
+ puts 'rake style # Run all style checks'
96
+ puts 'rake style:chef # Lint Chef cookbooks'
97
+ puts 'rake style:ruby # Run Ruby style checks'
91
98
  exit
92
99
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "kitchen-cabinet"
3
- s.version = '1.2.1.dev'
3
+ s.version = '2.0.0'
4
4
  s.date = Time.now.strftime("%Y-%m-%d")
5
5
  s.homepage = 'https://github.com/onehealth/kitchen-cabinet'
6
6
  s.summary = 'Initializes a chef cookbook repo with relevant tools'
@@ -22,9 +22,13 @@ class Cabinet
22
22
  create_cookbook = Chef::Knife::CookbookCreate.new
23
23
  create_cookbook.name_args = [cookbook_name]
24
24
  create_cookbook.config[:cookbook_path] = options[:path]
25
- create_cookbook.config[:cookbook_copyright] = options[:copyright] || 'YOUR_COMPANY_NAME'
26
- create_cookbook.config[:cookbook_license] = options[:license] || 'YOUR_EMAIL'
27
- create_cookbook.config[:cookbook_email] = options[:email] || 'none'
25
+ if File.exists?(File.join(ENV['HOME'], '.chef', 'knife.rb'))
26
+ require 'chef'
27
+ Chef::Config.from_file(File.join(ENV['HOME'], '.chef', 'knife.rb'))
28
+ end
29
+ create_cookbook.config[:cookbook_copyright] = options[:copyright] || Chef::Config[:cookbook_copyright]
30
+ create_cookbook.config[:cookbook_license] = options[:license] || Chef::Config[:cookbook_license]
31
+ create_cookbook.config[:cookbook_email] = options[:email] || Chef::Config[:cookbook_email]
28
32
  create_cookbook.run
29
33
  %w{ metadata.rb recipes/default.rb }.each do |file|
30
34
  puts "\tRewriting #{file}"
@@ -70,7 +74,7 @@ class Cabinet
70
74
  end
71
75
 
72
76
  def self.write_configs(cookbook_name, options, cookbook_path)
73
- @template = %w(chefignore .gitignore Gemfile Berksfile .kitchen.yml Guardfile Strainerfile .rubocop.yml)
77
+ @template = %w(chefignore .gitignore Gemfile Berksfile .kitchen.yml Guardfile Rakefile .rubocop.yml)
74
78
  puts 'this is the ' + cookbook_name + ' cookbook.'
75
79
  require 'kitchen-cabinet/config'
76
80
  @template.each do |template|
@@ -15,12 +15,13 @@ end
15
15
 
16
16
  group :release do
17
17
  gem 'stove', '~> 1.1'
18
+ # gem 'stove', '~> 2.0.0.beta.2'
18
19
  gem 'rspec_junit_formatter'
19
20
  gem 'rubocop-checkstyle_formatter'
20
21
  end
21
22
 
22
23
  group :development do
23
- gem 'strainer', '~> 3.3.0'
24
+ gem 'rake', '~> 10.1'
24
25
  gem 'serverspec', '~> 0.14.2'
25
26
  gem 'guard', '~> 1.8'
26
27
  gem 'guard-rubocop', '~> 0.2'
@@ -0,0 +1,33 @@
1
+ # Encoding: utf-8
2
+ require 'bundler/setup'
3
+
4
+ namespace :style do
5
+ require 'rubocop/rake_task'
6
+ desc 'Run Ruby style checks'
7
+ Rubocop::RakeTask.new(:ruby)
8
+
9
+ require 'foodcritic'
10
+ desc 'Run Chef style checks'
11
+ FoodCritic::Rake::LintTask.new(:chef)
12
+ end
13
+
14
+ desc 'Run all style checks'
15
+ task style: ['style:chef', 'style:ruby']
16
+
17
+ require 'kitchen'
18
+ desc 'Run Test Kitchen integration tests'
19
+ task :integration do
20
+ Kitchen.logger = Kitchen.default_file_logger
21
+ Kitchen::Config.new.instances.each do |instance|
22
+ instance.test(:always)
23
+ end
24
+ end
25
+
26
+ require 'rspec/core/rake_task'
27
+ desc 'Run ChefSpec unit tests'
28
+ RSpec::Core::RakeTask.new(:spec) do |t, args|
29
+ t.rspec_opts = 'test/unit/spec'
30
+ end
31
+
32
+ # The default task runs all tests.
33
+ task default: ['style', 'spec', 'integration']
@@ -58,6 +58,7 @@ Procfile
58
58
  .kitchen/*
59
59
  .rubocop.yml
60
60
  .coverage/*
61
+ Rakefile
61
62
 
62
63
  # SCM #
63
64
  #######
@@ -12,4 +12,4 @@ describe '<%= cookbook_name %>::default' do
12
12
  end
13
13
 
14
14
  end
15
- end
15
+ end
@@ -16,4 +16,4 @@ require 'chef/application'
16
16
  def stub_resources
17
17
  end
18
18
 
19
- at_exit { ChefSpec::Coverage.report! }
19
+ at_exit { ChefSpec::Coverage.report! }
@@ -4,4 +4,4 @@ require_relative 'spec_helper'
4
4
 
5
5
  describe 'default' do
6
6
  it { pending 'write some tests' }
7
- end
7
+ end
@@ -8,4 +8,4 @@ RSpec.configure do |c|
8
8
  c.before :all do
9
9
  c.path = '/sbin:/usr/bin'
10
10
  end
11
- end
11
+ end
@@ -4,7 +4,7 @@
4
4
  # The Update class helps you maintain the versions and config of your cookbook creation tools
5
5
  class Update
6
6
  def self.update_cookbook(cookbook_name, options, cookbook_path)
7
- @template = %w(chefignore Gemfile Guardfile Strainerfile .rubocop.yml)
7
+ @template = %w(chefignore Gemfile Guardfile Rakefile .rubocop.yml)
8
8
  require 'kitchen-cabinet/config'
9
9
  puts "Updating #{cookbook_name}..."
10
10
  @template.each do |template|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitchen-cabinet
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1.dev
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Taylor Price
@@ -202,7 +202,7 @@ files:
202
202
  - lib/kitchen-cabinet/templates/Berksfile.eruby
203
203
  - lib/kitchen-cabinet/templates/Gemfile.eruby
204
204
  - lib/kitchen-cabinet/templates/Guardfile.eruby
205
- - lib/kitchen-cabinet/templates/Strainerfile.eruby
205
+ - lib/kitchen-cabinet/templates/Rakefile.eruby
206
206
  - lib/kitchen-cabinet/templates/chefignore.eruby
207
207
  - lib/kitchen-cabinet/templates/chefspec/default_spec.rb.eruby
208
208
  - lib/kitchen-cabinet/templates/chefspec/spec_helper.rb.eruby
@@ -226,9 +226,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
226
226
  version: 1.9.3
227
227
  required_rubygems_version: !ruby/object:Gem::Requirement
228
228
  requirements:
229
- - - ">"
229
+ - - ">="
230
230
  - !ruby/object:Gem::Version
231
- version: 1.3.1
231
+ version: '0'
232
232
  requirements: []
233
233
  rubyforge_project:
234
234
  rubygems_version: 2.2.2
@@ -1,5 +0,0 @@
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