rototiller 0.1.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +13 -5
- data/CONTRIBUTING.md +57 -0
- data/MAINTAINERS +23 -0
- data/README.md +177 -134
- data/docs/Rakefile.example +101 -0
- data/docs/env_var_example_reference.md +110 -0
- data/docs/rototiller_class_graph.png +0 -0
- data/docs/rototiller_task_reference.md +212 -0
- data/lib/rototiller/rake/dsl/dsl_extention.rb +4 -0
- data/lib/rototiller/task/collections/argument_collection.rb +15 -0
- data/lib/rototiller/task/collections/command_collection.rb +15 -0
- data/lib/rototiller/task/collections/env_collection.rb +27 -0
- data/lib/rototiller/task/collections/option_collection.rb +20 -0
- data/lib/rototiller/task/collections/param_collection.rb +66 -0
- data/lib/rototiller/task/collections/switch_collection.rb +20 -0
- data/lib/rototiller/task/hash_handling.rb +30 -0
- data/lib/rototiller/task/params.rb +24 -0
- data/lib/rototiller/task/params/argument.rb +9 -0
- data/lib/rototiller/task/params/command.rb +209 -0
- data/lib/rototiller/task/params/env_var.rb +118 -0
- data/lib/rototiller/task/params/option.rb +63 -0
- data/lib/rototiller/task/params/switch.rb +81 -0
- data/lib/rototiller/task/rototiller_task.rb +68 -90
- data/lib/rototiller/utilities/color_text.rb +28 -26
- data/lib/rototiller/version.rb +1 -1
- metadata +31 -26
- data/Gemfile +0 -35
- data/Gemfile.lock +0 -280
- data/Rakefile +0 -72
- data/Rakefile.bak +0 -72
- data/lib/rototiller/task/flags/cli_flags.rb +0 -7
- data/lib/rototiller/utilities/block_syntax_object.rb +0 -16
- data/lib/rototiller/utilities/command.rb +0 -43
- data/lib/rototiller/utilities/command_flag.rb +0 -123
- data/lib/rototiller/utilities/env_collection.rb +0 -10
- data/lib/rototiller/utilities/env_var.rb +0 -130
- data/lib/rototiller/utilities/flag_collection.rb +0 -28
- data/lib/rototiller/utilities/param_collection.rb +0 -73
- data/spec/spec_helper.rb +0 -41
checksums.yaml
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
OTczNzRmOTAwNjkwMmFkNGNkYzE2NjFhY2I2YjIwZDcxNDQ3OTgwMQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
ZDc0MDhjM2E3NWU2NjMwZjYwODAxMjAxNzkyYzRlZjQ1YzU1NjE4MQ==
|
5
7
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
ZTZiZDIzOTgxMmIwM2JiMDVhZTc0ODM4ZjU4YmZjMTU4ZjRjZmZhNTY3NTUw
|
10
|
+
N2I5ZTg3MDg1NzU4MzM4YmUyNTEwZTUyZmZhZDM2ZDJkYmU2ZDgyYjM0NWZj
|
11
|
+
OWQyNTNiN2JmMDMyZTY1MTg0NDU1NGQ4MjUxZmI0NGU0Y2U2MGQ=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
NDdjMGM3ZGY0NWZiNTgxODMyZDc0ZWM0YjIyZTlhMWFjNDAxMDllMzVhYWQx
|
14
|
+
ZmQzMWViZDM0MTM4MDcyYjI3MmYxNGM4MTE0ZDMyNTA2MDM1YWI4OWFjNTAx
|
15
|
+
MGQ1ZTdmMzdhMjJmZTcwYTRhMWEyMjUxMDBjYTYyNDIxMDI0NDU=
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
# How To Contribute To Rototiller
|
2
|
+
|
3
|
+
## Getting Started
|
4
|
+
|
5
|
+
* Make sure you have a [GitHub account](https://github.com/signup/free)
|
6
|
+
* Fork the [Rototiller repository on GitHub](https://github.com/puppetlabs/rototiller)
|
7
|
+
|
8
|
+
## Making Changes
|
9
|
+
|
10
|
+
* Create a topic branch from where you want to base your work.
|
11
|
+
* This is the `master` branch in the case of rototiller
|
12
|
+
* To quickly create a topic branch based on master use `git checkout -b my_contribution master`. Do not work directly on the `master` branch.
|
13
|
+
* Make commits of logical _working_ and _functional_ units.
|
14
|
+
* Check for unnecessary whitespace with `git diff --check` before committing.
|
15
|
+
* Make sure your commit messages are in the proper format.
|
16
|
+
|
17
|
+
(BKR-1234) Make the example in CONTRIBUTING imperative and concrete
|
18
|
+
|
19
|
+
Without this patch applied the example commit message in the CONTRIBUTING
|
20
|
+
document is not a concrete example. This is a problem because the
|
21
|
+
contributor is left to imagine what the commit message should look like
|
22
|
+
based on a description rather than an example. This patch fixes the
|
23
|
+
problem by making the example concrete and imperative.
|
24
|
+
|
25
|
+
The first line is a real life imperative statement with a ticket number
|
26
|
+
from our issue tracker. The body describes the behavior without the patch,
|
27
|
+
why this is a problem, and how the patch fixes the problem when applied.
|
28
|
+
|
29
|
+
* Make sure you have added [RSpec](http://rspec.info/) tests that exercise your new code. These test should be located in the appropriate `rototiller/spec/` subdirectory. The addition of new methods/classes or the addition of code paths to existing methods/classes requires additional RSpec coverage.
|
30
|
+
* One should **NOT USE** the deprecated `should`/`stub` methods - **USE** `expect`/`allow`. Use of deprecated RSpec methods will result in your patch being rejected. See a nice blog post from 2013 on [RSpec's new message expectation syntax](http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/).
|
31
|
+
* Run the spec unit tests to assure nothing else was accidentally broken, using `rake test`
|
32
|
+
* **Bonus**: if possible ensure that `[bundle exec] rake test` runs without failures for additional Ruby versions (1.9, 2.0, etc). Rototiller supports Ruby 1.9+, and breakage of support for other rubies will cause a patch to be rejected.
|
33
|
+
* Make sure that if you have added new functionality of sufficiently high risk, and it can not be covered adequately via unit tests (mocking, requires disk, other classes, etc), you also include acceptance tests in your PR.
|
34
|
+
* Make sure that you have added documentation using [Yard](http://yardoc.org/), new methods/classes without appropriate documentation will be rejected.
|
35
|
+
* Run the yardoc tool to ensure that your yard documentation is properly formatted and complete
|
36
|
+
* `[bundle exec] rake docs:gen`
|
37
|
+
* Yard docs are great for other developers, but often are difficult to read for users. If your change impacts user-facing functionality, please include changes to the human-readable markdown docs starting at README.md
|
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
|
+
* 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
|
+
* Rototiller's Architecture:
|
41
|
+
![Rototiller's Architecture](doc/rototiller_class_graph.png)
|
42
|
+
|
43
|
+
## Submitting Changes
|
44
|
+
|
45
|
+
* Sign the [Contributor License Agreement](http://links.puppet.com/cla).
|
46
|
+
* Push your changes to a topic branch in _your_ fork of the repository.
|
47
|
+
* Submit a pull request to [Rototiller](https://github.com/puppetlabs/rototiller)
|
48
|
+
* PRs are reviewed as time permits.
|
49
|
+
|
50
|
+
# Additional Resources
|
51
|
+
|
52
|
+
* [More information on contributing](http://links.puppet.com/contribute-to-puppet)
|
53
|
+
* [Contributor License Agreement](http://links.puppet.com/cla)
|
54
|
+
* [General GitHub documentation](http://help.github.com/)
|
55
|
+
* [GitHub pull request documentation](http://help.github.com/send-pull-requests/)
|
56
|
+
* Questions? Comments? Contact the Rototiller team at qa-team@puppet.com
|
57
|
+
* The keyword `rototiller` is monitored and we'll get back to you as quick as we can.
|
data/MAINTAINERS
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
{
|
2
|
+
"version": 1,
|
3
|
+
"file_format": "This MAINTAINERS file format is described at https://github.com/puppetlabs/maintainers",
|
4
|
+
"issues": "https://tickets.puppetlabs.com/browse/QA",
|
5
|
+
"internal_list": "https://groups.google.com/a/puppet.com/forum/?hl=en#!forum/dept-quality-assurance",
|
6
|
+
"people": [
|
7
|
+
{
|
8
|
+
"github": "er0ck",
|
9
|
+
"email": "erict@puppet.com",
|
10
|
+
"name": "Eric Thompson"
|
11
|
+
},
|
12
|
+
{
|
13
|
+
"github": "zreichert",
|
14
|
+
"email": "zach.reichert@puppet.com",
|
15
|
+
"name": "Zach Reichert"
|
16
|
+
},
|
17
|
+
{
|
18
|
+
"github": "samwoods1",
|
19
|
+
"email": "sam.woods@puppet.com",
|
20
|
+
"name": "Sam Woods"
|
21
|
+
}
|
22
|
+
]
|
23
|
+
}
|
data/README.md
CHANGED
@@ -1,19 +1,14 @@
|
|
1
1
|
# Rototiller
|
2
2
|
|
3
|
-
A [Rake](https://github.com/ruby/rake) helper for command-oriented tasks.
|
3
|
+
A [Rake](https://github.com/ruby/rake) helper library for command-oriented tasks.
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
*
|
10
|
-
*
|
11
|
-
*
|
12
|
-
* Provides a tool that can house shared rake task code for Puppet.
|
13
|
-
* Reduce duplication in Rakefiles across projects at Puppet.
|
14
|
-
* Reduce effort required to write first class rake tasks.
|
15
|
-
* Reduce time and effort trying to understand requirement to run rake tasks.
|
16
|
-
* Provide a standard interface for executing tests in a given test tier regardless of framework (Not MVP)
|
5
|
+
## Rototiller Goals
|
6
|
+
* Reduce effort required to write first-class rake tasks
|
7
|
+
* Reduce time and effort to understand how to run rake tasks
|
8
|
+
* Simplifies the building of command strings in :rototiller_task for task authors
|
9
|
+
* Abstracts the overriding of command string components: commands, switches, options, arguments for task users
|
10
|
+
* Unifies and standardizes messaging surrounding the use of environment variables for task operations
|
11
|
+
* Reduce duplication in Rakefiles across projects
|
17
12
|
|
18
13
|
<a name="install"></a>
|
19
14
|
## Install
|
@@ -21,143 +16,69 @@ Please see the notes at the top of the [Write](#write) section.
|
|
21
16
|
|
22
17
|
<a name="write"></a>
|
23
18
|
## Write
|
24
|
-
Rototiller provides a Rake DSL addition called 'rototiller_task' which is a fully featured Rake task with environment variable handling, messaging and command-string-building functionality.
|
25
|
-
|
26
|
-
:warning: The API below will change for the next release.
|
27
|
-
The known changes include (not comprehensive):
|
28
|
-
* moving `#add_flag` to `Command` and renaming it `#add_option`
|
29
|
-
* adding `#add_env` to `Command` and `#add_option`, so one can add multiple environment variables
|
30
|
-
* adding `#add_switch` to Command so one does not have to use the `:is_boolean` parameter for `#add_flag`
|
31
|
-
* adding some sort of env_var type so one does not have to use the `:required` parameter for `#add_flag`
|
32
|
-
* the above will allow for multiple commands in a task with independent option, switch, and environment variable tracking
|
33
|
-
|
34
|
-
Examples (see the [Use](#use) section for outputs):
|
35
|
-
require 'rototiller'
|
36
|
-
|
37
|
-
desc "task dependencies work. this one also uses an environment variable"
|
38
|
-
rototiller_task :parent_task do |task|
|
39
|
-
# most method initializers take either a hash, or block syntax (see next task)
|
40
|
-
task.add_env({:name => 'RANDOM_VAR', :default => 'default value'})
|
41
|
-
task.add_command({:name => "echo 'i am testing everything with $RANDOM_VAR = #{ENV['RANDOM_VAR']}'"})
|
42
|
-
end
|
43
|
-
|
44
|
-
desc "override command-name with environment variable"
|
45
|
-
rototiller_task :test => :parent_task do |task|
|
46
|
-
# block syntax here. We give up some lines for more readability
|
47
|
-
task.add_command do |cmd|
|
48
|
-
cmd.name = 'test'
|
49
|
-
cmd.override_env = 'ECHO_EXECUTABLE'
|
50
|
-
end
|
51
|
-
task.add_flag({:name => '-f', :default => 'Rakefile'})
|
52
|
-
end
|
53
|
-
|
54
|
-
desc "override flag values with environment variables"
|
55
|
-
rototiller_task :test_flag_env do |task|
|
56
|
-
task.add_command do |cmd|
|
57
|
-
cmd.name = 'test'
|
58
|
-
end
|
59
|
-
task.add_flag do |flag|
|
60
|
-
flag.name = '-f'
|
61
|
-
flag.default = 'Rakefile'
|
62
|
-
flag.override_env = 'FLAG_VALUE'
|
63
|
-
end
|
64
|
-
end
|
19
|
+
Rototiller provides a Rake DSL addition called '[rototiller_task](docs/rototiller_task_reference.md)' which is a fully featured Rake task with environment variable handling, messaging and command-string-building functionality.
|
65
20
|
|
66
|
-
|
67
|
-
rototiller_task :test_flag_env do |task|
|
68
|
-
task.add_command do |cmd|
|
69
|
-
cmd.name = 'test'
|
70
|
-
end
|
71
|
-
task.add_flag do |flag|
|
72
|
-
flag.name = '-f'
|
73
|
-
flag.default = ''
|
74
|
-
flag.override_env = 'FLAG_VALUE'
|
75
|
-
flag.required = false
|
76
|
-
end
|
77
|
-
# examples:
|
78
|
-
# add a boolean option (switch)
|
79
|
-
#task.add_flag({:name => '--switch1', :is_boolean => true})
|
80
|
-
# add a switch which defaults to "off"
|
81
|
-
#task.add_flag({:name => '-s', :default => '', :is_boolean => true})
|
82
|
-
# add a switch with environment override
|
83
|
-
#task.add_flag({:name => '--switch3', :is_boolean => true, :override_env => 'TEST_FLAG_ENV_SWITCH3'})
|
84
|
-
end
|
85
|
-
|
86
|
-
|
87
|
-
desc "override command argument values with environment variables"
|
88
|
-
rototiller_task :test_arg_env do |task|
|
89
|
-
task.add_command do |cmd|
|
90
|
-
cmd.name = 'ls'
|
91
|
-
cmd.argument = 'Rakefile'
|
92
|
-
cmd.argument_override_env = 'FILENAME'
|
93
|
-
end
|
94
|
-
end
|
21
|
+
Rototiller has 4 main _types_ of arguments that can be passed to a command in a task. `RototillerTasks` can accept multiple commands. Each of these argument types has a similar API that looks similar to `#add_command`.
|
95
22
|
|
96
23
|
<a name="use"></a>
|
97
24
|
## Use
|
98
|
-
|
25
|
+
It's just like normal Rake. We just added a bunch of environment variable handling and messaging!
|
26
|
+
(with the below example Rakefile):
|
99
27
|
|
100
28
|
$) rake -T
|
101
|
-
rake
|
102
|
-
rake
|
29
|
+
rake child # override command-name with environment variable
|
30
|
+
rake parent_task # parent task for dependent tasks
|
103
31
|
|
104
32
|
$) rake -D
|
105
|
-
rake
|
106
|
-
task dependencies work. this one also uses an environment variable
|
107
|
-
rake test
|
33
|
+
rake child
|
108
34
|
override command-name with environment variable
|
109
35
|
|
110
|
-
|
111
|
-
|
112
|
-
$) rake test
|
113
|
-
INFO: The environment variable: 'RANDOM_VAR' was found with value: 'default value':
|
114
|
-
i am testing everything with $RANDOM_VAR = default value
|
115
|
-
The CLI flag -f will be used with value Rakefile.
|
116
|
-
|
117
|
-
$) rake parent_task RANDOM_VAR=redrum
|
118
|
-
INFO: The environment variable: 'RANDOM_VAR' was found with value: 'redrum':
|
119
|
-
i am testing everything with $RANDOM_VAR = redrum
|
120
|
-
|
121
|
-
$) rake test ECHO_EXECUTABLE='ls' --verbose
|
122
|
-
INFO: The environment variable: 'RANDOM_VAR' was found with value: 'default value':
|
123
|
-
echo 'i am testing everything with $RANDOM_VAR = default value'
|
124
|
-
i am testing everything with $RANDOM_VAR = default value
|
125
|
-
The CLI flag -f will be used with value Rakefile.
|
126
|
-
|
127
|
-
ls -f Rakefile
|
128
|
-
Rakefile
|
129
|
-
|
130
|
-
$) rake test_flag_env
|
131
|
-
The CLI flag -f will be used with value Rakefile.
|
132
|
-
$) echo $?
|
133
|
-
0
|
134
|
-
|
135
|
-
$) rake test_flag_env --verbose
|
136
|
-
The CLI flag -f will be used with value Rakefile.
|
137
|
-
|
138
|
-
test -f Rakefile
|
36
|
+
rake parent_task
|
37
|
+
parent task for dependent tasks. this one also uses two environment variables and two commands
|
139
38
|
|
140
|
-
|
141
|
-
The CLI flag -f will be used with value README.md.
|
39
|
+
### The old way
|
142
40
|
|
143
|
-
|
41
|
+
desc 'the old, bad way. This is for the README.md file.'
|
42
|
+
task :demo_old do |t|
|
43
|
+
echo_args = ENV['COMMAND_NAME'] || "my_sweet_command #{ENV['HOME']}"
|
44
|
+
overriding_options = ENV['OPTIONS'].to_s
|
45
|
+
args = [echo_args, *overriding_options.split(' '), '--switch'].compact
|
46
|
+
sh("echo", *args)
|
47
|
+
end
|
144
48
|
|
145
|
-
|
146
|
-
The CLI flag -f will be used with value README.md.
|
49
|
+
this does, _mostly_ the same as below. but what do the various environment variables do? they aren't documented anywhere, especially in Rake's output. why do we have to split on a space for the overriding options? why do we compact? We shouldn't have to do this in all our Rakefiles, and then forget to do it, _correctly_ in most. Rototiller does all this for us, but uniformly handling environment variables for any command piece, optionally. But anytime we do, we automatically get messaging in Rake's output, and this can be controlled with Rake's --verbose flag. Now we don't have to dig into the Rakefile to see what the author intended for an interface. Now we can provide a uniform interface for our various tasks based upon this library and have messaging come along for the ride. Now we can remove the majority of repeated code from our Rakefiles.
|
147
50
|
|
148
|
-
|
149
|
-
test -f nonesuch failed
|
51
|
+
### The rototiller way
|
150
52
|
|
151
|
-
|
152
|
-
|
53
|
+
require 'rototiller'
|
54
|
+
desc 'the new, rototiller way. This is for the README.md file.'
|
55
|
+
rototiller_task :demo_new do |t|
|
56
|
+
t.add_env({:name => 'FOO', :message => 'I am describing FOO, my task needs me, but has a default. this default will be set in the environment unless it exists', :default => 'FOO default'})
|
57
|
+
t.add_env do |e|
|
58
|
+
e.name = 'HOME'
|
59
|
+
e.message = 'I am describing HOME, my task needs me. all rototiller methods can take a hash or a block'
|
60
|
+
end
|
61
|
+
|
62
|
+
t.add_command do |c|
|
63
|
+
c.name = 'echo my_sweet_command ${HOME}'
|
64
|
+
c.add_env({:name => 'COMMAND_NAME', :message => 'use me to override this command name (`echo my_sweet_command`)'})
|
65
|
+
# anti-pattern: this is really an option. FIXME once add_option is implemented
|
66
|
+
c.add_switch({:name => '--switch ${FOO}', :message => 'echo uses --switch to switch things'})
|
67
|
+
# FYI, add_switch can also take a block and add_env
|
68
|
+
# command blocks also have add_option, and add_arg, each of which can add environment variables which override themselves.
|
69
|
+
# add_option actually has its own add_arg and each of those have add_env. so meta
|
70
|
+
end
|
71
|
+
end
|
153
72
|
|
154
|
-
|
155
|
-
|
73
|
+
### Reference
|
74
|
+
* [rototiller\_task reference](docs/rototiller_task_reference.md)
|
75
|
+
* contains usage information on all rototiller_task API methods
|
156
76
|
|
157
77
|
## Issues
|
158
78
|
|
159
|
-
* none. it's perfect
|
79
|
+
* none. it's perfect, but just in case (sorry, this is Puppet-internal for now)
|
160
80
|
* [Jira: Rototiller](https://tickets.puppetlabs.com/issues/?jql=project%20%3D%20QA)
|
81
|
+
* [Puppet QA-team](mailto:qa-team@puppet.com)
|
161
82
|
|
162
83
|
## More Documentation
|
163
84
|
|
@@ -174,7 +95,129 @@ Next start the yard server
|
|
174
95
|
|
175
96
|
Finally navigate to http://0.0.0.0:8808/ to view the documentation
|
176
97
|
|
177
|
-
##
|
178
|
-
* [
|
179
|
-
|
180
|
-
|
98
|
+
## Contributing
|
99
|
+
* [Contributing](CONTRIBUTING.md)
|
100
|
+
|
101
|
+
## abandon hope, all ye who enter here
|
102
|
+
### All permutations of v2 API (remove and refactor into useful doc sections below upon testing, merge-up to stable)
|
103
|
+
|
104
|
+
* all things that can take multiples should use add\_ as precursor to method name
|
105
|
+
* all things that only take one should use set\_ as precursor to method name?
|
106
|
+
require 'rototiller'
|
107
|
+
|
108
|
+
## all task methods
|
109
|
+
rototiller_task :name do |t|
|
110
|
+
t.add_command # t.add_cmd? me no likey
|
111
|
+
t.add_env
|
112
|
+
end
|
113
|
+
rototiller_task do |t|
|
114
|
+
t.set_name = 'string_name' # should this be validated?? e.g.: spaces, etc
|
115
|
+
t.add_command
|
116
|
+
t.add_env
|
117
|
+
end
|
118
|
+
|
119
|
+
|
120
|
+
## all task's add_env invocations with just name
|
121
|
+
t.add_env('env_name') #required, default messaging
|
122
|
+
t.add_env :env_name
|
123
|
+
t.add_env 'env_name' # implicitly allowed by ruby
|
124
|
+
t.add_env do |e|
|
125
|
+
e.name
|
126
|
+
end
|
127
|
+
|
128
|
+
## all task's add_env invocations with name, message
|
129
|
+
#t.add_env('env_name') # impossible
|
130
|
+
t.add_env :env_name do |e|
|
131
|
+
t.add_env 'env_name' do |e| # should we do this too?
|
132
|
+
e.set_message
|
133
|
+
end
|
134
|
+
t.add_env do |e|
|
135
|
+
e.name
|
136
|
+
e.message
|
137
|
+
end
|
138
|
+
|
139
|
+
## all task's add_env invocations with name, value
|
140
|
+
#t.add_env('env_name') # impossible
|
141
|
+
t.add_env :env_name do |e|
|
142
|
+
t.add_env 'env_name' do |e| # should we do this too?
|
143
|
+
e.default/value # does value imply the env will be set by rototiller? does default NOT?
|
144
|
+
end
|
145
|
+
t.add_env do |e|
|
146
|
+
e.name
|
147
|
+
e.default/value
|
148
|
+
end
|
149
|
+
|
150
|
+
## all task's add_env invocations with name, value, message
|
151
|
+
#t.add_env('env_name') # impossible
|
152
|
+
t.add_env :env_name do |e|
|
153
|
+
e.default/value # does value imply the env will be set by rototiller? does default NOT?
|
154
|
+
e.message
|
155
|
+
end
|
156
|
+
t.add_env do |e|
|
157
|
+
e.name
|
158
|
+
e.default/value
|
159
|
+
e.message
|
160
|
+
end
|
161
|
+
|
162
|
+
|
163
|
+
## all task's add_command invocations with only name
|
164
|
+
# default messaging, no env override?
|
165
|
+
t.add_command('echo --blah my name is ray')
|
166
|
+
t.add_command :echo
|
167
|
+
t.add_command 'echo'
|
168
|
+
t.add_command do |c|
|
169
|
+
c.name = 'echo'
|
170
|
+
end
|
171
|
+
|
172
|
+
## all task's add_command invocations with name (string), message
|
173
|
+
#t.add_command('echo --blah my name is ray', 'message') # ArgumentError
|
174
|
+
t.add_command :echo
|
175
|
+
t.add_command 'echo' do |c|
|
176
|
+
c.name = 'echo' # # nomethod error?
|
177
|
+
c.message = 'why we echo'
|
178
|
+
end
|
179
|
+
t.add_command do |c|
|
180
|
+
c.name = 'echo'
|
181
|
+
c.message = 'blah'
|
182
|
+
end
|
183
|
+
|
184
|
+
## all task's add_command invocations with name (block) (could be same for message?)
|
185
|
+
#t.add_command('echo --blah my name is ray', 'message') # ArgumentError
|
186
|
+
#t.add_command :echo
|
187
|
+
#t.add_command 'echo' do |c|
|
188
|
+
# c.message = 'blah'
|
189
|
+
#end
|
190
|
+
t.add_command do |c|
|
191
|
+
c.name 'echo' do |n|
|
192
|
+
n.add_env
|
193
|
+
end
|
194
|
+
c.add_arg 'some_arg' do |a|
|
195
|
+
a.add_env
|
196
|
+
a.message
|
197
|
+
end
|
198
|
+
c.add_option '--option_name' do |o|
|
199
|
+
o.add_arg 'switch_arg' do |a|
|
200
|
+
a.add_env 'opion-arg_env' do |e|
|
201
|
+
e.set_name
|
202
|
+
e.set_message
|
203
|
+
e.set_value
|
204
|
+
end
|
205
|
+
end
|
206
|
+
o.add_env 'option-name_env' do |e|
|
207
|
+
e.set_name
|
208
|
+
e.set_message
|
209
|
+
e.set_value
|
210
|
+
end
|
211
|
+
o.message
|
212
|
+
end
|
213
|
+
c.add_switch '--some_switch' do |s|
|
214
|
+
s.add_env 'env_name' do |e|
|
215
|
+
e.set_name
|
216
|
+
e.set_message
|
217
|
+
e.set_value
|
218
|
+
end
|
219
|
+
s.message
|
220
|
+
end
|
221
|
+
end
|
222
|
+
|
223
|
+
#should we be able to add an env for any given message? i don't see a use case, we should probably just save users from themselves here.
|