run_tasks 1.2.2 → 1.2.3
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 +20 -8
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 55d34286c7c424f5bb48204f7b237e7ae844f1a1dd3829cd2b75191597ba5b79
|
|
4
|
+
data.tar.gz: 5801a9e3917159b46a0cb3ff1990e7457d818171ebc54a8203597af60e1b9a74
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 55de0b11daec5bbbee761655371805af0ee927a5fb39a79156f8de4db643f87eb9770822401d4907e35d6b192156484715ddfffb10f8a195fd6b31909fe4f6bc
|
|
7
|
+
data.tar.gz: 3850279419812cc7b24b5db29b90cf99f00e5a60d07f90dac4e5d05e2cc56926a30630c21082b197b2a85688f36e2180a4a794db80f6aaa7bc2e1852ee863d7a
|
data/src/run.rb
CHANGED
|
@@ -11,12 +11,12 @@ require "securerandom"
|
|
|
11
11
|
|
|
12
12
|
GEMSPEC_PATH = "#{__dir__}/../run_tasks.gemspec"
|
|
13
13
|
GEM = if File.exist?(GEMSPEC_PATH)
|
|
14
|
-
Gem::Specification::load(GEMSPEC_PATH)
|
|
14
|
+
Gem::Specification::load(GEMSPEC_PATH) # Development.
|
|
15
15
|
else
|
|
16
|
-
Gem::Specification::find_by_name("run_tasks") rescue nil
|
|
16
|
+
Gem::Specification::find_by_name("run_tasks") rescue nil # Production.
|
|
17
17
|
end
|
|
18
|
-
VERSION = GEM
|
|
19
|
-
HOMEPAGE = GEM
|
|
18
|
+
VERSION = GEM&.version
|
|
19
|
+
HOMEPAGE = GEM&.homepage
|
|
20
20
|
|
|
21
21
|
##########################################################################################
|
|
22
22
|
|
|
@@ -69,11 +69,15 @@ end
|
|
|
69
69
|
# Define a task.
|
|
70
70
|
def task(name, help = "", &block)
|
|
71
71
|
if !name.is_a?(Symbol)
|
|
72
|
-
puts
|
|
72
|
+
puts
|
|
73
|
+
puts "First task parameter must be a symbol".red
|
|
74
|
+
puts
|
|
73
75
|
exit 6
|
|
74
76
|
end
|
|
75
77
|
if !help.is_a?(String)
|
|
76
|
-
puts
|
|
78
|
+
puts
|
|
79
|
+
puts "Second task parameter must be a string".red
|
|
80
|
+
puts
|
|
77
81
|
exit 6
|
|
78
82
|
end
|
|
79
83
|
@tasks.store(name, { :help => help, :block => block })
|
|
@@ -109,8 +113,10 @@ def require_remote(uri)
|
|
|
109
113
|
end
|
|
110
114
|
eval File.read(cache_path)
|
|
111
115
|
rescue => error
|
|
116
|
+
puts
|
|
112
117
|
puts "Unable to load #{uri}:".red
|
|
113
118
|
puts "#{error.class}: #{error.message}".red
|
|
119
|
+
puts
|
|
114
120
|
exit 8
|
|
115
121
|
end
|
|
116
122
|
|
|
@@ -124,14 +130,18 @@ end
|
|
|
124
130
|
RUNFILE = "Runfile.rb"
|
|
125
131
|
|
|
126
132
|
if !File.exists?(RUNFILE)
|
|
127
|
-
puts
|
|
133
|
+
puts
|
|
134
|
+
puts "#{RUNFILE} does not exist".red
|
|
135
|
+
puts
|
|
128
136
|
exit 7
|
|
129
137
|
end
|
|
130
138
|
|
|
131
139
|
begin
|
|
132
140
|
require "./#{RUNFILE}"
|
|
133
141
|
rescue SyntaxError
|
|
142
|
+
puts
|
|
134
143
|
puts "The Runfile contains a syntax error.".red
|
|
144
|
+
puts
|
|
135
145
|
exit 5
|
|
136
146
|
end
|
|
137
147
|
|
|
@@ -186,7 +196,9 @@ end
|
|
|
186
196
|
# Run the requested task.
|
|
187
197
|
name = ARGV[0].to_sym
|
|
188
198
|
if !@tasks.include?(name)
|
|
189
|
-
puts
|
|
199
|
+
puts
|
|
200
|
+
puts "Unknown '#{name}' task".red
|
|
201
|
+
puts
|
|
190
202
|
exit 2
|
|
191
203
|
end
|
|
192
204
|
begin
|