stove 2.0.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +6 -1
- data/CHANGELOG.md +20 -0
- data/README.md +34 -80
- data/Rakefile +9 -1
- data/bin/bake +2 -0
- data/bin/stove +4 -0
- data/features/plugins/community.feature +11 -26
- data/features/plugins/git.feature +17 -6
- data/features/step_definitions/community_steps.rb +3 -1
- data/features/step_definitions/config_steps.rb +4 -21
- data/features/step_definitions/git_steps.rb +38 -1
- data/features/support/env.rb +17 -11
- data/features/support/stove/git.rb +28 -8
- data/lib/stove/cli.rb +72 -53
- data/lib/stove/community.rb +16 -67
- data/lib/stove/config.rb +55 -46
- data/lib/stove/cookbook/metadata.rb +3 -5
- data/lib/stove/cookbook.rb +2 -41
- data/lib/stove/error.rb +37 -8
- data/lib/stove/filter.rb +2 -1
- data/lib/stove/mixins/instanceable.rb +3 -2
- data/lib/stove/mixins/validatable.rb +5 -1
- data/lib/stove/packager.rb +11 -3
- data/lib/stove/plugins/base.rb +26 -13
- data/lib/stove/plugins/community.rb +3 -7
- data/lib/stove/plugins/git.rb +27 -30
- data/lib/stove/rake_task.rb +3 -63
- data/lib/stove/runner.rb +16 -65
- data/lib/stove/validator.rb +7 -6
- data/lib/stove/version.rb +1 -1
- data/lib/stove.rb +3 -21
- data/spec/spec_helper.rb +2 -0
- data/spec/unit/error_spec.rb +148 -0
- data/stove.gemspec +10 -14
- data/templates/errors/abstract_method.erb +5 -0
- data/templates/errors/community_category_validation_failed.erb +5 -0
- data/templates/errors/community_key_validation_failed.erb +3 -0
- data/templates/errors/community_username_validation_failed.erb +3 -0
- data/templates/errors/git_clean_validation_failed.erb +1 -0
- data/templates/errors/git_failed.erb +5 -0
- data/templates/errors/git_repository_validation_failed.erb +3 -0
- data/templates/errors/git_up_to_date_validation_failed.erb +7 -0
- data/templates/errors/metadata_not_found.erb +1 -0
- data/templates/errors/server_unavailable.erb +1 -0
- data/templates/errors/stove_error.erb +1 -0
- metadata +32 -114
- data/features/actions/bump.feature +0 -22
- data/features/actions/changelog.feature +0 -52
- data/features/actions/dev.feature +0 -18
- data/features/actions/upload.feature +0 -26
- data/features/rake.feature +0 -15
- data/features/step_definitions/cli_steps.rb +0 -3
- data/lib/stove/actions/base.rb +0 -21
- data/lib/stove/actions/bump.rb +0 -25
- data/lib/stove/actions/changelog.rb +0 -71
- data/lib/stove/actions/dev.rb +0 -22
- data/lib/stove/actions/finish.rb +0 -8
- data/lib/stove/actions/start.rb +0 -7
- data/lib/stove/actions/upload.rb +0 -11
- data/lib/stove/jira.rb +0 -88
- data/lib/stove/middlewares/chef_authentication.rb +0 -60
- data/lib/stove/middlewares/exceptions.rb +0 -17
- data/lib/stove/mixins/filterable.rb +0 -11
- data/lib/stove/plugins/github.rb +0 -107
- data/lib/stove/plugins/jira.rb +0 -72
- data/locales/en.yml +0 -230
data/lib/stove/plugins/base.rb
CHANGED
@@ -1,35 +1,48 @@
|
|
1
1
|
module Stove
|
2
2
|
class Plugin::Base
|
3
|
-
extend Mixin::Filterable
|
4
3
|
include Logify
|
4
|
+
|
5
5
|
extend Mixin::Optionable
|
6
6
|
extend Mixin::Validatable
|
7
7
|
|
8
|
-
option :id
|
9
|
-
option :description
|
10
|
-
|
11
8
|
class << self
|
12
|
-
def
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
@onload
|
9
|
+
def run(description, &block)
|
10
|
+
actions << Proc.new do |instance|
|
11
|
+
log.info { description }
|
12
|
+
instance.instance_eval(&block)
|
17
13
|
end
|
18
14
|
end
|
15
|
+
|
16
|
+
def actions
|
17
|
+
@actions ||= []
|
18
|
+
end
|
19
19
|
end
|
20
20
|
|
21
|
+
option :id
|
22
|
+
option :description
|
23
|
+
|
21
24
|
attr_reader :cookbook
|
22
25
|
attr_reader :options
|
23
26
|
|
24
27
|
def initialize(cookbook, options = {})
|
25
28
|
@cookbook, @options = cookbook, options
|
26
|
-
instance_eval(&onload)
|
27
29
|
end
|
28
30
|
|
29
|
-
|
31
|
+
def run
|
32
|
+
run_validations
|
33
|
+
run_actions
|
34
|
+
end
|
30
35
|
|
31
|
-
def
|
32
|
-
self.class.
|
36
|
+
def run_validations
|
37
|
+
self.class.validations.each do |id, validation|
|
38
|
+
validation.run(cookbook, options)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def run_actions
|
43
|
+
self.class.actions.each do |action|
|
44
|
+
action.call(self)
|
45
|
+
end
|
33
46
|
end
|
34
47
|
end
|
35
48
|
end
|
@@ -3,23 +3,19 @@ module Stove
|
|
3
3
|
id 'community'
|
4
4
|
description 'Publish the release to the Chef community site'
|
5
5
|
|
6
|
-
validate(:configuration) do
|
7
|
-
Config.has_key?(:community)
|
8
|
-
end
|
9
|
-
|
10
6
|
validate(:username) do
|
11
|
-
Config
|
7
|
+
Config.username
|
12
8
|
end
|
13
9
|
|
14
10
|
validate(:key) do
|
15
|
-
Config
|
11
|
+
Config.key
|
16
12
|
end
|
17
13
|
|
18
14
|
validate(:category) do
|
19
15
|
!cookbook.category.nil?
|
20
16
|
end
|
21
17
|
|
22
|
-
|
18
|
+
run('Publishing the release to the Chef community site') do
|
23
19
|
Community.upload(cookbook)
|
24
20
|
end
|
25
21
|
end
|
data/lib/stove/plugins/git.rb
CHANGED
@@ -13,48 +13,37 @@ module Stove
|
|
13
13
|
|
14
14
|
validate(:up_to_date) do
|
15
15
|
git_null('fetch')
|
16
|
-
|
17
|
-
|
16
|
+
local_sha = git_null("rev-parse #{branch}").strip
|
17
|
+
remote_sha = git_null("rev-parse #{remote}/#{branch}").strip
|
18
18
|
|
19
|
-
log.debug("Local SHA: #{
|
20
|
-
log.debug("Remote SHA: #{
|
19
|
+
log.debug("Local SHA: #{local_sha}")
|
20
|
+
log.debug("Remote SHA: #{remote_sha}")
|
21
21
|
|
22
|
-
|
22
|
+
local_sha == remote_sha
|
23
23
|
end
|
24
24
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
end
|
29
|
-
|
30
|
-
after(:changelog, 'Committing CHANGELOG') do
|
31
|
-
git %|add CHANGELOG.md|
|
32
|
-
git %|commit -m "Publish #{cookbook.version} Changelog"|
|
33
|
-
end
|
25
|
+
run('Tagging new release') do
|
26
|
+
annotation_type = options[:sign] ? '-s' : '-a'
|
27
|
+
tag = cookbook.tag_version
|
34
28
|
|
35
|
-
|
36
|
-
git %|
|
37
|
-
git %|push #{
|
29
|
+
git %|tag #{annotation_type} #{tag} -m "Release #{tag}"|
|
30
|
+
git %|push #{remote} #{branch}|
|
31
|
+
git %|push #{remote} #{tag}|
|
38
32
|
end
|
39
33
|
|
40
|
-
|
41
|
-
git %|add metadata.rb|
|
42
|
-
git %|commit -m "Version bump to #{cookbook.version} (for development)"|
|
43
|
-
end
|
44
|
-
|
45
|
-
before(:finish, 'Pushing to git remote(s)') do
|
46
|
-
git %|push #{options[:remote]} #{options[:branch]}|
|
47
|
-
end
|
34
|
+
private
|
48
35
|
|
49
36
|
def git(command, errors = true)
|
50
37
|
log.debug("Running `git #{command}', errors: #{errors}")
|
51
|
-
|
38
|
+
Dir.chdir(cookbook.path) do
|
39
|
+
response = %x|git #{command}|
|
52
40
|
|
53
|
-
|
54
|
-
|
55
|
-
|
41
|
+
if errors && !$?.success?
|
42
|
+
raise Error::GitFailed.new(command: command)
|
43
|
+
end
|
56
44
|
|
57
|
-
|
45
|
+
response
|
46
|
+
end
|
58
47
|
end
|
59
48
|
|
60
49
|
def git_null(command)
|
@@ -67,5 +56,13 @@ module Stove
|
|
67
56
|
|
68
57
|
git("#{command} 2>#{null}", false)
|
69
58
|
end
|
59
|
+
|
60
|
+
def remote
|
61
|
+
options[:remote]
|
62
|
+
end
|
63
|
+
|
64
|
+
def branch
|
65
|
+
options[:branch]
|
66
|
+
end
|
70
67
|
end
|
71
68
|
end
|
data/lib/stove/rake_task.rb
CHANGED
@@ -2,81 +2,21 @@ require 'rake'
|
|
2
2
|
require 'rake/tasklib'
|
3
3
|
require 'stove'
|
4
4
|
|
5
|
-
#
|
6
|
-
# @todo Most of these options are duplicated from the CLI, can we unify?
|
7
|
-
#
|
8
5
|
module Stove
|
9
6
|
class RakeTask < Rake::TaskLib
|
10
|
-
|
11
|
-
|
12
|
-
class << self
|
13
|
-
#
|
14
|
-
# Define a CLI option.
|
15
|
-
#
|
16
|
-
# @param [Symbol] option
|
17
|
-
#
|
18
|
-
def option(option)
|
19
|
-
define_method("#{option}=".to_sym) do |value|
|
20
|
-
log.debug("Setting #{option} = #{value.inspect}")
|
21
|
-
options[option.to_sym] = value
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
# Actions
|
27
|
-
Action.constants.map(&Action.method(:const_get)).select(&:id).each do |action|
|
28
|
-
option action.id
|
29
|
-
end
|
30
|
-
|
31
|
-
# Plugins
|
32
|
-
Plugin.constants.map(&Plugin.method(:const_get)).select(&:id).each do |plugin|
|
33
|
-
option plugin.id
|
34
|
-
end
|
35
|
-
|
36
|
-
option :category
|
37
|
-
option :path
|
38
|
-
option :remote
|
39
|
-
option :branch
|
7
|
+
attr_accessor :stove_opts
|
40
8
|
|
41
9
|
def initialize(name = nil)
|
42
10
|
yield self if block_given?
|
43
11
|
|
44
12
|
desc 'Publish this cookbook' unless ::Rake.application.last_comment
|
45
|
-
task(name || :publish
|
46
|
-
|
47
|
-
|
48
|
-
cookbook = Cookbook.new(options[:path])
|
49
|
-
options[:version] = args[:version] || minor_bump(cookbook.version)
|
50
|
-
Runner.run(cookbook, options)
|
13
|
+
task(name || :publish) do |t, args|
|
14
|
+
Cli.new(stove_opts || []).execute!
|
51
15
|
end
|
52
16
|
end
|
53
17
|
|
54
|
-
def locale=(locale)
|
55
|
-
log.debug("Setting locale = #{locale.inspect}")
|
56
|
-
I18n.locale = locale
|
57
|
-
end
|
58
|
-
|
59
18
|
def log_level=(level)
|
60
|
-
log.debug("Setting log_level = #{level.inspect}")
|
61
19
|
Stove.log_level = level
|
62
20
|
end
|
63
|
-
|
64
|
-
private
|
65
|
-
|
66
|
-
def minor_bump(version)
|
67
|
-
split = version.split('.').map(&:to_i)
|
68
|
-
split[2] += 1
|
69
|
-
split.join('.')
|
70
|
-
end
|
71
|
-
|
72
|
-
def options
|
73
|
-
@options ||= Hash.new(true).tap do |h|
|
74
|
-
h[:path] = Dir.pwd
|
75
|
-
h[:jira] = false
|
76
|
-
|
77
|
-
h[:remote] = 'origin'
|
78
|
-
h[:branch] = 'master'
|
79
|
-
end
|
80
|
-
end
|
81
21
|
end
|
82
22
|
end
|
data/lib/stove/runner.rb
CHANGED
@@ -1,84 +1,35 @@
|
|
1
1
|
module Stove
|
2
2
|
class Runner
|
3
|
-
include Mixin::Instanceable
|
4
3
|
include Logify
|
5
|
-
include Mixin::Optionable
|
6
|
-
|
7
|
-
class << self
|
8
|
-
def action(id)
|
9
|
-
actions << id
|
10
|
-
filters[id] = { before: [], after: [] }
|
11
|
-
end
|
12
|
-
end
|
13
4
|
|
14
5
|
attr_reader :cookbook
|
15
6
|
attr_reader :options
|
16
|
-
attr_reader :validations
|
17
|
-
|
18
|
-
option :actions, []
|
19
|
-
option :filters, {}
|
20
|
-
|
21
|
-
action :start
|
22
|
-
action :bump
|
23
|
-
action :changelog
|
24
|
-
action :upload
|
25
|
-
action :dev
|
26
|
-
action :finish
|
27
7
|
|
28
|
-
def initialize
|
29
|
-
@
|
8
|
+
def initialize(cookbook, options = {})
|
9
|
+
@cookbook = cookbook
|
10
|
+
@options = options
|
30
11
|
end
|
31
12
|
|
32
|
-
def run
|
33
|
-
|
34
|
-
|
35
|
-
run_validations
|
36
|
-
run_actions
|
13
|
+
def run
|
14
|
+
run_plugin :git
|
15
|
+
run_plugin :community
|
37
16
|
end
|
38
17
|
|
39
18
|
private
|
40
19
|
|
41
|
-
def
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
log.debug("Skipping action `#{action}' and filters")
|
49
|
-
else
|
50
|
-
run_filters(:before, action)
|
51
|
-
|
52
|
-
klass = Action.const_get(Util.camelize(action))
|
53
|
-
klass.new(cookbook, options).run
|
54
|
-
|
55
|
-
run_filters(:after, action)
|
56
|
-
end
|
20
|
+
def run_plugin(name)
|
21
|
+
if skip?(name)
|
22
|
+
log.info { "Skipping plugin `:#{name}'" }
|
23
|
+
else
|
24
|
+
log.info { "Running plugin `:#{name}'" }
|
25
|
+
klass = Plugin.const_get(Util.camelize(name))
|
26
|
+
klass.new(cookbook, options).run
|
57
27
|
end
|
58
28
|
end
|
59
29
|
|
60
|
-
def
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
if skip?(plugin)
|
65
|
-
log.debug("Skipping filter `#{filter.message}'")
|
66
|
-
else
|
67
|
-
filter.run(cookbook, options)
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
def run_validations
|
73
|
-
validations.each do |validation|
|
74
|
-
parent = validation.klass.id
|
75
|
-
|
76
|
-
if skip?(parent)
|
77
|
-
log.debug("Skipping validation `#{validation.id}' for `#{parent}'")
|
78
|
-
else
|
79
|
-
validation.run(cookbook, options)
|
80
|
-
end
|
81
|
-
end
|
30
|
+
def skip?(thing)
|
31
|
+
key = "no_#{thing}".to_sym
|
32
|
+
!!options[key]
|
82
33
|
end
|
83
34
|
end
|
84
35
|
end
|
data/lib/stove/validator.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
module Stove
|
2
2
|
class Validator
|
3
|
-
include Mixin::Insideable
|
4
3
|
include Logify
|
5
4
|
|
5
|
+
include Mixin::Insideable
|
6
|
+
|
6
7
|
#
|
7
8
|
# The class that created this validator.
|
8
9
|
#
|
@@ -48,16 +49,16 @@ module Stove
|
|
48
49
|
# the cookbook to run this validation against
|
49
50
|
#
|
50
51
|
def run(cookbook, options = {})
|
51
|
-
log.info("Running validations for
|
52
|
+
log.info("Running validations for `#{klass.id}.#{id}'")
|
52
53
|
|
53
54
|
inside(cookbook) do
|
54
55
|
instance = klass.new(cookbook, options)
|
55
56
|
unless result = instance.instance_eval(&block)
|
56
57
|
log.debug("Validation failed, result: #{result.inspect}")
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
)
|
58
|
+
|
59
|
+
# Convert the class and id to their magical equivalents
|
60
|
+
error = Error.const_get("#{Util.camelize(klass.id)}#{Util.camelize(id)}ValidationFailed")
|
61
|
+
raise error.new(path: Dir.pwd, result: result)
|
61
62
|
end
|
62
63
|
end
|
63
64
|
|
data/lib/stove/version.rb
CHANGED
data/lib/stove.rb
CHANGED
@@ -2,13 +2,12 @@ require 'logify'
|
|
2
2
|
require 'pathname'
|
3
3
|
|
4
4
|
module Stove
|
5
|
-
autoload :Config, 'stove/config'
|
6
5
|
autoload :Community, 'stove/community'
|
6
|
+
autoload :Config, 'stove/config'
|
7
7
|
autoload :Cookbook, 'stove/cookbook'
|
8
8
|
autoload :Cli, 'stove/cli'
|
9
9
|
autoload :Error, 'stove/error'
|
10
10
|
autoload :Filter, 'stove/filter'
|
11
|
-
autoload :JIRA, 'stove/jira'
|
12
11
|
autoload :Mash, 'stove/mash'
|
13
12
|
autoload :Packager, 'stove/packager'
|
14
13
|
autoload :Runner, 'stove/runner'
|
@@ -16,23 +15,12 @@ module Stove
|
|
16
15
|
autoload :Validator, 'stove/validator'
|
17
16
|
autoload :VERSION, 'stove/version'
|
18
17
|
|
19
|
-
module Action
|
20
|
-
autoload :Base, 'stove/actions/base'
|
21
|
-
autoload :Bump, 'stove/actions/bump'
|
22
|
-
autoload :Changelog, 'stove/actions/changelog'
|
23
|
-
autoload :Dev, 'stove/actions/dev'
|
24
|
-
autoload :Finish, 'stove/actions/finish'
|
25
|
-
autoload :Start, 'stove/actions/start'
|
26
|
-
autoload :Upload, 'stove/actions/upload'
|
27
|
-
end
|
28
|
-
|
29
18
|
module Middleware
|
30
19
|
autoload :ChefAuthentication, 'stove/middlewares/chef_authentication'
|
31
20
|
autoload :Exceptions, 'stove/middlewares/exceptions'
|
32
21
|
end
|
33
22
|
|
34
23
|
module Mixin
|
35
|
-
autoload :Filterable, 'stove/mixins/filterable'
|
36
24
|
autoload :Insideable, 'stove/mixins/insideable'
|
37
25
|
autoload :Instanceable, 'stove/mixins/instanceable'
|
38
26
|
autoload :Optionable, 'stove/mixins/optionable'
|
@@ -43,8 +31,6 @@ module Stove
|
|
43
31
|
autoload :Base, 'stove/plugins/base'
|
44
32
|
autoload :Community, 'stove/plugins/community'
|
45
33
|
autoload :Git, 'stove/plugins/git'
|
46
|
-
autoload :GitHub, 'stove/plugins/github'
|
47
|
-
autoload :JIRA, 'stove/plugins/jira'
|
48
34
|
end
|
49
35
|
|
50
36
|
#
|
@@ -80,11 +66,11 @@ module Stove
|
|
80
66
|
# @example Set the log level to :info
|
81
67
|
# ChefAPI.log_level = :info
|
82
68
|
#
|
83
|
-
# @param [
|
69
|
+
# @param [#to_sym] level
|
84
70
|
# the log level to set
|
85
71
|
#
|
86
72
|
def log_level=(level)
|
87
|
-
Logify.level = level
|
73
|
+
Logify.level = level.to_sym
|
88
74
|
end
|
89
75
|
|
90
76
|
#
|
@@ -97,7 +83,3 @@ module Stove
|
|
97
83
|
end
|
98
84
|
end
|
99
85
|
end
|
100
|
-
|
101
|
-
require 'i18n'
|
102
|
-
I18n.enforce_available_locales = true
|
103
|
-
I18n.load_path << Dir[Stove.root.join('locales', '*.yml').to_s]
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,148 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Stove::Error
|
4
|
+
describe StoveError do
|
5
|
+
it 'raises an exception with the correct message' do
|
6
|
+
expect { raise described_class }.to raise_error { |error|
|
7
|
+
expect(error).to be_a(described_class)
|
8
|
+
expect(error.message).to eq <<-EOH.gsub(/^ {10}/, '')
|
9
|
+
Oh no! Something really bad happened. I am not sure what actually happened because this is the catch-all error, but you should most definitely report an issue on GitHub at https://github.com/sethvargo/stove.
|
10
|
+
EOH
|
11
|
+
}
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
describe GitFailed do
|
16
|
+
it 'raises an exception with the correct message' do
|
17
|
+
expect { raise described_class.new(command: 'foo') }.to raise_error { |error|
|
18
|
+
expect(error).to be_a(described_class)
|
19
|
+
expect(error.message).to eq <<-EOH.gsub(/^ {10}/, '')
|
20
|
+
An error occurred while running:
|
21
|
+
|
22
|
+
git foo
|
23
|
+
|
24
|
+
There is likely an informative message from git that explains what happened right above this message.
|
25
|
+
EOH
|
26
|
+
}
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe MetadataNotFound do
|
31
|
+
it 'raises an exception with the correct message' do
|
32
|
+
expect { raise described_class.new(path: '/path') }.to raise_error { |error|
|
33
|
+
expect(error).to be_a(described_class)
|
34
|
+
expect(error.message).to eq <<-EOH.gsub(/^ {10}/, '')
|
35
|
+
The file at `/path' does not exist or does not contain valid metadata. Please make sure you have specified the correct path and that the metdata file exists.
|
36
|
+
EOH
|
37
|
+
}
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
describe ServerUnavailable do
|
42
|
+
it 'raises an exception with the correct message' do
|
43
|
+
expect { raise described_class.new(url: 'http://server') }.to raise_error { |error|
|
44
|
+
expect(error).to be_a(described_class)
|
45
|
+
expect(error.message).to eq <<-EOH.gsub(/^ {10}/, '')
|
46
|
+
The server at `http://server' is unavailable or is not currently accepting client connections. Please ensure the server is accessible via ping (or telnet) on your local network. If this error persists, please contact your network administrator.
|
47
|
+
EOH
|
48
|
+
}
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
describe CommunityCategoryValidationFailed do
|
53
|
+
it 'raises an exception with the correct message' do
|
54
|
+
expect { raise described_class }.to raise_error { |error|
|
55
|
+
expect(error).to be_a(described_class)
|
56
|
+
expect(error.message).to eq <<-EOH.gsub(/^ {10}/, '')
|
57
|
+
You did not specify a category! The Chef community site requires all cookbooks belong to a category. For existing cookboks, Stove can query the Chef community site API and automatically complete the category for you. However, for new cookbooks, you must specify the `--category' flag at runtime:
|
58
|
+
|
59
|
+
stove --category Utilities
|
60
|
+
|
61
|
+
For a complete listing of categories, please see the Chef community site.
|
62
|
+
EOH
|
63
|
+
}
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
describe CommunityKeyValidationFailed do
|
68
|
+
it 'raises an exception with the correct message' do
|
69
|
+
expect { raise described_class }.to raise_error { |error|
|
70
|
+
expect(error).to be_a(described_class)
|
71
|
+
expect(error.message).to eq <<-EOH.gsub(/^ {10}/, '')
|
72
|
+
You did not specify the path to a private key! The Chef community site requires a private key for authentication:
|
73
|
+
|
74
|
+
stove --key ~/.chef/sethvargo.pem
|
75
|
+
EOH
|
76
|
+
}
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
describe CommunityUsernameValidationFailed do
|
81
|
+
it 'raises an exception with the correct message' do
|
82
|
+
expect { raise described_class }.to raise_error { |error|
|
83
|
+
expect(error).to be_a(described_class)
|
84
|
+
expect(error.message).to eq <<-EOH.gsub(/^ {10}/, '')
|
85
|
+
You did not specify the username to authenticate with! The Chef community site requires a username for authentication:
|
86
|
+
|
87
|
+
stove --username sethvargo
|
88
|
+
EOH
|
89
|
+
}
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
describe GitCleanValidationFailed do
|
94
|
+
it 'raises an exception with the correct message' do
|
95
|
+
expect { raise described_class.new(path: '/path') }.to raise_error { |error|
|
96
|
+
expect(error).to be_a(described_class)
|
97
|
+
expect(error.message).to eq <<-EOH.gsub(/^ {10}/, '')
|
98
|
+
The cookbook at `/path' has untracked files! In order to use the git plugin, you must have a clean working directory. Please commit or stash your changes before running Stove again.
|
99
|
+
EOH
|
100
|
+
}
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
describe GitRepositoryValidationFailed do
|
105
|
+
it 'raises an exception with the correct message' do
|
106
|
+
expect { raise described_class.new(path: '/path') }.to raise_error { |error|
|
107
|
+
expect(error).to be_a(described_class)
|
108
|
+
expect(error.message).to eq <<-EOH.gsub(/^ {10}/, '')
|
109
|
+
The cookbook at `/path' does not appear to be a valid git repository. In order to use the git plugin, your cookbook must be initialized as a git repository. To create a git repository, run:
|
110
|
+
|
111
|
+
git init /path
|
112
|
+
EOH
|
113
|
+
}
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
describe GitUpToDateValidationFailed do
|
118
|
+
it 'raises an exception with the correct message' do
|
119
|
+
expect { raise described_class.new(path: '/path') }.to raise_error { |error|
|
120
|
+
expect(error).to be_a(described_class)
|
121
|
+
expect(error.message).to eq <<-EOH.gsub(/^ {10}/, '')
|
122
|
+
The cookbook at `/path' is out of sync with the remote repository. Please update your local cache with the remote repository before continuing:
|
123
|
+
|
124
|
+
git pull
|
125
|
+
|
126
|
+
And then push your local changes to the remote repository:
|
127
|
+
|
128
|
+
git push
|
129
|
+
EOH
|
130
|
+
}
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
describe GitFailed do
|
135
|
+
it 'raises an exception with the correct message' do
|
136
|
+
expect { raise described_class.new(command: 'run') }.to raise_error { |error|
|
137
|
+
expect(error).to be_a(described_class)
|
138
|
+
expect(error.message).to eq <<-EOH.gsub(/^ {10}/, '')
|
139
|
+
An error occurred while running:
|
140
|
+
|
141
|
+
git run
|
142
|
+
|
143
|
+
There is likely an informative message from git that explains what happened right above this message.
|
144
|
+
EOH
|
145
|
+
}
|
146
|
+
end
|
147
|
+
end
|
148
|
+
end
|
data/stove.gemspec
CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.version = Stove::VERSION
|
9
9
|
spec.authors = ['Seth Vargo']
|
10
10
|
spec.email = ['sethvargo@gmail.com']
|
11
|
-
spec.description =
|
12
|
-
spec.summary =
|
11
|
+
spec.description = "A utility for releasing Chef community cookbooks"
|
12
|
+
spec.summary = "A command-line utility for releasing Chef community cookbooks"
|
13
13
|
spec.homepage = 'https://github.com/sethvargo/stove'
|
14
14
|
spec.license = 'Apache 2.0'
|
15
15
|
|
@@ -18,20 +18,16 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ['lib']
|
20
20
|
|
21
|
-
|
22
|
-
spec.add_dependency 'faraday', '~> 0.8.9'
|
23
|
-
spec.add_dependency 'faraday_middleware', '~> 0.9.0'
|
24
|
-
spec.add_dependency 'i18n', '~> 0.6'
|
21
|
+
spec.required_ruby_version = '>= 1.9'
|
25
22
|
|
26
|
-
|
27
|
-
spec.add_dependency '
|
28
|
-
spec.add_dependency '
|
29
|
-
spec.add_dependency '
|
30
|
-
spec.add_dependency 'solve', '~> 0.8'
|
23
|
+
# Runtime dependencies
|
24
|
+
spec.add_dependency 'chef-api', '~> 0.4'
|
25
|
+
spec.add_dependency 'logify', '~> 0.2'
|
26
|
+
spec.add_dependency 'minitar', '~> 0.5'
|
31
27
|
|
32
|
-
spec.add_development_dependency 'aruba', '~> 0.
|
33
|
-
spec.add_development_dependency 'bundler', '~> 1.
|
28
|
+
spec.add_development_dependency 'aruba', '~> 0.6'
|
29
|
+
spec.add_development_dependency 'bundler', '~> 1.6'
|
34
30
|
spec.add_development_dependency 'community-zero', '~> 2.0'
|
35
31
|
spec.add_development_dependency 'rake'
|
36
|
-
spec.add_development_dependency 'rspec', '~>
|
32
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
37
33
|
end
|
@@ -0,0 +1,5 @@
|
|
1
|
+
'<%= @method %>' is an abstract method. You must override this method in your subclass with the proper implementation and logic. For more information, please see the inline documentation for <%= @method %>. If you are not a developer, this is most likely a bug in the ChefAPI gem. Please file a bug report at:
|
2
|
+
|
3
|
+
https://github.com/sethvargo/stove/issues/new
|
4
|
+
|
5
|
+
and include the command(s) or code you ran to arrive at this error.
|
@@ -0,0 +1,5 @@
|
|
1
|
+
You did not specify a category! The Chef community site requires all cookbooks belong to a category. For existing cookboks, Stove can query the Chef community site API and automatically complete the category for you. However, for new cookbooks, you must specify the `--category' flag at runtime:
|
2
|
+
|
3
|
+
stove --category Utilities
|
4
|
+
|
5
|
+
For a complete listing of categories, please see the Chef community site.
|