runfile 1.0.0 → 1.0.1
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 +2 -2
- data/lib/runfile/runner.rb +3 -3
- data/lib/runfile/userfile.rb +16 -4
- data/lib/runfile/version.rb +1 -1
- data/lib/runfile.rb +1 -6
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b5a340ad5324cc9b24104fc460c171300cc2ab9690bb8bdfa2b38442b3ddf81a
|
4
|
+
data.tar.gz: e3f0fe2e7c4ba4fca9058d10f5caffc2daa76d5f0810aa5a63d646d2a23347d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f94f10d4feda0300878584b68c1af769bc1a81392ee52f7716d89d0d7fe376cf9d20cc2cbb8bc0ef35d5574b469de038df67e99dbaa0a077ca4fed7a7cb548c
|
7
|
+
data.tar.gz: 5983f010e720484acdb6b013248c32f4ed104180e7fc05218c93abfaf1a3eea7775b95e7e6e7cbe2c0871316056fe4d99c27b7e1b93b13524782015199a66a8a
|
data/README.md
CHANGED
@@ -125,8 +125,8 @@ Note that the current user guide is for the stable version 0.12.0.
|
|
125
125
|
## Breaking Changes in 1.0.0
|
126
126
|
|
127
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
|
-
(https://github.com/DannyBen/runfile/pull/50).
|
128
|
+
some breaking changes. You can read more about them in
|
129
|
+
[this Pull Request](https://github.com/DannyBen/runfile/pull/50).
|
130
130
|
|
131
131
|
### Upgrading to 1.0.0
|
132
132
|
|
data/lib/runfile/runner.rb
CHANGED
@@ -11,10 +11,10 @@ module Runfile
|
|
11
11
|
private
|
12
12
|
|
13
13
|
def call_docopt(docopt, version: nil, argv: nil)
|
14
|
-
|
15
|
-
rescue
|
14
|
+
DocoptNG.docopt docopt, argv: argv, version: version
|
15
|
+
rescue DocoptNG::Exit => e
|
16
16
|
raise ExitWithUsage, e.message
|
17
|
-
rescue
|
17
|
+
rescue DocoptNG::DocoptLanguageError => e
|
18
18
|
raise DocoptError, "There is an error in your runfile:\nnb`#{e.message}`"
|
19
19
|
end
|
20
20
|
end
|
data/lib/runfile/userfile.rb
CHANGED
@@ -77,9 +77,11 @@ module Runfile
|
|
77
77
|
|
78
78
|
def run(argv = [])
|
79
79
|
eval_code
|
80
|
-
argv = transform_argv argv if argv.any?
|
81
80
|
|
82
|
-
|
81
|
+
if argv.any?
|
82
|
+
argv = expand_shortcuts argv
|
83
|
+
found_guest = find_guest argv
|
84
|
+
end
|
83
85
|
|
84
86
|
if found_guest
|
85
87
|
found_guest.run argv
|
@@ -128,9 +130,19 @@ module Runfile
|
|
128
130
|
exit_code if exit_code.is_a? Integer
|
129
131
|
end
|
130
132
|
|
131
|
-
|
133
|
+
# Shortcuts will always appear after the name, so we split argv to
|
134
|
+
# name (array), shortcut wannabe (string), rest of the args (array).
|
135
|
+
# Then, if the shortcut wannabe is a match, we stitch the new argv back
|
136
|
+
# together, with its expansion.
|
137
|
+
def expand_shortcuts(argv)
|
138
|
+
size = id.size
|
139
|
+
|
140
|
+
p1 = argv[0...size]
|
141
|
+
p2 = argv[size]
|
142
|
+
p3 = argv[(size + 1)..]
|
143
|
+
|
132
144
|
shortcuts.each do |from, to|
|
133
|
-
return Shellwords.split(to) +
|
145
|
+
return p1 + Shellwords.split(to) + p3 if from == p2
|
134
146
|
end
|
135
147
|
|
136
148
|
argv
|
data/lib/runfile/version.rb
CHANGED
data/lib/runfile.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.1
|
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-02-
|
11
|
+
date: 2023-02-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colsole
|
@@ -31,19 +31,19 @@ dependencies:
|
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: '2.0'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
|
-
name:
|
34
|
+
name: docopt_ng
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
37
|
- - "~>"
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: '0.
|
39
|
+
version: '0.7'
|
40
40
|
type: :runtime
|
41
41
|
prerelease: false
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
44
|
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: '0.
|
46
|
+
version: '0.7'
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: gtx
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -148,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
148
148
|
- !ruby/object:Gem::Version
|
149
149
|
version: '0'
|
150
150
|
requirements: []
|
151
|
-
rubygems_version: 3.4.
|
151
|
+
rubygems_version: 3.4.6
|
152
152
|
signing_key:
|
153
153
|
specification_version: 4
|
154
154
|
summary: Local command line for your projects
|