rototiller 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CONTRIBUTING.md +18 -0
- data/lib/rototiller/task/params.rb +14 -0
- data/lib/rototiller/task/params/command.rb +3 -1
- data/lib/rototiller/task/params/env_var.rb +2 -0
- data/lib/rototiller/task/params/option.rb +9 -7
- data/lib/rototiller/task/params/switch.rb +6 -2
- data/lib/rototiller/task/rototiller_task.rb +1 -1
- data/lib/rototiller/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 428406284e02d3f3836b5039dacd64f7a51595f6923ff1cd08096446f782bfc2
|
4
|
+
data.tar.gz: 1d6a070369ffb77f474fe973a403478491c3188e223d70a064a0e80308fe5790
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 76c2d17e76d1284e2338fc77030b78bb3152affdb2d4f2259b4789f00d9c784d379bfcfa4686a1c0e0a38964ead56124f1bb662eb9895bf61902993ed6b020fc
|
7
|
+
data.tar.gz: b6f97b132f3f5b4f98c84c91dab4a0a40af6e89844eed5bf36945faae28933782b051d93a8c38b19c858fe544cc966188e0e3a3b0b47ac4c882251aff7862858
|
data/CONTRIBUTING.md
CHANGED
@@ -38,6 +38,24 @@
|
|
38
38
|
* During the time that you are working on your patch the master Rototiller branch may have changed - you'll want to [rebase](http://git-scm.com/book/en/Git-Branching-Rebasing) before you submit your PR with `git rebase master`. A successful rebase ensures that your patch will cleanly merge into Rototiller.
|
39
39
|
* Submitted patches will be smoke tested through a series of acceptance level tests that ensures basic Rototiller functionality - the results of these tests will be evaluated by a Rototiller team member. Failures associated with the submitted patch will result in the patch being rejected.
|
40
40
|
|
41
|
+
## Testing
|
42
|
+
|
43
|
+
* `bundle install`
|
44
|
+
* run the unit tests
|
45
|
+
* this runs rspec on the local machine
|
46
|
+
* do not write tests that could mess with the local machine
|
47
|
+
* `bundle exec rake test:unit`
|
48
|
+
* run the acceptance tests
|
49
|
+
* some of these could theoretically do weird stuff to the local system
|
50
|
+
* so we run these in a container
|
51
|
+
* a running docker server is required
|
52
|
+
* `docker login pcr-internal.puppet.net`
|
53
|
+
* `docker pull pcr-internal.puppet.net/slv/rototiller:latest`
|
54
|
+
* we'll mirror the image to docker soon, probably, for your local testing, outside of Puppet.
|
55
|
+
* `bundle exec rake test:acceptance`
|
56
|
+
|
57
|
+
These tests all run in CI. the unit tests are also run in the container to save time in the repeated bundle installs and rvm setup steps. You are welcome to use the container as well if you want to avoid the bundle install. Just gem install rototiller (to make our own Rakefile _go_ and you can rake test:unit all day.
|
58
|
+
|
41
59
|
## Submitting Changes
|
42
60
|
|
43
61
|
* Sign the [Contributor License Agreement](http://links.puppet.com/cla).
|
@@ -12,12 +12,26 @@ module Rototiller
|
|
12
12
|
|
13
13
|
attr_accessor :name
|
14
14
|
attr_accessor :message
|
15
|
+
attr_accessor :parent_name
|
16
|
+
attr_accessor :parent_message
|
15
17
|
|
16
18
|
# we must always have a message that can be aggregated via the parent params
|
17
19
|
# @return [String] <empty string>
|
18
20
|
def message
|
19
21
|
return ''
|
20
22
|
end
|
23
|
+
|
24
|
+
def parent_name=(name)
|
25
|
+
name.each_char do |char|
|
26
|
+
message = "You have defined an environment variable with an illegal character: #{char}"
|
27
|
+
raise ArgumentError.new(message) unless char =~ /[a-zA-Z]|\d|_/
|
28
|
+
end
|
29
|
+
@parent_name = name
|
30
|
+
end
|
31
|
+
|
32
|
+
def parent_message=(message)
|
33
|
+
@parent_message = message
|
34
|
+
end
|
21
35
|
end
|
22
36
|
|
23
37
|
end
|
@@ -215,7 +215,9 @@ module Rototiller
|
|
215
215
|
# itself, env_vars, switches, options, arguments
|
216
216
|
# TODO make private method? so that it will throw an error if yielded to?
|
217
217
|
def message
|
218
|
-
|
218
|
+
return_message = @message
|
219
|
+
return_message += "\n" if @message && @message != ''
|
220
|
+
return [return_message,
|
219
221
|
@env_vars.messages,
|
220
222
|
@switches.messages,
|
221
223
|
@options.messages,
|
@@ -33,7 +33,9 @@ module Rototiller
|
|
33
33
|
# @return EnvVar object
|
34
34
|
def initialize(args={}, &block)
|
35
35
|
@parent_name = args[:parent_name]
|
36
|
+
@message ||= args[:parent_message]
|
36
37
|
args.delete(:parent_name)
|
38
|
+
args.delete(:parent_message)
|
37
39
|
block_given? ? (yield self) : send_hash_keys_as_methods_to_self(args)
|
38
40
|
|
39
41
|
raise(ArgumentError, 'A name must be supplied to add_env') unless @name
|
@@ -43,6 +43,15 @@ module Rototiller
|
|
43
43
|
[@name.to_s, @arguments.to_s].compact.join(' ')
|
44
44
|
end
|
45
45
|
|
46
|
+
# @return [String] formatted messages from all of Switch's pieces
|
47
|
+
# itself, env_vars
|
48
|
+
# TODO make private method? so that it will throw an error if yielded to?
|
49
|
+
def message
|
50
|
+
return_message = [@message, @env_vars.messages, @arguments.messages].join ''
|
51
|
+
return_message += "\n" unless return_message == ''
|
52
|
+
return return_message
|
53
|
+
end
|
54
|
+
|
46
55
|
# Does this param require the task to stop
|
47
56
|
# Determined by the interactions between @name, @env_vars, @arguments
|
48
57
|
# @return [true|nil] if this param requires a stop
|
@@ -51,13 +60,6 @@ module Rototiller
|
|
51
60
|
return true unless @name
|
52
61
|
end
|
53
62
|
|
54
|
-
# @return [String] formatted messages from all of Option's pieces
|
55
|
-
# itself, env_vars, arguments
|
56
|
-
# TODO make private method? so that it will throw an error if yielded to?
|
57
|
-
def message
|
58
|
-
return [@message, @env_vars.messages, @arguments.messages].join('')
|
59
|
-
end
|
60
|
-
|
61
63
|
end
|
62
64
|
end
|
63
65
|
end
|
@@ -21,6 +21,7 @@ module Rototiller
|
|
21
21
|
def initialize(args={}, &block)
|
22
22
|
# the env_vars that override the name
|
23
23
|
@env_vars = EnvCollection.new
|
24
|
+
@message ||= args[:parent_message]
|
24
25
|
block_given? ? (yield self) : send_hash_keys_as_methods_to_self(args)
|
25
26
|
@name ||= @env_vars.last
|
26
27
|
end
|
@@ -41,7 +42,7 @@ module Rototiller
|
|
41
42
|
# but if this gets moved to a mixin, it might be more tolerable
|
42
43
|
if block_given?
|
43
44
|
# send in the name of this Param, so it can be used when no default is given to add_env
|
44
|
-
@env_vars.push(EnvVar.new({:parent_name => @name},&block))
|
45
|
+
@env_vars.push(EnvVar.new({:parent_name => @name, @parent_message => @message},&block))
|
45
46
|
else
|
46
47
|
#TODO: test this with array and non-array single hash
|
47
48
|
args.each do |arg| # we can accept an array of hashes, each of which defines a param
|
@@ -49,6 +50,7 @@ module Rototiller
|
|
49
50
|
raise ArgumentError.new(error_string) unless arg.is_a?(Hash)
|
50
51
|
# send in the name of this Param, so it can be used when no default is given to add_env
|
51
52
|
arg[:parent_name] = @name
|
53
|
+
arg[:parent_message] = @message
|
52
54
|
@env_vars.push(EnvVar.new(arg))
|
53
55
|
end
|
54
56
|
end
|
@@ -66,7 +68,9 @@ module Rototiller
|
|
66
68
|
# itself, env_vars
|
67
69
|
# TODO make private method? so that it will throw an error if yielded to?
|
68
70
|
def message
|
69
|
-
|
71
|
+
return_message = [@message, @env_vars.messages].join ''
|
72
|
+
return_message += "\n" unless return_message == ''
|
73
|
+
return return_message
|
70
74
|
end
|
71
75
|
|
72
76
|
# The string representation of this Switch; the value sent by author, or overridden by any env_vars
|
data/lib/rototiller/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rototiller
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Puppet, Inc.
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2018-05-01 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rake
|
@@ -79,7 +79,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
79
79
|
version: '0'
|
80
80
|
requirements: []
|
81
81
|
rubyforge_project:
|
82
|
-
rubygems_version: 2.6
|
82
|
+
rubygems_version: 2.7.6
|
83
83
|
signing_key:
|
84
84
|
specification_version: 4
|
85
85
|
summary: Puppet Labs rake tool
|