chef-stove 7.1.5 → 7.1.6
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 +4 -4
- data/lib/stove.rb +6 -6
- data/lib/stove/cli.rb +7 -8
- data/lib/stove/config.rb +1 -2
- data/lib/stove/cookbook.rb +0 -2
- data/lib/stove/cookbook/metadata.rb +2 -2
- data/lib/stove/filter.rb +1 -3
- data/lib/stove/log.rb +25 -0
- data/lib/stove/packager.rb +0 -2
- data/lib/stove/plugins/base.rb +1 -3
- data/lib/stove/plugins/git.rb +4 -4
- data/lib/stove/runner.rb +2 -4
- data/lib/stove/validator.rb +3 -5
- data/lib/stove/version.rb +1 -1
- metadata +8 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f98625c4f5efd8b003bca41854d70dbe4b18e0693b0af2a72744b70cf1ba016f
|
4
|
+
data.tar.gz: fbdc44771d81e6586315fc63e9a6e502707f52abdefe51ba1da39d5ee68b07ff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e581cc745e4ce75325d6f821b5c89a5c7ba584c13a8215e2f05ef856fb2a083bad96f91db22080cdf94847171ab6407f5c6b89b77a73881443f50d681ef944d0
|
7
|
+
data.tar.gz: 052ebde245c6bad0dece9b9a935ae6abd2542ccec1246bdb7b41929ea0ba7704538824854c615a0187b3fbfe3a5613557217ba3d4c2235e4283fd57d1e4d6cf8
|
data/lib/stove.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'logify'
|
2
1
|
require 'pathname'
|
3
2
|
|
4
3
|
module Stove
|
@@ -15,6 +14,7 @@ module Stove
|
|
15
14
|
autoload :Util, 'stove/util'
|
16
15
|
autoload :Validator, 'stove/validator'
|
17
16
|
autoload :VERSION, 'stove/version'
|
17
|
+
autoload :Log, 'stove/log'
|
18
18
|
|
19
19
|
module Middleware
|
20
20
|
autoload :ChefAuthentication, 'stove/middlewares/chef_authentication'
|
@@ -53,7 +53,7 @@ module Stove
|
|
53
53
|
|
54
54
|
class << self
|
55
55
|
#
|
56
|
-
# The source root of the
|
56
|
+
# The source root of the Stove gem. This is useful when requiring files
|
57
57
|
# that are relative to the root of the project.
|
58
58
|
#
|
59
59
|
# @return [Pathname]
|
@@ -66,13 +66,13 @@ module Stove
|
|
66
66
|
# Set the log level.
|
67
67
|
#
|
68
68
|
# @example Set the log level to :info
|
69
|
-
#
|
69
|
+
# Stove.log_level = :info
|
70
70
|
#
|
71
71
|
# @param [#to_sym] level
|
72
72
|
# the log level to set
|
73
73
|
#
|
74
|
-
def log_level=(
|
75
|
-
|
74
|
+
def log_level=(lev)
|
75
|
+
Stove::Log.level = lev.to_sym
|
76
76
|
end
|
77
77
|
|
78
78
|
#
|
@@ -81,7 +81,7 @@ module Stove
|
|
81
81
|
# @return [Symbol]
|
82
82
|
#
|
83
83
|
def log_level
|
84
|
-
|
84
|
+
Stove::Log.level
|
85
85
|
end
|
86
86
|
end
|
87
87
|
end
|
data/lib/stove/cli.rb
CHANGED
@@ -3,8 +3,6 @@ require 'stove'
|
|
3
3
|
|
4
4
|
module Stove
|
5
5
|
class Cli
|
6
|
-
include Logify
|
7
|
-
|
8
6
|
def initialize(argv, stdin=STDIN, stdout=STDOUT, stderr=STDERR, kernel=Kernel)
|
9
7
|
@argv, @stdin, @stdout, @stderr, @kernel = argv, stdin, stdout, stderr, kernel
|
10
8
|
end
|
@@ -48,8 +46,8 @@ module Stove
|
|
48
46
|
|
49
47
|
# Useful debugging output for when people type the wrong fucking command
|
50
48
|
# and then open an issue like it's somehow my fault
|
51
|
-
|
52
|
-
|
49
|
+
Stove::Log.info("Options: #{options.inspect}")
|
50
|
+
Stove::Log.info("ARGV: #{@argv.inspect}")
|
53
51
|
|
54
52
|
# Make a new cookbook object - this will raise an exception if there is
|
55
53
|
# no cookbook at the given path
|
@@ -62,10 +60,11 @@ module Stove
|
|
62
60
|
# If we got this far, everything was successful :)
|
63
61
|
@kernel.exit(0)
|
64
62
|
rescue => e
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
63
|
+
Stove::Log.init($stderr)
|
64
|
+
Stove::Log.error('Stove experienced an error!')
|
65
|
+
Stove::Log.error(e.class.name)
|
66
|
+
Stove::Log.error(e.message)
|
67
|
+
Stove::Log.error(e.backtrace.join("\n"))
|
69
68
|
|
70
69
|
@kernel.exit(e.respond_to?(:exit_code) ? e.exit_code : 500)
|
71
70
|
ensure
|
data/lib/stove/config.rb
CHANGED
@@ -3,7 +3,6 @@ require 'json'
|
|
3
3
|
|
4
4
|
module Stove
|
5
5
|
class Config
|
6
|
-
include Logify
|
7
6
|
include Mixin::Instanceable
|
8
7
|
|
9
8
|
def method_missing(m, *args, &block)
|
@@ -69,7 +68,7 @@ module Stove
|
|
69
68
|
|
70
69
|
@__raw__
|
71
70
|
rescue Errno::ENOENT => e
|
72
|
-
|
71
|
+
Stove::Log.warn { "No config file found at `#{__path__}'!" }
|
73
72
|
@__raw__ = {}
|
74
73
|
end
|
75
74
|
end
|
data/lib/stove/cookbook.rb
CHANGED
@@ -3,9 +3,9 @@ require 'json'
|
|
3
3
|
module Stove
|
4
4
|
class Cookbook
|
5
5
|
# Borrowed and modified from:
|
6
|
-
# {https://raw.github.com/
|
6
|
+
# {https://raw.github.com/chef/chef/11.4.0/lib/chef/cookbook/metadata.rb}
|
7
7
|
#
|
8
|
-
# Copyright:: Copyright 2008-
|
8
|
+
# Copyright:: Copyright 2008-2019 Chef Software, Inc.
|
9
9
|
#
|
10
10
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
11
11
|
# you may not use this file except in compliance with the License.
|
data/lib/stove/filter.rb
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
module Stove
|
2
2
|
class Filter
|
3
|
-
include Logify
|
4
|
-
|
5
3
|
include Mixin::Insideable
|
6
4
|
|
7
5
|
#
|
@@ -49,7 +47,7 @@ module Stove
|
|
49
47
|
# the cookbook to run this filter against
|
50
48
|
#
|
51
49
|
def run(cookbook, options = {})
|
52
|
-
|
50
|
+
Stove::Log.info(message)
|
53
51
|
instance = klass.new(cookbook, options)
|
54
52
|
|
55
53
|
inside(cookbook) do
|
data/lib/stove/log.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
#
|
2
|
+
# Copyright:: 2019 Chef Software, Inc.
|
3
|
+
# License:: Apache License, Version 2.0
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
#
|
17
|
+
|
18
|
+
require 'mixlib/log'
|
19
|
+
|
20
|
+
module Stove
|
21
|
+
class Log
|
22
|
+
extend Mixlib::Log
|
23
|
+
Mixlib::Log::Formatter.show_time = false
|
24
|
+
end
|
25
|
+
end
|
data/lib/stove/packager.rb
CHANGED
data/lib/stove/plugins/base.rb
CHANGED
@@ -1,14 +1,12 @@
|
|
1
1
|
module Stove
|
2
2
|
class Plugin::Base
|
3
|
-
include Logify
|
4
|
-
|
5
3
|
extend Mixin::Optionable
|
6
4
|
extend Mixin::Validatable
|
7
5
|
|
8
6
|
class << self
|
9
7
|
def run(description, &block)
|
10
8
|
actions << Proc.new do |instance|
|
11
|
-
|
9
|
+
Stove::Log.info { description }
|
12
10
|
instance.instance_eval(&block)
|
13
11
|
end
|
14
12
|
end
|
data/lib/stove/plugins/git.rb
CHANGED
@@ -16,8 +16,8 @@ module Stove
|
|
16
16
|
local_sha = git_null("rev-parse #{branch}").strip
|
17
17
|
remote_sha = git_null("rev-parse #{remote}/#{branch}").strip
|
18
18
|
|
19
|
-
|
20
|
-
|
19
|
+
Stove::Log.debug("Local SHA: #{local_sha}")
|
20
|
+
Stove::Log.debug("Remote SHA: #{remote_sha}")
|
21
21
|
|
22
22
|
local_sha == remote_sha
|
23
23
|
end
|
@@ -34,8 +34,8 @@ module Stove
|
|
34
34
|
private
|
35
35
|
|
36
36
|
def git(command, errors = true)
|
37
|
-
|
38
|
-
|
37
|
+
Stove::Log.debug("the command matches")
|
38
|
+
Stove::Log.debug("Running `git #{command}', errors: #{errors}")
|
39
39
|
Dir.chdir(cookbook.path) do
|
40
40
|
response = %x|git #{command}|
|
41
41
|
|
data/lib/stove/runner.rb
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
module Stove
|
2
2
|
class Runner
|
3
|
-
include Logify
|
4
|
-
|
5
3
|
attr_reader :cookbook
|
6
4
|
attr_reader :options
|
7
5
|
|
@@ -23,9 +21,9 @@ module Stove
|
|
23
21
|
|
24
22
|
def run_plugin(name)
|
25
23
|
if skip?(name)
|
26
|
-
|
24
|
+
Stove::Log.info { "Skipping plugin `:#{name}'" }
|
27
25
|
else
|
28
|
-
|
26
|
+
Stove::Log.info { "Running plugin `:#{name}'" }
|
29
27
|
klass = Plugin.const_get(Util.camelize(name))
|
30
28
|
klass.new(cookbook, options).run
|
31
29
|
end
|
data/lib/stove/validator.rb
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
module Stove
|
2
2
|
class Validator
|
3
|
-
include Logify
|
4
|
-
|
5
3
|
include Mixin::Insideable
|
6
4
|
|
7
5
|
#
|
@@ -49,12 +47,12 @@ module Stove
|
|
49
47
|
# the cookbook to run this validation against
|
50
48
|
#
|
51
49
|
def run(cookbook, options = {})
|
52
|
-
|
50
|
+
Stove::Log.info("Running validations for `#{klass.id}.#{id}'")
|
53
51
|
|
54
52
|
inside(cookbook) do
|
55
53
|
instance = klass.new(cookbook, options)
|
56
54
|
unless result = instance.instance_eval(&block)
|
57
|
-
|
55
|
+
Stove::Log.debug("Validation failed, result: #{result.inspect}")
|
58
56
|
|
59
57
|
# Convert the class and id to their magical equivalents
|
60
58
|
error = Error.const_get("#{Util.camelize(klass.id)}#{Util.camelize(id)}ValidationFailed")
|
@@ -62,7 +60,7 @@ module Stove
|
|
62
60
|
end
|
63
61
|
end
|
64
62
|
|
65
|
-
|
63
|
+
Stove::Log.debug("Validation #{id} passed!")
|
66
64
|
end
|
67
65
|
end
|
68
66
|
end
|
data/lib/stove/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chef-stove
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.1.
|
4
|
+
version: 7.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Seth Vargo
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2020-01-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: chef-api
|
@@ -26,19 +26,19 @@ dependencies:
|
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: '0.5'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
|
-
name:
|
29
|
+
name: mixlib-log
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- - "
|
32
|
+
- - ">="
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: '0
|
34
|
+
version: '2.0'
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
|
-
- - "
|
39
|
+
- - ">="
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version: '0
|
41
|
+
version: '2.0'
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: aruba
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
@@ -156,6 +156,7 @@ files:
|
|
156
156
|
- lib/stove/cookbook/metadata.rb
|
157
157
|
- lib/stove/error.rb
|
158
158
|
- lib/stove/filter.rb
|
159
|
+
- lib/stove/log.rb
|
159
160
|
- lib/stove/mash.rb
|
160
161
|
- lib/stove/mixins/insideable.rb
|
161
162
|
- lib/stove/mixins/instanceable.rb
|