runfile 1.0.0.rc1 → 1.0.0.rc2
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 -1
- data/examples/import/more_tasks/spec.runfile +1 -0
- data/examples/import/runfile +1 -1
- data/examples/import/tasks/server.runfile +1 -0
- data/lib/runfile/concerns/dsl.rb +8 -24
- data/lib/runfile/meta.rb +13 -13
- data/lib/runfile/userfile.rb +2 -10
- data/lib/runfile/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5ae2a7aefd3a25703d232d70e6857aeafe467772582a96202d371bfca748e1f7
|
4
|
+
data.tar.gz: 32f39514ba7ffb8318c305278f55a397d2e686c7179cec0ff5899c5e6fd62871
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 289c29cf9119ce944bc46c1c6067299454396b143721b5b5b0b6b03553bca3c805743656a13cb8f4757a77022e4294152254124d7f6dfea4803879ac4289690d
|
7
|
+
data.tar.gz: 61afd4733813f4f3082765eae107295af324a446da8ccc5bc70959504c81aba0a161e286fc25ff0095b2fbff0c50b3a9fb76a8a21f992c6f5c620b1abd15b111
|
data/README.md
CHANGED
@@ -29,7 +29,8 @@ command line "toolbelt" for your projects, you can use it regardless.
|
|
29
29
|
## Pre-release Notice
|
30
30
|
|
31
31
|
Note that this README describes the not yet released 1.0.0 version.
|
32
|
-
See https://
|
32
|
+
See [runfile.dannyb.co](https://runfile.dannyb.co/) for the stable release
|
33
|
+
documentation.
|
33
34
|
|
34
35
|
During the pre-release phase, the `run` executable is called `runn` instead,
|
35
36
|
to allow running both the stable and pre-release version side by side.
|
data/examples/import/runfile
CHANGED
@@ -2,7 +2,7 @@ title 'Importing other funfiles'
|
|
2
2
|
summary 'Reference other runfiles to blend them seamlessly as one command line interface'
|
3
3
|
|
4
4
|
import 'tasks/*'
|
5
|
-
import 'more_tasks/spec'
|
5
|
+
import 'more_tasks/spec', anything: 'Context Values'
|
6
6
|
|
7
7
|
usage 'say MESSAGE'
|
8
8
|
action 'say' do |args|
|
data/lib/runfile/concerns/dsl.rb
CHANGED
@@ -10,12 +10,6 @@ module Runfile
|
|
10
10
|
current_action.shortcut = shortcut if shortcut
|
11
11
|
current_action.prefix = action_prefix if action_prefix
|
12
12
|
|
13
|
-
# if default_action && name
|
14
|
-
# raise SyntaxError, <<~ERROR
|
15
|
-
# Cannot define action nub`#{name}` since a default action was already defined
|
16
|
-
# ERROR
|
17
|
-
# end
|
18
|
-
|
19
13
|
actions[name || :default] = current_action
|
20
14
|
@default_action = current_action unless name
|
21
15
|
@current_action = nil
|
@@ -33,21 +27,15 @@ module Runfile
|
|
33
27
|
current_action.help = message
|
34
28
|
end
|
35
29
|
|
36
|
-
def import(pathspec)
|
37
|
-
imports
|
30
|
+
def import(pathspec, context = nil)
|
31
|
+
imports[pathspec] = context
|
38
32
|
end
|
39
33
|
|
40
|
-
def import_gem(
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
ERROR
|
46
|
-
end
|
47
|
-
|
48
|
-
path = GemFinder.find gem_name, runfile_path
|
49
|
-
imports.push path
|
50
|
-
contexts[runfile_path] = context if context
|
34
|
+
def import_gem(pathspec, context = nil)
|
35
|
+
gem_name, glob = pathspec.split('/', 2)
|
36
|
+
glob ||= '*'
|
37
|
+
path = GemFinder.find gem_name, glob
|
38
|
+
imports[path] = context
|
51
39
|
end
|
52
40
|
|
53
41
|
def option(name, help)
|
@@ -95,10 +83,6 @@ module Runfile
|
|
95
83
|
nil
|
96
84
|
end
|
97
85
|
|
98
|
-
def contexts
|
99
|
-
@contexts ||= {}
|
100
|
-
end
|
101
|
-
|
102
86
|
def actions
|
103
87
|
@actions ||= {}
|
104
88
|
end
|
@@ -120,7 +104,7 @@ module Runfile
|
|
120
104
|
end
|
121
105
|
|
122
106
|
def imports
|
123
|
-
@imports ||=
|
107
|
+
@imports ||= {}
|
124
108
|
end
|
125
109
|
|
126
110
|
private
|
data/lib/runfile/meta.rb
CHANGED
@@ -43,23 +43,23 @@ module Runfile
|
|
43
43
|
@masterfile ||= Userfile.load_file masterfile_path
|
44
44
|
end
|
45
45
|
|
46
|
-
# def title
|
47
|
-
# masterfile&.title
|
48
|
-
# end
|
49
|
-
|
50
|
-
# def summary
|
51
|
-
# masterfile&.summary
|
52
|
-
# end
|
53
|
-
|
54
46
|
def globs
|
55
|
-
@globs ||= (masterfile ? ['*'] + masterfile.imports : ['*'])
|
47
|
+
@globs ||= (masterfile ? ['*'] + masterfile.imports.keys : ['*'])
|
56
48
|
end
|
57
49
|
|
58
50
|
def external_files
|
59
|
-
@external_files ||=
|
60
|
-
|
61
|
-
.
|
62
|
-
|
51
|
+
@external_files ||= begin
|
52
|
+
result = []
|
53
|
+
globs.each do |glob|
|
54
|
+
Dir["#{glob}.runfile"].sort.each do |file|
|
55
|
+
userfile = Userfile.load_file(file)
|
56
|
+
userfile.context = masterfile.imports[glob] if masterfile
|
57
|
+
result.push userfile
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
result.to_h { |file| [file.name, file] }
|
62
|
+
end
|
63
63
|
end
|
64
64
|
end
|
65
65
|
end
|
data/lib/runfile/userfile.rb
CHANGED
@@ -44,11 +44,11 @@ module Runfile
|
|
44
44
|
end
|
45
45
|
|
46
46
|
def inspectable
|
47
|
-
{ name: name, path: path }
|
47
|
+
{ name: name, path: path, context: context }
|
48
48
|
end
|
49
49
|
|
50
50
|
def run(argv = [])
|
51
|
-
found_delegate =
|
51
|
+
found_delegate = delegates[argv[0]]
|
52
52
|
if found_delegate
|
53
53
|
found_delegate.run argv
|
54
54
|
else
|
@@ -92,14 +92,6 @@ module Runfile
|
|
92
92
|
end
|
93
93
|
end
|
94
94
|
|
95
|
-
def delegate(name)
|
96
|
-
return nil unless delegates.has_key? name
|
97
|
-
|
98
|
-
result = delegates[name]
|
99
|
-
result.context = contexts[name]
|
100
|
-
result
|
101
|
-
end
|
102
|
-
|
103
95
|
def meta
|
104
96
|
@meta ||= Meta.new
|
105
97
|
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.rc2
|
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-01-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colsole
|