runfile 1.0.1 → 1.0.2
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/README.md +20 -19
- data/examples/helpers/runfile +1 -1
- data/lib/runfile/entrypoint.rb +7 -4
- data/lib/runfile/exceptions.rb +9 -1
- data/lib/runfile/runner.rb +1 -1
- data/lib/runfile/userfile.rb +1 -1
- data/lib/runfile/version.rb +1 -1
- metadata +13 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 41aa2631882de8a7c759aa386aa9a2f1e6ddd69446af65e49bc7b30f274c1d49
|
4
|
+
data.tar.gz: 0cc7a2ccbcd5095acc00cc5b1484b3e5122061141f7db0b9b9e18bbe469622b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3911f5c10a4883572618e19cdfda6dfedb17502bd0fd9cb090d09c48622d0924eab21590832a24d8a050af860b34cb64361bc56f604e23c27088cdbd12b06ded
|
7
|
+
data.tar.gz: a16d11d7e4d574540bc850192c86ae972118ab383c681ca0a1fe51eda75520cdb033253f1e8b7bd57597f886c2bfb22f9c9d9a16a1e636a4bd8b6856a001481b
|
data/README.md
CHANGED
@@ -120,68 +120,69 @@ $ run example --help
|
|
120
120
|
|
121
121
|
For a more formal documentation, see the [User Guide](https://runfile.dannyb.co/).
|
122
122
|
|
123
|
-
Note that the current user guide is for the stable version 0.12.0.
|
124
|
-
|
125
123
|
## Breaking Changes in 1.0.0
|
126
124
|
|
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
|
129
|
-
[this Pull Request](https://github.com/DannyBen/runfile/pull/50).
|
130
|
-
|
131
|
-
### Upgrading to 1.0.0
|
132
|
-
|
133
125
|
<details>
|
134
126
|
<summary>Show section</summary>
|
135
127
|
|
136
|
-
|
128
|
+
---
|
129
|
+
|
130
|
+
If you are using a version earlier than 1.0, note that version 1.0.0 includes
|
131
|
+
some breaking changes. You can read more about them in
|
132
|
+
[this Pull Request](https://github.com/DannyBen/runfile/pull/50).
|
133
|
+
|
134
|
+
### Upgrading to 1.0.0
|
135
|
+
|
136
|
+
#### No more `.runfile` config
|
137
137
|
|
138
138
|
If you have used the multi-runfile config file, this no longer exists.
|
139
139
|
Use a standard `runfile` instead, along with the `import` directive.
|
140
140
|
|
141
|
-
|
141
|
+
#### No more `action :global`
|
142
142
|
|
143
143
|
If you have used the `action :global do` notation, this is replaced with the
|
144
144
|
simpler use `action do` instead. Also, there is no more need for
|
145
145
|
empty `usage ''`, just delete it if you have it in your runfiles.
|
146
146
|
|
147
|
-
|
147
|
+
#### No more `execute` directive
|
148
148
|
|
149
149
|
If you have used it to cross-call other actions, it is no longer available. As
|
150
150
|
an alternative, you can define common code in separate classes and `require`
|
151
151
|
them, or use the new `helpers` directive to define functions that will be
|
152
152
|
available to all actions.
|
153
153
|
|
154
|
-
|
154
|
+
#### Code outside of actions should be inside `helpers`
|
155
155
|
|
156
156
|
If your runfiles include other ruby code, especially `def method`, you should
|
157
157
|
now use the new `helpers` block and tuck this code inside it.
|
158
158
|
|
159
|
-
|
159
|
+
#### No more need for `trap(:INT)`
|
160
160
|
|
161
161
|
If your old runfiles trap the `Interrupt` signal, there is no longer a need to
|
162
162
|
do so, as it is trapped by default.
|
163
163
|
|
164
|
-
|
164
|
+
#### Colsole is included
|
165
165
|
|
166
166
|
If your runfiles `required` and `include` Colsole, there is no longer a need to
|
167
167
|
do it. Colsole is bundled and available in actions.
|
168
168
|
|
169
|
-
|
169
|
+
#### Long flags before short flags
|
170
170
|
|
171
171
|
This is a cosmetic change for consistency. All generated output shows long flags
|
172
172
|
before short flags `--force, -f` instead of `-f, --force`. Update your custom
|
173
173
|
`usage` directives accordingly.
|
174
174
|
|
175
|
-
|
175
|
+
#### Examples no longer add implicit 'run'
|
176
176
|
|
177
177
|
If you were using the `example` directive, it will no longer add the initial
|
178
178
|
`run` in front of your examples. Add it yourself. This is intended to allow
|
179
179
|
providing more elaborate examples.
|
180
180
|
|
181
|
-
|
181
|
+
#### RunfileTasks
|
182
182
|
|
183
|
-
The
|
184
|
-
|
183
|
+
The [runfile-tasks gem](https://github.com/dannyben/runfile-tasks) is also
|
184
|
+
updated to 1.x, with a modified syntax. If you are using it, make sure to
|
185
|
+
upgrade it as well.
|
185
186
|
|
186
187
|
</details>
|
187
188
|
|
data/examples/helpers/runfile
CHANGED
data/lib/runfile/entrypoint.rb
CHANGED
@@ -27,7 +27,7 @@ module Runfile
|
|
27
27
|
run
|
28
28
|
rescue Runfile::ExitWithUsage => e
|
29
29
|
say e.message
|
30
|
-
|
30
|
+
e.exit_code
|
31
31
|
rescue Runfile::UserError => e
|
32
32
|
allow_debug e
|
33
33
|
say! "mib` #{e.class} `"
|
@@ -38,9 +38,7 @@ module Runfile
|
|
38
38
|
1
|
39
39
|
rescue => e
|
40
40
|
allow_debug e
|
41
|
-
|
42
|
-
location = "#{origin.path}:#{origin.lineno}"
|
43
|
-
say! "rib` #{e.class} ` in nu`#{location}`"
|
41
|
+
say! "rib` #{e.class} ` in nu`#{origin(e)}`"
|
44
42
|
say! e.message
|
45
43
|
say! "\nPrefix with nu`DEBUG=1` for full backtrace" unless ENV['DEBUG']
|
46
44
|
1
|
@@ -55,6 +53,11 @@ module Runfile
|
|
55
53
|
say! '---'
|
56
54
|
end
|
57
55
|
|
56
|
+
def origin(e)
|
57
|
+
(e.backtrace_locations&.first.to_s || e.backtrace&.first || 'unknown')
|
58
|
+
.tr '`', "'"
|
59
|
+
end
|
60
|
+
|
58
61
|
def rootfile
|
59
62
|
if File.file? 'runfile'
|
60
63
|
Userfile.new 'runfile'
|
data/lib/runfile/exceptions.rb
CHANGED
@@ -5,7 +5,15 @@ module Runfile
|
|
5
5
|
|
6
6
|
class Error < StandardError; end
|
7
7
|
class UserError < Error; end
|
8
|
-
|
8
|
+
|
9
|
+
class ExitWithUsage < Error
|
10
|
+
attr_reader :exit_code
|
11
|
+
|
12
|
+
def initialize(message = '', exit_code: nil)
|
13
|
+
@exit_code = exit_code || 1
|
14
|
+
super message
|
15
|
+
end
|
16
|
+
end
|
9
17
|
|
10
18
|
class ActionNotFound < UserError; end
|
11
19
|
class GemNotFound < UserError; end
|
data/lib/runfile/runner.rb
CHANGED
@@ -13,7 +13,7 @@ module Runfile
|
|
13
13
|
def call_docopt(docopt, version: nil, argv: nil)
|
14
14
|
DocoptNG.docopt docopt, argv: argv, version: version
|
15
15
|
rescue DocoptNG::Exit => e
|
16
|
-
raise ExitWithUsage, e.message
|
16
|
+
raise ExitWithUsage.new(exit_code: e.exit_code), e.message
|
17
17
|
rescue DocoptNG::DocoptLanguageError => e
|
18
18
|
raise DocoptError, "There is an error in your runfile:\nnb`#{e.message}`"
|
19
19
|
end
|
data/lib/runfile/userfile.rb
CHANGED
@@ -46,7 +46,7 @@ module Runfile
|
|
46
46
|
def guests
|
47
47
|
@guests ||= begin
|
48
48
|
result = imports.map do |glob, context|
|
49
|
-
Dir.glob("#{glob}.runfile").
|
49
|
+
Dir.glob("#{glob}.runfile").map do |guest_path|
|
50
50
|
Userfile.new guest_path, context: context, host: self
|
51
51
|
end
|
52
52
|
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.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Danny Ben Shitrit
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-11-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colsole
|
@@ -37,6 +37,9 @@ dependencies:
|
|
37
37
|
- - "~>"
|
38
38
|
- !ruby/object:Gem::Version
|
39
39
|
version: '0.7'
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: 0.7.1
|
40
43
|
type: :runtime
|
41
44
|
prerelease: false
|
42
45
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -44,6 +47,9 @@ dependencies:
|
|
44
47
|
- - "~>"
|
45
48
|
- !ruby/object:Gem::Version
|
46
49
|
version: '0.7'
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: 0.7.1
|
47
53
|
- !ruby/object:Gem::Dependency
|
48
54
|
name: gtx
|
49
55
|
requirement: !ruby/object:Gem::Requirement
|
@@ -133,7 +139,7 @@ metadata:
|
|
133
139
|
source_code_uri: https://github.com/DannyBen/runfile
|
134
140
|
bug_tracker_uri: https://github.com/DannyBen/runfile/issues
|
135
141
|
rubygems_mfa_required: 'true'
|
136
|
-
post_install_message:
|
142
|
+
post_install_message:
|
137
143
|
rdoc_options: []
|
138
144
|
require_paths:
|
139
145
|
- lib
|
@@ -141,15 +147,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
141
147
|
requirements:
|
142
148
|
- - ">="
|
143
149
|
- !ruby/object:Gem::Version
|
144
|
-
version: '
|
150
|
+
version: '3.0'
|
145
151
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
146
152
|
requirements:
|
147
153
|
- - ">="
|
148
154
|
- !ruby/object:Gem::Version
|
149
155
|
version: '0'
|
150
156
|
requirements: []
|
151
|
-
rubygems_version: 3.
|
152
|
-
signing_key:
|
157
|
+
rubygems_version: 3.3.26
|
158
|
+
signing_key:
|
153
159
|
specification_version: 4
|
154
160
|
summary: Local command line for your projects
|
155
161
|
test_files: []
|