run_tasks 1.2.8 → 1.3.0
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/src/run.rb +16 -10
- 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: defef3f4c383f104dbdd29d887667fd4dc78ab7f6126df67f9c2a164273edb05
|
4
|
+
data.tar.gz: 82b310b715b998b76ff8269cc36760dfee621915796e736ff8850247c2aa427b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1db823df990b780814e452ec8911efaae7c9d80448d075cc1af5b342b4b09e7f3a46074d8b919d517846dfa91a0ae4fd35a670d6093a28384b1edccc9b9c815d
|
7
|
+
data.tar.gz: 94fab98a5b6d052bc225ba2c363e741a61d7b206f7bb9f50b0047ef830a72118599a9f5b8703d40530df1bbcbb6e1d3dba4580addb38b5301d5d27f284816614
|
data/src/run.rb
CHANGED
@@ -27,7 +27,9 @@ HOMEPAGE = GEM&.homepage
|
|
27
27
|
|
28
28
|
@tasks = Hash.new
|
29
29
|
|
30
|
-
#
|
30
|
+
# @param name [Symbol]
|
31
|
+
# @param help [String]
|
32
|
+
# @yield [*Array, **Hash]
|
31
33
|
def task(name, help = "", &block)
|
32
34
|
if !name.is_a?(Symbol)
|
33
35
|
puts
|
@@ -50,16 +52,18 @@ def task(name, help = "", &block)
|
|
50
52
|
)
|
51
53
|
end
|
52
54
|
|
53
|
-
#
|
54
|
-
|
55
|
-
|
56
|
-
|
55
|
+
# @param task_name_or_command [Symbol, String]
|
56
|
+
# @param arguments [Array] Optional arguments sent to the task.
|
57
|
+
# @param options [Hash] Optional options sent to the task.
|
58
|
+
def run(task_name_or_command, *arguments, **options)
|
59
|
+
if task_name_or_command.is_a?(Symbol)
|
60
|
+
@tasks[task_name_or_command][:block].call *arguments, **options
|
61
|
+
return
|
62
|
+
end
|
57
63
|
|
58
|
-
|
59
|
-
def shell(command)
|
60
|
-
puts ">".bright_blue + " #{command}".bright_white
|
64
|
+
puts ">".bright_blue + " #{task_name_or_command}".bright_white
|
61
65
|
puts
|
62
|
-
case system(
|
66
|
+
case system(task_name_or_command)
|
63
67
|
when false
|
64
68
|
puts
|
65
69
|
puts "The command has exited with return code: #{$?.exitstatus}.".magenta
|
@@ -74,6 +78,7 @@ def shell(command)
|
|
74
78
|
puts
|
75
79
|
end
|
76
80
|
|
81
|
+
# @param uri [String]
|
77
82
|
def require_remote(uri)
|
78
83
|
cache_path = "/tmp/run_cache_#{Digest::MD5.hexdigest(uri)}"
|
79
84
|
if !File.exists? cache_path
|
@@ -88,6 +93,7 @@ rescue => error
|
|
88
93
|
exit 8
|
89
94
|
end
|
90
95
|
|
96
|
+
# @param name [String]
|
91
97
|
def require_extension(name)
|
92
98
|
require_remote "https://pyrsmk.fra1.cdn.digitaloceanspaces.com" \
|
93
99
|
"/run_extensions/#{name}.rb"
|
@@ -171,7 +177,7 @@ if !@tasks.include?(name)
|
|
171
177
|
exit 2
|
172
178
|
end
|
173
179
|
begin
|
174
|
-
|
180
|
+
run(name, *ARGV.slice(1..))
|
175
181
|
rescue Interrupt
|
176
182
|
exit 3
|
177
183
|
rescue => error
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: run_tasks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aurélien Delogu
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-02-
|
11
|
+
date: 2023-02-16 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email: aurelien.delogu@gmail.com
|