everyday_thor_util 2.0.1 → 2.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/lib/everyday_thor_util/builder.rb +19 -13
- data/lib/everyday_thor_util/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f929d1d0b101083c8b1883c0b912b9a81d47cc84
|
4
|
+
data.tar.gz: a89c6e92dea3dda294c4ebaeecc637cb087456a1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5df372dcaf50ccf8456ff049bb82fc96561d740d09526be61b2febcd66d59d25ebbbf8f7322774b1f547d292a53bc8a327b24acba308f7dfb44f7ca6abaf3f35
|
7
|
+
data.tar.gz: 48773e7eb081c6bd52913b6b223187057b632185758b30cf30831fdb58d3253895cd4e53cf96bb4f42bd32394850d43ac7486e14b885843573a9e78d728286b9
|
@@ -204,11 +204,19 @@ module EverydayThorUtil
|
|
204
204
|
rc
|
205
205
|
end
|
206
206
|
|
207
|
+
def build_helpers(p, pc)
|
208
|
+
self.global.helpers.helpers.each { |hn, h| pc.no_commands { pc.create_method(hn.to_sym, &h) } }
|
209
|
+
p.helpers.helpers.each { |hn, h| pc.no_commands { pc.create_method(hn.to_sym, &h) } }
|
210
|
+
end
|
211
|
+
|
212
|
+
def build_flags(p, pc, has_children)
|
213
|
+
p.flags.each { |fn, f| has_children ? pc.class_option(fn.to_sym, f) : pc.option(fn.to_sym, f) }
|
214
|
+
end
|
215
|
+
|
207
216
|
def build_recurse(p, pc)
|
208
217
|
if p.parent.nil?
|
209
|
-
p
|
210
|
-
|
211
|
-
p.helpers.helpers.each { |hn, h| pc.no_commands { pc.create_method(hn.to_sym, &h) } }
|
218
|
+
build_flags(p, pc, true)
|
219
|
+
build_helpers(p, pc)
|
212
220
|
end
|
213
221
|
p.commands.commands.each { |cn, c|
|
214
222
|
short_desc = c.options[:short_desc]
|
@@ -218,33 +226,31 @@ module EverydayThorUtil
|
|
218
226
|
if !c.leaf?
|
219
227
|
cc = Class.new(Thor)
|
220
228
|
cc.namespace cn.to_s
|
221
|
-
|
222
|
-
c
|
223
|
-
c.flags.flags.each { |fn, f| cc.class_option(fn.to_sym, f) }
|
229
|
+
build_helpers(c, cc)
|
230
|
+
build_flags(c, cc, true)
|
224
231
|
build_recurse(c, cc)
|
225
|
-
c
|
232
|
+
build_flags(c, pc, false)
|
226
233
|
pc.desc short_desc, desc if short_desc && desc
|
227
234
|
pc.long_desc long_desc if long_desc
|
228
235
|
pc.subcommand cn, cc
|
229
236
|
aliases.each { |an|
|
230
237
|
cc2 = Class.new(Thor)
|
231
238
|
cc2.namespace an
|
232
|
-
|
233
|
-
c
|
234
|
-
c.flags.flags.each { |fn, f| cc2.class_option(fn.to_sym, f) }
|
239
|
+
build_helpers(c, cc2)
|
240
|
+
build_flags(c, cc2, true)
|
235
241
|
build_recurse(c, cc2)
|
236
|
-
c
|
242
|
+
build_flags(c, pc, false)
|
237
243
|
pc.desc short_desc.gsub(/^\S+(?=\s|$)/, an.gsub(/_/, '-')), desc if short_desc && desc
|
238
244
|
pc.long_desc long_desc if long_desc
|
239
245
|
pc.subcommand an, cc2
|
240
246
|
} if aliases && !aliases.empty?
|
241
247
|
elsif c.body
|
242
|
-
c
|
248
|
+
build_flags(c, pc, false)
|
243
249
|
pc.desc short_desc, desc if short_desc && desc
|
244
250
|
pc.long_desc long_desc if long_desc
|
245
251
|
pc.create_method(cn.to_sym, &c.body)
|
246
252
|
aliases.each { |an|
|
247
|
-
c
|
253
|
+
build_flags(c, pc, false)
|
248
254
|
pc.desc short_desc.gsub(/^\S+(?=\s|$)/, an.gsub(/_/, '-')), desc if short_desc && desc
|
249
255
|
pc.long_desc long_desc if long_desc
|
250
256
|
pc.dup_method an.to_sym, cn.to_sym
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: everyday_thor_util
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Henderson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|