knife-spork 1.3.4 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- ZmNkNDZiMDM3MzE5Nzk2NmU3NTcyOTcyM2Y0NjY5MGI3NjRkODA5Yw==
5
- data.tar.gz: !binary |-
6
- NDU3YmIxMDQ4YTJlN2E5MDNmYjcxMDU2YmRjM2ExYTcxNjhhMjg2Ng==
2
+ SHA1:
3
+ metadata.gz: 14e3e1ec0e10a27b1e6b3fbed2a5265f20288a78
4
+ data.tar.gz: 31ec1a3d172014c1791e00d28e9a043612963cbb
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- ZDc0ZTVjMjQ4M2IyODhhNGMzYmVjZWY2NjY1ZTQ2ODdkNTliYjRlNTI0Y2I3
10
- NTVhY2JkMjI3MzIzNTU2NGQ4OGQ4OTRkMzMxYWNmNjVjOWJhNTEzNzJlZmY5
11
- NmY2YzY2MzlhYjkxYThiNmIyMzc4MWUwMWZmNTM4YTU2YWZmNDY=
12
- data.tar.gz: !binary |-
13
- NDQzYTgxYzY3MmYyNzhiZTEzZWFjNDdhYWMwYWM4OTUyN2Q1YjZjMTM3ZTE5
14
- NTBkMDU1OTlhMGUzYTU3OTNkZDJlZjM5YmNhNjk1OGE3YzQ2YzE0ZTVlYmJm
15
- ZjQxYmVlYjU5OTkyODEwOWU5MzBkNzkxZmI3NDc5Y2FhMmI2MmU=
6
+ metadata.gz: 8eae1fcab0dc4eaa6837ee97f5aae878ca384509d6056663c32841d249e993d5b0bed3e2727f0895b92f72be0c3bbc7db79cdba6943d41d4424b6d55e033bf4e
7
+ data.tar.gz: c3501970934ea59acfaabfa662e6186da5e25456713208ff057ae323be32163dfec7b048beaf8a16fc51a4cdfadb64f5f795ca467128017460448b258ed36b45
@@ -1,3 +1,19 @@
1
+ ## 1.4.0 (Footh August, 2014)
2
+
3
+ Bugfixes:
4
+
5
+ - Fix bug with preserve_constraint_operators functionality (https://github.com/jonlives/knife-spork/issues/131)
6
+ - Fix incorrect data bag banner message (Thanks to @jperry https://github.com/jonlives/knife-spork/pull/119)
7
+ - Fix error when calculating environment path when "cookbooks" occurs in cookbook_path outside of the last position (https://github.com/jonlives/knife-spork/issues/137)
8
+ - Fix spelling error in README (Thanks to @jrwesolo https://github.com/jonlives/knife-spork/pull/136)
9
+
10
+ Features:
11
+
12
+ - Hipchat plugin now supports custom server URL and API version (Thanks to @hrak https://github.com/jonlives/knife-spork/pull/135)
13
+ - Slack plugin (Thanks to @chrisferry https://github.com/jonlives/knife-spork/pull/134)
14
+ - Add skip_berkshelf flag to allow Berkshelf operations to be skipped even when Berkshelf is loaded (https://github.com/jonlives/knife-spork/issues/138)
15
+
16
+
1
17
  ## 1.3.4 (2nd June, 2014)
2
18
 
3
19
  Bugfixes:
data/README.md CHANGED
@@ -52,6 +52,7 @@ environment_path: "/home/me/environments"
52
52
  role_path: "/home/me/roles"
53
53
  custom_plugin_path: "/home/me/spork-plugins"
54
54
  always_promote_remote: true
55
+ skip_berkshelf: false
55
56
  json_options:
56
57
  indent: " "
57
58
  plugins:
@@ -88,6 +89,18 @@ plugins:
88
89
  port: 2003
89
90
  eventinator:
90
91
  url: http://eventinator.mydomain.com/events/oneshot
92
+ slack:
93
+ api_token: abc123
94
+ channel: "#sysops"
95
+ teamname: myteam
96
+ username: knife
97
+ rubocop:
98
+ epic_fail: true
99
+ show_name: false
100
+ autocorrect: false
101
+ out_file: <file>
102
+ sev_level: <C|W|E>
103
+ lint: false
91
104
  ```
92
105
 
93
106
  #### Default Environments
@@ -105,6 +118,9 @@ The `preserve_constraint_operators` directive causes spork promote to preserve e
105
118
  #### Always Promote Remote
106
119
  The `always_promote_remote` directive allows you to tell spork promote to always act as if the --remote option had been specified. This will also have the same effect on spork omni. This option should only be used if you're sure you want all changes to be uploaded to the server as soon as you run promote.
107
120
 
121
+ #### Skip Berkshelf
122
+ The `skip_berkshelf` directive is a temporary flag added in [#138](https://github.com/jonlives/knife-spork/issues/138) to allow Berkshelf functionality to be optionally bypassed until Berkshelf 3 support has been added to knife-spork per [#85](https://github.com/jonlives/knife-spork/issues/85). It simply removed the :Berkshelf constant from the namespace used by knife-spork.
123
+
108
124
  #### JSON Options
109
125
  The `json_options` directive allows you to tell spork to pass options to [pretty_generate](http://www.ruby-doc.org/stdlib-1.9.3/libdoc/json/rdoc/JSON.html#method-i-pretty_generate) to control the format of the resulting json
110
126
 
@@ -137,7 +153,7 @@ knife spork info
137
153
  ```text
138
154
  $ knife spork info
139
155
  Config Hash:
140
- {"plugins"=>{"git"=>{"enabled"=>true}, "irccat"=>{"server"=>"irccat.mydomain.com", "port"=>12345, "gist"=>"usr/bin/gist", "channel"=>["#chef-announce"]}, "graphite"=>{"server"=>"graphite.mydomain.com", "port"=>2003}, "eventinator"=>{"url"=>"http://eventinator.mydomain.com/events/oneshot"}}, "default_environments"=>["development", "production"], "version_change_threshold"=>2, "pplugins"=>{"foodcritic"=>{"fail_tags"=>["style,correctness,test"], "tags"=>["~portability"], "include_rules"=>["config/rules.rb"]}}}
156
+ {"plugins"=>{"git"=>{"enabled"=>true}, "irccat"=>{"server"=>"irccat.mydomain.com", "port"=>12345, "gist"=>"usr/bin/gist", "channel"=>["#chef-announce"]}, "graphite"=>{"server"=>"graphite.mydomain.com", "port"=>2003}, "slack"=>{"api_token"=>"abc123", "channel"=>"random", "teamname"=>"myteam"}, "eventinator"=>{"url"=>"http://eventinator.mydomain.com/events/oneshot"}}, "default_environments"=>["development", "production"], "version_change_threshold"=>2, "pplugins"=>{"foodcritic"=>{"fail_tags"=>["style,correctness,test"], "tags"=>["~portability"], "include_rules"=>["config/rules.rb"]}}}
141
157
 
142
158
  Plugins:
143
159
  KnifeSpork::Plugins::Campfire: disabled
@@ -146,6 +162,7 @@ KnifeSpork::Plugins::Foodcritic: disabled
146
162
  KnifeSpork::Plugins::Git: enabled
147
163
  KnifeSpork::Plugins::Graphite: enabled
148
164
  KnifeSpork::Plugins::HipChat: disabled
165
+ KnifeSpork::Plugins::Slack: enabled
149
166
  KnifeSpork::Plugins::Irccat: enabled
150
167
  ```
151
168
 
@@ -373,7 +390,7 @@ Saving changes to development.json
373
390
  Promotion complete. Don't forget to upload your changed development.json to Chef Server
374
391
  ```
375
392
 
376
- Spork Environnent Check
393
+ Spork Environment Check
377
394
  -------------
378
395
  Environment check provides the ability to validate a local chef environment file is locked to versions that actually exist on the chef server. Running this check prior to uploading your environment files is recommended as it can prevent your chef server from becoming unresponsive due to a version constraint that will never be valid.
379
396
 
@@ -2,7 +2,7 @@ $:.push File.expand_path('../lib', __FILE__)
2
2
 
3
3
  Gem::Specification.new do |gem|
4
4
  gem.name = 'knife-spork'
5
- gem.version = '1.3.4'
5
+ gem.version = '1.4.0'
6
6
  gem.authors = ["Jon Cowie"]
7
7
  gem.email = 'jonlives@gmail.com'
8
8
  gem.homepage = 'https://github.com/jonlives/knife-spork'
@@ -20,4 +20,4 @@ Gem::Specification.new do |gem|
20
20
  gem.add_runtime_dependency 'git', '>= 1.2.5'
21
21
  gem.add_runtime_dependency 'app_conf', '>= 0.4.0'
22
22
  gem.add_runtime_dependency 'diffy', '>= 3.0.1'
23
- end
23
+ end
@@ -42,6 +42,10 @@ module KnifeSpork
42
42
  exit 1
43
43
  end
44
44
 
45
+ # Temporary fix for #138 to allow Berkshelf functionality
46
+ # to be bypassed until #85 has been completed and Berkshelf 3 support added
47
+ unload_berkshelf_if_specified
48
+
45
49
  #First load so plugins etc know what to work with
46
50
  @cookbook = load_cookbook(name_args.first)
47
51
 
@@ -48,6 +48,10 @@ module KnifeSpork
48
48
  exit(1)
49
49
  end
50
50
 
51
+ # Temporary fix for #138 to allow Berkshelf functionality
52
+ # to be bypassed until #85 has been completed and Berkshelf 3 support added
53
+ unload_berkshelf_if_specified
54
+
51
55
  #First load so plugins etc know what to work with
52
56
  initial_load
53
57
 
@@ -9,7 +9,7 @@ module KnifeSpork
9
9
  require 'chef/knife/data_bag_create'
10
10
  end
11
11
 
12
- banner 'knife data bag create BAG [ITEM] (options)'
12
+ banner 'knife spork data bag create BAG [ITEM] (options)'
13
13
 
14
14
  option :secret,
15
15
  :short => "-s SECRET",
@@ -9,7 +9,7 @@ module KnifeSpork
9
9
  require 'chef/knife/data_bag_delete'
10
10
  end
11
11
 
12
- banner 'knife data bag delete BAG [ITEM] (options)'
12
+ banner 'knife spork data bag delete BAG [ITEM] (options)'
13
13
 
14
14
 
15
15
  def run
@@ -9,7 +9,7 @@ module KnifeSpork
9
9
  require 'chef/knife/data_bag_from_file'
10
10
  end
11
11
 
12
- banner 'knife data bag from file BAG FILE|FOLDER [FILE|FOLDER..] (options)'
12
+ banner 'knife spork data bag from file BAG FILE|FOLDER [FILE|FOLDER..] (options)'
13
13
 
14
14
  option :secret,
15
15
  :short => "-s SECRET",
@@ -1,13 +1,13 @@
1
1
  require 'chef/knife'
2
+ begin
3
+ require 'berkshelf'
4
+ rescue LoadError; end
2
5
 
3
6
  module KnifeSpork
4
7
  class SporkOmni < Chef::Knife
5
8
 
6
9
  deps do
7
10
  require 'knife-spork/runner'
8
- begin
9
- require 'berkshelf'
10
- rescue LoadError; end
11
11
  end
12
12
 
13
13
  banner 'knife spork omni COOKBOOK (options)'
@@ -58,6 +58,10 @@ module KnifeSpork
58
58
  exit(1)
59
59
  end
60
60
 
61
+ # Temporary fix for #138 to allow Berkshelf functionality
62
+ # to be bypassed until #85 has been completed and Berkshelf 3 support added
63
+ unload_berkshelf_if_specified
64
+
61
65
  cookbook = name_args.first
62
66
 
63
67
  run_plugins(:before_omni)
@@ -1,4 +1,7 @@
1
1
  require 'chef/knife'
2
+ begin
3
+ require 'berkshelf'
4
+ rescue LoadError; end
2
5
 
3
6
  module KnifeSpork
4
7
  class SporkPromote < Chef::Knife
@@ -6,9 +9,6 @@ module KnifeSpork
6
9
  deps do
7
10
  require 'chef/exceptions'
8
11
  require 'knife-spork/runner'
9
- begin
10
- require 'berkshelf'
11
- rescue LoadError; end
12
12
  end
13
13
 
14
14
  banner 'knife spork promote ENVIRONMENT COOKBOOK (options)'
@@ -42,6 +42,10 @@ module KnifeSpork
42
42
  exit 1
43
43
  end
44
44
 
45
+ # Temporary fix for #138 to allow Berkshelf functionality
46
+ # to be bypassed until #85 has been completed and Berkshelf 3 support added
47
+ unload_berkshelf_if_specified
48
+
45
49
  #First load so plugins etc know what to work with
46
50
  @environments, @cookbook = load_environments_and_cookbook
47
51
 
@@ -80,7 +84,13 @@ module KnifeSpork
80
84
  def update_version_constraints(environment, cookbook, new_version)
81
85
  validate_version!(new_version)
82
86
  if spork_config.preserve_constraint_operators
83
- constraint_operator = environment.cookbook_versions[cookbook].split.first
87
+
88
+ cb_version = environment.cookbook_versions[cookbook]
89
+ if cb_version.length > 0
90
+ constraint_operator = cb_version.split.first
91
+ else
92
+ constraint_operator = "="
93
+ end
84
94
  ui.msg "Preserving existing version constraint operator: #{constraint_operator}"
85
95
  else
86
96
  constraint_operator = "="
@@ -138,7 +148,13 @@ module KnifeSpork
138
148
  end
139
149
 
140
150
  def save_environment_changes(environment, json)
141
- environments_path = spork_config[:environment_path] || cookbook_path.gsub('cookbooks', 'environments')
151
+ if spork_config[:environment_path]
152
+ environments_path = spork_config[:environment_path]
153
+ else
154
+ split_cb_path = cookbook_path.split("/")
155
+ environments_path = (split_cb_path[0..-2] << split_cb_path[-1].gsub("cookbooks","environments")).join("/")
156
+ end
157
+
142
158
  environment_path = File.expand_path( File.join(environments_path, "#{environment}.json") )
143
159
 
144
160
  File.open(environment_path, 'w'){ |f| f.puts(json) }
@@ -51,6 +51,10 @@ module KnifeSpork
51
51
  exit 1
52
52
  end
53
53
 
54
+ # Temporary fix for #138 to allow Berkshelf functionality
55
+ # to be bypassed until #85 has been completed and Berkshelf 3 support added
56
+ unload_berkshelf_if_specified
57
+
54
58
  #First load so plugins etc know what to work with
55
59
  @cookbooks = load_cookbooks(name_args)
56
60
  include_dependencies if config[:depends]
@@ -102,7 +102,7 @@ module KnifeSpork
102
102
 
103
103
  rooms.each do |room_name|
104
104
  begin
105
- client = ::HipChat::Client.new(config.api_token)
105
+ client = ::HipChat::Client.new(config.api_token, :api_version => config.api_version ||= 'v1', :server_url => config.server_url ||= 'https://api.hipchat.com')
106
106
  client[room_name].send(nickname, message, :notify => notify, :color =>color)
107
107
  rescue Exception => e
108
108
  ui.error 'Something went wrong sending to HipChat.'
@@ -0,0 +1,52 @@
1
+ require 'knife-spork/plugins/plugin'
2
+
3
+ module KnifeSpork
4
+ module Plugins
5
+ class Rubocop < Plugin
6
+ name :rubocop
7
+ hooks :after_check, :before_upload
8
+
9
+ def perform
10
+ safe_require 'rubocop'
11
+ safe_require 'rubocop/cli'
12
+ safe_require 'rubocop/config_store'
13
+
14
+ if Gem::Specification.find_all_by_name("rubocop").empty?
15
+ ui.fatal "The knife-spork rubocop plugin requires rubocop."
16
+ exit 1
17
+ end
18
+
19
+ base_options = []
20
+ base_options = base_options.concat([ "-D" ]) if config.show_name # Lists the name of the offense along with the description
21
+ base_options = base_options.concat([ "--auto-correct" ]) if config.autocorrect
22
+ base_options = base_options.concat([ "--out", config.out_file ]) if config.out_file # Specify a file output rather than STDOUT for the specific errors
23
+ base_options = base_options.concat([ "--fail-level", config.sev_level ]) if config.sev_level # Specify a severity level for when rubocop should fail
24
+ base_options = base_options.concat([ "--lint"]) if config.lint # Only run lint checks
25
+
26
+ cookbooks.each do |cookbook|
27
+ ui.info "Running rubocop against #{cookbook.name}@#{cookbook.version}..."
28
+
29
+ cookbook_path = cookbook.root_dir
30
+
31
+ ui.info cookbook_path
32
+
33
+ options = [ cookbook_path ]
34
+
35
+ cli = ::Rubocop::CLI.new
36
+ result = cli.run(options)
37
+
38
+ unless result == 0
39
+ ui.error "Rubocop failed!"
40
+ exit(1) if config.epic_fail
41
+ else
42
+ ui.info "Passed!"
43
+ end
44
+ end
45
+ end
46
+
47
+ def epic_fail?
48
+ config.epic_fail.nil? ? 'true' : config.epic_fail
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,121 @@
1
+ require 'knife-spork/plugins/plugin'
2
+
3
+ module KnifeSpork
4
+ module Plugins
5
+ class Slack < Plugin
6
+ name :slack
7
+
8
+ def perform; end
9
+
10
+ def after_upload
11
+ slack "#{organization}#{current_user} uploaded the following cookbooks:\n#{cookbooks.collect{ |c| " #{c.name}@#{c.version}" }.join("\n")}"
12
+ end
13
+
14
+ def after_promote_remote
15
+ slack "#{organization}#{current_user} promoted the following cookbooks:\n#{cookbooks.collect{ |c| " #{c.name}@#{c.version}" }.join("\n")} to #{environments.collect{ |e| "#{e.name}" }.join(", ")}"
16
+ end
17
+
18
+ def after_environmentfromfile
19
+ slack "#{organization}#{current_user} uploaded environment #{object_name}"
20
+ end
21
+
22
+ def after_environmentedit
23
+ slack "#{organization}#{current_user} edited environment #{object_name}"
24
+ end
25
+
26
+ def after_environmentcreate
27
+ slack "#{organization}#{current_user} created environment #{object_name}"
28
+ end
29
+
30
+ def after_environmentdelete
31
+ slack "#{organization}#{current_user} deleted environment #{object_name}"
32
+ end
33
+
34
+ def after_rolefromfile
35
+ slack "#{organization}#{current_user} uploaded role #{object_name}"
36
+ end
37
+
38
+ def after_roleedit
39
+ slack "#{organization}#{current_user} edited role #{object_name}"
40
+ end
41
+
42
+ def after_rolecreate
43
+ slack "#{organization}#{current_user} created role #{object_name}"
44
+ end
45
+
46
+ def after_roledelete
47
+ slack "#{organization}#{current_user} deleted role #{object_name}"
48
+ end
49
+
50
+ def after_databagedit
51
+ slack "#{organization}#{current_user} edited data bag item #{object_name}:#{object_secondary_name}"
52
+ end
53
+
54
+ def after_databagcreate
55
+ slack "#{organization}#{current_user} created data bag #{object_name}"
56
+ end
57
+
58
+ def after_databagdelete
59
+ slack "#{organization}#{current_user} deleted data bag item #{object_name}"
60
+ end
61
+
62
+ def after_databagitemdelete
63
+ slack "#{organization}#{current_user} deleted data bag item #{object_name}:#{object_secondary_name}"
64
+ end
65
+
66
+ def after_databagfromfile
67
+ slack "#{organization}#{current_user} uploaded data bag item #{object_name}:#{object_secondary_name}"
68
+ end
69
+
70
+ def after_nodeedit
71
+ slack "#{organization}#{current_user} edited node #{object_name}"
72
+ end
73
+
74
+ def after_nodedelete
75
+ slack "#{organization}#{current_user} deleted node #{object_name}"
76
+ end
77
+
78
+ def after_nodecreate
79
+ slack "#{organization}#{current_user} created node #{object_name}"
80
+ end
81
+
82
+ def after_nodefromfile
83
+ slack "#{organization}#{current_user} uploaded node #{object_name}"
84
+ end
85
+
86
+ def after_noderunlistadd
87
+ slack "#{organization}#{current_user} added run_list items to #{object_name}: #{object_secondary_name}"
88
+ end
89
+
90
+ def after_noderunlistremove
91
+ slack "#{organization}#{current_user} removed run_list items from #{object_name}: #{object_secondary_name}"
92
+ end
93
+
94
+ def after_noderunlistset
95
+ slack "#{organization}#{current_user} set the run_list for #{object_name} to #{object_secondary_name}"
96
+ end
97
+
98
+
99
+ private
100
+ def slack(message)
101
+ safe_require 'slack-notifier'
102
+ begin
103
+ notifier = ::Slack::Notifier.new( config.teamname, config.api_token, channel: channel, username: username)
104
+ notifier.ping message
105
+ rescue Exception => e
106
+ ui.error 'Something went wrong sending to Slack.'
107
+ ui.error e.to_s
108
+ end
109
+ end
110
+
111
+ def channel
112
+ config.channel || '#random'
113
+ end
114
+
115
+ def username
116
+ config.username || 'KnifeSpork'
117
+ end
118
+
119
+ end
120
+ end
121
+ end
@@ -135,7 +135,19 @@ module KnifeSpork
135
135
  end
136
136
 
137
137
  def environment_path
138
- spork_config[:environment_path] || Chef::Config.environment_path.first || cookbook_path.gsub("/cookbooks","/environments")
138
+ if spork_config[:environment_path]
139
+ if spork_config[:environment_path].kind_of?(Array)
140
+ spork_config[:environment_path].first
141
+ else
142
+ spork_config[:environment_path]
143
+ end
144
+ elsif Chef::Config.environment_path && Chef::Config.environment_path.kind_of?(Array)
145
+ Chef::Config.environment_path.first
146
+ elsif Chef::Config.environment_path && Chef::Config.environment_path.kind_of?(String)
147
+ Chef::Config.environment_path
148
+ else
149
+ cookbook_path.gsub("/cookbooks","/environments")
150
+ end
139
151
  end
140
152
 
141
153
  def role_path
@@ -271,12 +283,21 @@ module KnifeSpork
271
283
  end
272
284
 
273
285
  def ensure_cookbook_path!
274
- if !config.has_key?(:cookbook_path)
286
+ if config[:cookbook_path].nil?
275
287
  ui.fatal "No default cookbook_path; Specify with -o or fix your knife.rb."
276
288
  show_usage
277
289
  exit(1)
278
290
  end
279
291
  end
292
+
293
+ def unload_berkshelf_if_specified
294
+ # Temporary fix for #138 to allow Berkshelf functionality
295
+ # to be bypassed until #85 has been completed and Berkshelf 3 support added
296
+ if spork_config.skip_berkshelf
297
+ ui.warn "Unloading Berkshelf as skip_berkshelf option found in config"
298
+ Object.send(:remove_const, :Berkshelf)
299
+ end
300
+ end
280
301
  end
281
302
 
282
303
  def self.included(receiver)
@@ -20,7 +20,9 @@ Configuration
20
20
  ```yaml
21
21
  plugins:
22
22
  hipchat:
23
+ server_url: https://api.hipchat.com
23
24
  api_token: ABC123
25
+ api_version: v1
24
26
  rooms:
25
27
  - General
26
28
  - Web Operations
@@ -28,11 +30,21 @@ plugins:
28
30
  color: yellow
29
31
  ```
30
32
 
33
+ #### server_url
34
+ The URL of the HipChat API server. Default: 'https://api.hipchat.com'
35
+
36
+ - Type: `String`
37
+
31
38
  #### api_token
32
39
  Your HipChat API token.
33
40
 
34
41
  - Type: `String`
35
42
 
43
+ #### api_version
44
+ Which version of the HipChat API to use. Default: 'v1'
45
+
46
+ - Type: `String`
47
+
36
48
  #### rooms
37
49
  The list of rooms to post to.
38
50
 
@@ -44,7 +56,7 @@ Boolean value indicating whether the room should be notified.
44
56
  - Type: `Boolean`
45
57
 
46
58
  #### color
47
- THe color of the message.
59
+ The color of the message.
48
60
 
49
61
  - Type: `String`
50
62
  - Acceptable Values: `[yellow, red, green, purple, random]`
@@ -0,0 +1,102 @@
1
+ Rubocop
2
+ ==========
3
+ Automatically runs rubocop against your cookbooks on check and upload.
4
+ This is entirely based off of the Foodcritic plugin.
5
+
6
+ Gem Requirements
7
+ ----------------
8
+ This plugin requires the following gems:
9
+
10
+ ```ruby
11
+ gem 'rubocop'
12
+ ```
13
+
14
+ Hooks
15
+ -----
16
+ - `after_check`
17
+ - `before_upload`
18
+
19
+ Configuration
20
+ -------------
21
+ ```yaml
22
+ plugins:
23
+ rubocop:
24
+ epic_fail: true
25
+ show_name: false
26
+ autocorrect: false
27
+ out_file: <file>
28
+ sev_level: <C|W|E>
29
+ lint: false
30
+ ```
31
+
32
+ #### epic_fail:
33
+ If set to true, `epic_fail` will prevent you from uploading a cookbook or further checks from running until rubocop passes.
34
+ - Type: `Boolean`
35
+ - Default: `true`
36
+
37
+ #### The following options are passing command line options to rubocop. See rubocop --help for more details
38
+ #### show_name:
39
+ - Type: `Boolean`
40
+ - Default: `false`
41
+ - Rubocop command line equivilant: "-D"
42
+ Shows the name of the offending rule as well as the decription and line reference.
43
+
44
+ #### autocorrect:
45
+ - Type: `Boolean`
46
+ - Default: `false`
47
+ - Rubocop command line equivilant: "--auto-correct"
48
+ Automatically correct some offenses.
49
+
50
+ #### out_file:
51
+ - Type: `String` - file name
52
+ - Default: nil
53
+ - Rubocop command line equivilant: "--out <file>"
54
+ Redirects the rubocop output to a file instead of STDOUT.
55
+
56
+ #### sev_level:
57
+ - Type: `String`
58
+ - Default: nil
59
+ - Rubocop command line equivilant: "--fail-level [C|W|E]"
60
+ Set the severity level at which Rubocop will fail (see rubocop --help for more).
61
+
62
+ #### lint:
63
+ - Type: `Boolean`
64
+ - Default: `false`
65
+ - Rubocop command line equivilant: "--lint"
66
+ Only run linting rules.
67
+
68
+ #### Example
69
+ ``` ruby
70
+ chef_workstation01$ knife spork check chef-client
71
+ Checking versions for cookbook chef-client...
72
+
73
+ Local Version:
74
+ 3.3.3
75
+
76
+ Remote Versions: (* indicates frozen)
77
+ 3.3.3
78
+ 3.2.0
79
+
80
+ ERROR: The version 3.3.3 exists on the server and is not frozen. Uploading will overwrite!
81
+ Running rubocop against chef-client@3.3.3...
82
+ /home/chef-repo/cookbooks/chef-client
83
+ Inspecting 25 files
84
+ ....CCCCC.CWCCCCCWCCCWCCC
85
+
86
+ Offenses:
87
+
88
+ chef-client/files/default/tests/minitest/config_test.rb:22:53: C: Prefer single-quoted strings when you don't need string interpolation or special symbols.
89
+ file(File.join(node['chef_client']['conf_dir'], "client.rb")).must_exist
90
+ ^^^^^^^^^^^
91
+ chef-client/libraries/helpers.rb:35:72: C: Prefer single-quoted strings when you don't need string interpolation or special symbols.
92
+ Chef::Log.debug("Node has Chef Server Recipe? #{node.recipe?("chef-server")}")
93
+ ^^^^^^^^^^^^^
94
+ chef-client/libraries/helpers.rb:36:70: C: Prefer single-quoted strings when you don't need string interpolation or special symbols.
95
+ Chef::Log.debug("Node has Chef Server Executable? #{system("which chef-server > /dev/null 2>&1")}")
96
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
97
+ chef-client/libraries/helpers.rb:37:74: C: Prefer single-quoted strings when you don't need string interpolation or special symbols.
98
+ Chef::Log.debug("Node has Chef Server Ctl Executable? #{system("which chef-server-ctl > /dev/null 2>&1")}")
99
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
100
+ ...
101
+
102
+ ```
@@ -0,0 +1,47 @@
1
+ Slack
2
+ =======
3
+ Slack posts messages to your Slack client.
4
+
5
+ Gem Requirements
6
+ ----------------
7
+ This plugin requires the following gems:
8
+
9
+ ```ruby
10
+ gem 'slack-notifier'
11
+ ```
12
+
13
+ Hooks
14
+ -----
15
+ - `after_upload`
16
+ - `after_promote`
17
+
18
+ Configuration
19
+ -------------
20
+ ```yaml
21
+ plugins:
22
+ slack:
23
+ api_token: ABC123
24
+ channel: "#operations"
25
+ teamname: myteam
26
+ username: knife
27
+ ```
28
+
29
+ #### api_token
30
+ Your Slack API token.
31
+
32
+ - Type: `String`
33
+
34
+ #### channel
35
+ The channel to post to.
36
+
37
+ - Type: `String`
38
+
39
+ #### teamname
40
+ The teamname of the slack account. ex. https://TEAMNAME.slack.com
41
+
42
+ - Type: `String`
43
+
44
+ #### username
45
+ The username to post as.
46
+
47
+ - Type: `String`
metadata CHANGED
@@ -1,69 +1,69 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knife-spork
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.4
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jon Cowie
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-02 00:00:00.000000000 Z
11
+ date: 2014-08-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chef
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ! '>='
17
+ - - '>='
18
18
  - !ruby/object:Gem::Version
19
19
  version: 11.0.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ! '>='
24
+ - - '>='
25
25
  - !ruby/object:Gem::Version
26
26
  version: 11.0.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: git
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ! '>='
31
+ - - '>='
32
32
  - !ruby/object:Gem::Version
33
33
  version: 1.2.5
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ! '>='
38
+ - - '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: 1.2.5
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: app_conf
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ! '>='
45
+ - - '>='
46
46
  - !ruby/object:Gem::Version
47
47
  version: 0.4.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ! '>='
52
+ - - '>='
53
53
  - !ruby/object:Gem::Version
54
54
  version: 0.4.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: diffy
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ! '>='
59
+ - - '>='
60
60
  - !ruby/object:Gem::Version
61
61
  version: 3.0.1
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ! '>='
66
+ - - '>='
67
67
  - !ruby/object:Gem::Version
68
68
  version: 3.0.1
69
69
  description: KnifeSpork is a workflow plugin for Chef::Knife which helps multiple
@@ -122,6 +122,8 @@ files:
122
122
  - lib/knife-spork/plugins/irccat.rb
123
123
  - lib/knife-spork/plugins/jabber.rb
124
124
  - lib/knife-spork/plugins/plugin.rb
125
+ - lib/knife-spork/plugins/rubocop.rb
126
+ - lib/knife-spork/plugins/slack.rb
125
127
  - lib/knife-spork/plugins/statusnet.rb
126
128
  - lib/knife-spork/runner.rb
127
129
  - plugins/Campfire.md
@@ -134,6 +136,8 @@ files:
134
136
  - plugins/Irccat.md
135
137
  - plugins/Jabber.md
136
138
  - plugins/README.md
139
+ - plugins/Rubocop.md
140
+ - plugins/Slack.md
137
141
  - plugins/StatusNet.md
138
142
  - plugins/Template.md
139
143
  homepage: https://github.com/jonlives/knife-spork
@@ -146,17 +150,17 @@ require_paths:
146
150
  - lib
147
151
  required_ruby_version: !ruby/object:Gem::Requirement
148
152
  requirements:
149
- - - ! '>='
153
+ - - '>='
150
154
  - !ruby/object:Gem::Version
151
155
  version: '0'
152
156
  required_rubygems_version: !ruby/object:Gem::Requirement
153
157
  requirements:
154
- - - ! '>='
158
+ - - '>='
155
159
  - !ruby/object:Gem::Version
156
160
  version: '0'
157
161
  requirements: []
158
162
  rubyforge_project:
159
- rubygems_version: 2.2.1
163
+ rubygems_version: 2.0.14
160
164
  signing_key:
161
165
  specification_version: 4
162
166
  summary: A workflow plugin to help many devs work with the same chef repo/server