bourdain 1.5.1 → 1.6.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: f98d85d9d67886c3df6084ce7582b5049839917c
4
- data.tar.gz: 6d7830d78f934c2a13a7df1faa67ca3d00bde200
3
+ metadata.gz: d375a119ab4d7c7e96ab1b84b8c5e3116931f641
4
+ data.tar.gz: 076696693e74e35c28a47ee8c2e7a5ba4f01ca24
5
5
  SHA512:
6
- metadata.gz: b85e4ef8e55452f0fcac91bf086e972fc34caf635638edc6a6937571660c912a4f37cafe586906f2979a2927e219f888bc769643e169424364efa9311123816c
7
- data.tar.gz: d50dc05554e8d0e5f58ce87524f1c6b1bcc187cd253e789228e7cf2c4c276067cc94ae9f606ca63743431d0e087b9dc59cf395523e7eccb057c86a83af8ca745
6
+ metadata.gz: a8840f296b116a7f81c4f667471c0765d2c5456aac303129791e4e290ba8cd6efbae5258cb9543dfe8af35af9a4beb1afbe965c18f9298a8f0f930089501d575
7
+ data.tar.gz: 974c011362614fc2355e89ee1dccfe4caa8d88e36dbe72aef2ed2cd159a9968ddcafea1c7a86dc98cab1cba3750d1ae835f196e509a3acdca6242976202b0373
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.5.1
1
+ 1.6.0
@@ -17,4 +17,7 @@ module Bourdain
17
17
  \/___/ \/___/ \/___/ \/_/ \/__,_ /\/__/\/_/ \/_/\/_/\/_/
18
18
  v%s
19
19
  EOART
20
+ CHEFDK_PATH = '/opt/chefdk'
21
+ REQUIRE_RUBY_VERSION = '2.1'
22
+ RECOMMEND_RUBY_VERSION = '2.3'
20
23
  end
@@ -47,6 +47,8 @@ module Bourdain
47
47
 
48
48
  def error! ; @status = 1 end
49
49
 
50
+ def fatal! ; @status = 2 ; exit @status end
51
+
50
52
  def require_versionfile!
51
53
  return true if File::exists?('VERSION')
52
54
  log.fatal "I don't see any VERSION file around here..."
@@ -61,9 +63,9 @@ module Bourdain
61
63
  false
62
64
  end
63
65
 
64
- def require_chef!
66
+ def require_kitchen!
65
67
  return true if File::exists?('Howto.md')
66
- log.fatal "I don't see any Chef stuff around here, is this the Chef repo?"
68
+ log.fatal "Hm, things don't look quite right, is this the root of the Kitchen?"
67
69
  @status = 1
68
70
  false
69
71
  end
@@ -65,6 +65,6 @@ module Bourdain
65
65
  end
66
66
  end
67
67
 
68
- require_relative 'checks/chef'
68
+ require_relative 'checks/kitchen'
69
69
  require_relative 'checks/bourdain'
70
70
  require_relative 'checks/cookbooks'
@@ -10,7 +10,7 @@ module Bourdain
10
10
 
11
11
  def initialize cookbook_config
12
12
  super []
13
- return unless require_chef!
13
+ return unless require_kitchen!
14
14
  check_bourdain!
15
15
  end
16
16
 
@@ -10,7 +10,7 @@ module Bourdain
10
10
 
11
11
  def initialize cookbook_config
12
12
  super []
13
- return unless require_chef!
13
+ return unless require_kitchen!
14
14
  log.info 'Checking cookbooks, this may take a while...'
15
15
  check_gitlab_cookbooks! cookbook_config
16
16
  check_local_cookbooks! cookbook_config
@@ -0,0 +1,134 @@
1
+ require 'fileutils'
2
+
3
+
4
+ module Bourdain
5
+ module Checks
6
+ class KitchenCheck < Check
7
+ usage :check, <<-END
8
+ Check on the Kitchen
9
+ kitchen
10
+ END
11
+
12
+
13
+ def initialize cookbook_config
14
+ super []
15
+ return unless require_kitchen!
16
+ check_kitchen_repo!
17
+ end
18
+
19
+
20
+
21
+ private
22
+
23
+ def which cmd ; `which #{cmd}`.strip end
24
+
25
+ def shebang cmd
26
+ File.read(which(cmd)).lines.first.strip
27
+ rescue
28
+ log.fatal 'Could not calculate shebang for "%s"' % cmd
29
+ nil
30
+ end
31
+
32
+ def shebangs cmds ; Hash[cmds.map { |c| [ c, shebang(c) ] }] end
33
+
34
+ def check_kitchen_repo!
35
+ if Gem::Version.new(RUBY_VERSION) < Gem::Version.new(REQUIRE_RUBY_VERSION)
36
+ log.fatal <<-END.gsub(/^ +/,'').strip
37
+ Whoa! Looks like you got an old version of Ruby!
38
+
39
+ Your Ruby installation is a little too old to support. We ask that
40
+ users upgrade to at least v#{REQUIRE_RUBY_VERSION}. We recommend at least v#{RECOMMEND_RUBY_VERSION} for best
41
+ results. There are lots of ways to accomplish this:
42
+
43
+ - Homebrew: `brew install ruby`
44
+ - Source: https://www.ruby-lang.org/en/documentation/installation#building-from-source
45
+ - chruby+ruby-install: https://github.com/postmodern/chruby#readme
46
+ - rbenv+ruby-build: https://github.com/rbenv/rbenv#readme
47
+ - RVM: https://rvm.io
48
+
49
+ Make sure you update Bundler, too (`gem install bundler`)
50
+
51
+ You should fix this ASAP.
52
+ END
53
+ fatal!
54
+ end
55
+
56
+ unless File.exist? CHEFDK_PATH
57
+ log.fatal <<-END.gsub(/^ +/,'').strip
58
+ Whoa! Looks like you don't have ChefDK installed!
59
+
60
+ While the Kitchen distributes all the Chef-related tooling you need,
61
+ some tools like Vagrant expect ChefDK to be installed. Chef provides
62
+ omnibus packages for most platforms:
63
+
64
+ - https://downloads.chef.io/chef-dk
65
+
66
+ Note that although ChefDK should be installed, it should not be on
67
+ your PATH, as the embedded tools may conflict with those provided by
68
+ the Kitchen. The Kitchen will use ChefDK as necessary.
69
+
70
+ You should fix this ASAP.
71
+ END
72
+ fatal!
73
+ end
74
+
75
+ if ENV['PATH'] =~ /chefdk/
76
+ log.fatal <<-END.gsub(/^ +/,'').strip
77
+ Whoa! Looks like you got ChefDK on your PATH!
78
+
79
+ The Kitchen distributes all the Chef-related tooling you need,
80
+ acting as a kind of ChefDK tailored for Blue Jeans. Unfortunately,
81
+ ChefDK sometimes distributes conflicting tooling, so we ask users
82
+ to avoid putting ChefDK on their PATH but leave it installed. The
83
+ Kitchen will use ChefDK as necessary.
84
+
85
+ You should fix this ASAP.
86
+ END
87
+ fatal!
88
+ end
89
+
90
+ { # Which commands important for what tooling
91
+ 'Ruby' => %w[ gem bundle ],
92
+ 'Chef' => %w[ rake berks tony foodcritic kitchen ]
93
+ }.each do |tooling, check_commands|
94
+ check_shebangs = shebangs check_commands
95
+ unless check_shebangs.values.uniq.size == 1
96
+ log.error <<-END.gsub(/^ +/,'')
97
+ Head's up: I seem some conflicting shebang lines.
98
+
99
+ The Kitchen depends on a stable, clean installation of #{tooling}
100
+ tooling. We expect that all these Gems are managed by the same
101
+ installation, but it's easy for things to get messy:
102
+ END
103
+ check_shebangs.each do |cmd, shebang|
104
+ log.error ' %s: %s' % [
105
+ cmd, shebang ? shebang.inspect : 'missing?'
106
+ ]
107
+ end
108
+ log.error <<-END.gsub(/^ +/,'').rstrip
109
+
110
+ Depending on your Ruby install method, this may not actually be an
111
+ issue at all, but it could aid in debugging.
112
+ END
113
+ error!
114
+ end
115
+ end
116
+
117
+ if youre_dirty? '.'
118
+ log.warn "Your Kitchen is dirty."
119
+ elsif youre_ahead? '.'
120
+ log.warn "Your Kitchen is ahead of the remote."
121
+ elsif youre_behind? '.'
122
+ log.error "Looks like your Kitchen is behind the remote."
123
+ error!
124
+ else
125
+ log.info "Your Kitchen looks up-to-date."
126
+ end
127
+
128
+ log.info 'Updating your Bundle...'
129
+ system 'bundle update'
130
+ end
131
+
132
+ end
133
+ end
134
+ end
@@ -48,7 +48,7 @@ module Bourdain
48
48
  Trollop::die 'Invalid <check> provided' if check.nil?
49
49
  end
50
50
 
51
- return unless require_chef!
51
+ return unless require_kitchen!
52
52
 
53
53
  if check.nil?
54
54
  @status = Bourdain::Registry.map('check') do |c|
@@ -31,7 +31,7 @@ module Bourdain
31
31
  Trollop::die 'No <path> provided' if path.nil?
32
32
  Trollop::die 'Invalid <path> provided' unless valid? path
33
33
 
34
- return unless require_chef!
34
+ return unless require_kitchen!
35
35
 
36
36
  if Dir::exists? path
37
37
  log.warn "Cookbook already exists. Doing nothing."
@@ -1,8 +1,10 @@
1
1
  {
2
2
  "name": "<%= name %>",
3
3
  "description": "<%= description %>",
4
- "default_attributes": {},
5
- "override_attributes": {},
4
+ "default_attributes": {
5
+ },
6
+ "override_attributes": {
7
+ },
6
8
  "chef_type": "environment",
7
9
  "json_class": "Chef::Environment"
8
- }
10
+ }
@@ -1,9 +1,13 @@
1
1
  {
2
2
  "name": "<%= name %>",
3
3
  "description": "<%= description %>",
4
- "default_attributes": {},
5
- "override_attributes": {},
6
- "run_list": [ "recipe[<%= name %>]" ],
4
+ "default_attributes": {
5
+ },
6
+ "override_attributes": {
7
+ },
8
+ "run_list": [
9
+ "recipe[<%= name %>]"
10
+ ],
7
11
  "json_class": "Chef::Role",
8
12
  "chef_type": "role"
9
- }
13
+ }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bourdain
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.1
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Clemmer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-02 00:00:00.000000000 Z
11
+ date: 2016-03-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pmap
@@ -112,8 +112,8 @@ files:
112
112
  - lib/bourdain/resources.rb
113
113
  - lib/bourdain/resources/checks.rb
114
114
  - lib/bourdain/resources/checks/bourdain.rb
115
- - lib/bourdain/resources/checks/chef.rb
116
115
  - lib/bourdain/resources/checks/cookbooks.rb
116
+ - lib/bourdain/resources/checks/kitchen.rb
117
117
  - lib/bourdain/resources/commands.rb
118
118
  - lib/bourdain/resources/commands/bump.rb
119
119
  - lib/bourdain/resources/commands/check.rb
@@ -157,7 +157,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
157
157
  version: '0'
158
158
  requirements: []
159
159
  rubyforge_project:
160
- rubygems_version: 2.4.5.1
160
+ rubygems_version: 2.5.1
161
161
  signing_key:
162
162
  specification_version: 4
163
163
  summary: Tools for badass chefs
@@ -1,43 +0,0 @@
1
- require 'fileutils'
2
-
3
-
4
- module Bourdain
5
- module Checks
6
-
7
- class ChefCheck < Check
8
- usage :check, <<-END
9
- Check the underlying Kitchen
10
- chef
11
- END
12
-
13
-
14
- def initialize cookbook_config
15
- super []
16
- return unless require_chef!
17
- check_chef_repo!
18
- end
19
-
20
-
21
-
22
- private
23
-
24
- def check_chef_repo!
25
- # Check if we have an up-to-date copy of the Kitchen
26
- if youre_dirty? '.'
27
- log.warn "Your Kitchen is dirty."
28
- elsif youre_ahead? '.'
29
- log.warn "Your Kitchen is ahead of the remote."
30
- elsif youre_behind? '.'
31
- log.error "Looks like your Kitchen is behind the remote."
32
- error!
33
- else
34
- log.info "Your Kitchen looks up-to-date."
35
- end
36
-
37
- log.info 'Updating your Bundle...'
38
- system 'bundle update'
39
- end
40
-
41
- end
42
- end
43
- end