runfile 1.0.0.rc4 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +50 -44
- data/lib/runfile/action.rb +8 -6
- data/lib/runfile/concerns/dsl.rb +0 -3
- data/lib/runfile/exceptions.rb +1 -0
- data/lib/runfile/gem_finder.rb +1 -1
- data/lib/runfile/runner.rb +2 -0
- data/lib/runfile/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 97b62f3eec29bfcf7295e6d6da2f08b8461e9957f1d85296ab1831666d841f9e
|
4
|
+
data.tar.gz: 5f2b029e59be9181f05abf5b45448bd1bf57527df33e8a5431c445b106c633e1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ea4e40d8cca826236c906dd6d8430f6a5ba1d2f317babce072f6034cefa7e9bb439f6582dc4e4fffec017cbaf78e93ef5785c5578a6d13743d9910a8f62bc3f
|
7
|
+
data.tar.gz: 42f2904c17a98672d2291808b7adde081207f083ab200a8a6ff01990a87aaf9b62554a4b914807363481d9ba59faadfdc57d0cdcf00820df8a3f9eff457be61b
|
data/README.md
CHANGED
@@ -9,15 +9,16 @@
|
|
9
9
|
|
10
10
|
---
|
11
11
|
|
12
|
-
A beautiful command line
|
13
|
-
Rake-inspired
|
12
|
+
A beautiful command line utility builder
|
13
|
+
Rake-inspired ✦ Docopt inside
|
14
|
+
**[runfile.dannyb.co](https://runfile.dannyb.co)**
|
14
15
|
|
15
16
|
---
|
16
17
|
|
17
18
|
</div>
|
18
19
|
|
19
|
-
**Runfile** lets you create command line
|
20
|
-
|
20
|
+
**Runfile** lets you create command line tools in a way similar to
|
21
|
+
[Rake](https://github.com/ruby/rake), but with the full power of
|
21
22
|
[Docopt](http://docopt.org/) command line options.
|
22
23
|
|
23
24
|
You create a `runfile`, and execute commands with
|
@@ -26,15 +27,9 @@ You create a `runfile`, and execute commands with
|
|
26
27
|
Runfile is designed primarily for Ruby developers, but if you need to add a
|
27
28
|
command line "toolbelt" for your projects, you can use it regardless.
|
28
29
|
|
29
|
-
## Pre-release Notice
|
30
|
-
|
31
|
-
Note that this README describes the not yet released 1.0.0 version.
|
32
|
-
See [runfile.dannyb.co](https://runfile.dannyb.co/) for the stable release
|
33
|
-
documentation.
|
34
|
-
|
35
30
|
## Demo
|
36
31
|
|
37
|
-
![Runfile Demo](
|
32
|
+
![Runfile Demo](support/cast.gif "Runfile Demo")
|
38
33
|
|
39
34
|
## Install
|
40
35
|
|
@@ -110,7 +105,7 @@ Options:
|
|
110
105
|
Show this message
|
111
106
|
```
|
112
107
|
|
113
|
-
|
108
|
+
### More Examples
|
114
109
|
|
115
110
|
You can learn almost everything there is to know about runfile from the
|
116
111
|
[examples](https://github.com/DannyBen/runfile/tree/master/examples#readme).
|
@@ -129,56 +124,67 @@ Note that the current user guide is for the stable version 0.12.0.
|
|
129
124
|
|
130
125
|
## Breaking Changes in 1.0.0
|
131
126
|
|
132
|
-
If you are using a version earlier than 1.0, note that
|
133
|
-
|
134
|
-
|
127
|
+
If you are using a version earlier than 1.0, note that version 1.0.0 includes
|
128
|
+
some breaking changes. You can read more about them in [this Pull Request]
|
129
|
+
(https://github.com/DannyBen/runfile/pull/50).
|
135
130
|
|
136
131
|
### Upgrading to 1.0.0
|
137
132
|
|
138
|
-
|
133
|
+
<details>
|
134
|
+
<summary>Show section</summary>
|
135
|
+
|
136
|
+
### No more `.runfile` config
|
137
|
+
|
138
|
+
If you have used the multi-runfile config file, this no longer exists.
|
139
|
+
Use a standard `runfile` instead, along with the `import` directive.
|
140
|
+
|
141
|
+
### No more `action :global`
|
142
|
+
|
143
|
+
If you have used the `action :global do` notation, this is replaced with the
|
144
|
+
simpler use `action do` instead. Also, there is no more need for
|
145
|
+
empty `usage ''`, just delete it if you have it in your runfiles.
|
146
|
+
|
147
|
+
### No more `execute` directive
|
139
148
|
|
140
|
-
If you have used
|
141
|
-
|
149
|
+
If you have used it to cross-call other actions, it is no longer available. As
|
150
|
+
an alternative, you can define common code in separate classes and `require`
|
151
|
+
them, or use the new `helpers` directive to define functions that will be
|
152
|
+
available to all actions.
|
142
153
|
|
143
|
-
###
|
154
|
+
### Code outside of actions should be inside `helpers`
|
144
155
|
|
145
|
-
If
|
146
|
-
|
147
|
-
empty `usage ''`, just delete it if you have it in your runfiles.
|
156
|
+
If your runfiles include other ruby code, especially `def method`, you should
|
157
|
+
now use the new `helpers` block and tuck this code inside it.
|
148
158
|
|
149
|
-
### No more `
|
159
|
+
### No more need for `trap(:INT)`
|
150
160
|
|
151
|
-
If
|
152
|
-
|
153
|
-
them, or use the new `helpers` directive to define functions that will be
|
154
|
-
available to all actions.
|
161
|
+
If your old runfiles trap the `Interrupt` signal, there is no longer a need to
|
162
|
+
do so, as it is trapped by default.
|
155
163
|
|
156
|
-
###
|
164
|
+
### Colsole is included
|
157
165
|
|
158
|
-
If your
|
159
|
-
do
|
166
|
+
If your runfiles `required` and `include` Colsole, there is no longer a need to
|
167
|
+
do it. Colsole is bundled and available in actions.
|
160
168
|
|
161
|
-
###
|
169
|
+
### Long flags before short flags
|
162
170
|
|
163
|
-
|
164
|
-
|
171
|
+
This is a cosmetic change for consistency. All generated output shows long flags
|
172
|
+
before short flags `--force, -f` instead of `-f, --force`. Update your custom
|
173
|
+
`usage` directives accordingly.
|
165
174
|
|
166
|
-
###
|
175
|
+
### Examples no longer add implicit 'run'
|
167
176
|
|
168
|
-
|
169
|
-
|
170
|
-
|
177
|
+
If you were using the `example` directive, it will no longer add the initial
|
178
|
+
`run` in front of your examples. Add it yourself. This is intended to allow
|
179
|
+
providing more elaborate examples.
|
171
180
|
|
172
|
-
###
|
181
|
+
### RunfileTasks
|
173
182
|
|
174
|
-
|
175
|
-
|
176
|
-
providing more elaborate examples.
|
183
|
+
The `RunfileTasks` gem is also released as a pre-release, if you are using it
|
184
|
+
make sure to install the latest release candidate.
|
177
185
|
|
178
|
-
|
186
|
+
</details>
|
179
187
|
|
180
|
-
The `RunfileTasks` gem is also released as a pre-release, if you are using it
|
181
|
-
make sure to install the latest release candidate.
|
182
188
|
|
183
189
|
## Contributing / Support
|
184
190
|
|
data/lib/runfile/action.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Runfile
|
2
2
|
# Represents a single action inside a {Userfile} and executes its block
|
3
3
|
# on demand. Properties of this class are populated by the {DSL} module when
|
4
|
-
#
|
4
|
+
# the runfile is executed.
|
5
5
|
class Action
|
6
6
|
include Inspectable
|
7
7
|
|
@@ -26,7 +26,7 @@ module Runfile
|
|
26
26
|
|
27
27
|
instance_eval do
|
28
28
|
host.helpers.each { |b| b.call args }
|
29
|
-
block.call args
|
29
|
+
block.call args if block
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
@@ -34,10 +34,6 @@ module Runfile
|
|
34
34
|
@name = value&.to_s
|
35
35
|
end
|
36
36
|
|
37
|
-
def names
|
38
|
-
name ? [name, shortcut].compact : ['(default)']
|
39
|
-
end
|
40
|
-
|
41
37
|
def prefix
|
42
38
|
host&.full_name
|
43
39
|
end
|
@@ -58,6 +54,12 @@ module Runfile
|
|
58
54
|
@usages ||= []
|
59
55
|
end
|
60
56
|
|
57
|
+
private
|
58
|
+
|
59
|
+
def names
|
60
|
+
name.empty? ? [] : [name, shortcut].compact
|
61
|
+
end
|
62
|
+
|
61
63
|
def validate_context
|
62
64
|
host.required_contexts.each do |varname, default|
|
63
65
|
next if host.context[varname]
|
data/lib/runfile/concerns/dsl.rb
CHANGED
@@ -2,8 +2,6 @@ module Runfile
|
|
2
2
|
module DSL
|
3
3
|
# Commands
|
4
4
|
|
5
|
-
attr_reader :default_action
|
6
|
-
|
7
5
|
def action(name = nil, shortcut = nil, &block)
|
8
6
|
current_action.block = block
|
9
7
|
current_action.name = name.to_s
|
@@ -123,7 +121,6 @@ module Runfile
|
|
123
121
|
def finalize_current_action(name)
|
124
122
|
key = name.empty? ? :default : name
|
125
123
|
actions[key] = current_action
|
126
|
-
@default_action = current_action unless name
|
127
124
|
@current_action = nil
|
128
125
|
end
|
129
126
|
|
data/lib/runfile/exceptions.rb
CHANGED
data/lib/runfile/gem_finder.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module Runfile
|
2
2
|
# Finds the path of an installed or bundled gem
|
3
|
-
# Adapted from Rubocop
|
3
|
+
# Adapted from [Rubocop](https://github.com/rubocop/rubocop/blob/master/lib/rubocop/config_loader_resolver.rb#L268)
|
4
4
|
class GemFinder
|
5
5
|
class << self
|
6
6
|
def find(gem_name, file = nil)
|
data/lib/runfile/runner.rb
CHANGED
@@ -14,6 +14,8 @@ module Runfile
|
|
14
14
|
Docopt.docopt docopt, argv: argv, version: version
|
15
15
|
rescue Docopt::Exit => e
|
16
16
|
raise ExitWithUsage, e.message
|
17
|
+
rescue Docopt::DocoptLanguageError => e
|
18
|
+
raise DocoptError, "There is an error in your runfile:\nnb`#{e.message}`"
|
17
19
|
end
|
18
20
|
end
|
19
21
|
end
|
data/lib/runfile/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: runfile
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Danny Ben Shitrit
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-01
|
11
|
+
date: 2023-02-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colsole
|
@@ -144,9 +144,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
144
144
|
version: '2.7'
|
145
145
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
146
146
|
requirements:
|
147
|
-
- - "
|
147
|
+
- - ">="
|
148
148
|
- !ruby/object:Gem::Version
|
149
|
-
version:
|
149
|
+
version: '0'
|
150
150
|
requirements: []
|
151
151
|
rubygems_version: 3.4.5
|
152
152
|
signing_key:
|