mothership 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/mothership/callbacks.rb +5 -0
- data/lib/mothership/inputs.rb +11 -3
- data/lib/mothership/version.rb +1 -1
- metadata +4 -4
data/lib/mothership/callbacks.rb
CHANGED
@@ -29,11 +29,16 @@ class Mothership
|
|
29
29
|
|
30
30
|
# change an argument's status, i.e. optional, splat, or required
|
31
31
|
def change_argument(name, arg, to)
|
32
|
+
changed = false
|
33
|
+
|
32
34
|
@@commands[name].arguments.each do |a|
|
33
35
|
if a[:name] == arg
|
34
36
|
a[:type] = to
|
37
|
+
changed = true
|
35
38
|
end
|
36
39
|
end
|
40
|
+
|
41
|
+
changed
|
37
42
|
end
|
38
43
|
end
|
39
44
|
|
data/lib/mothership/inputs.rb
CHANGED
@@ -35,14 +35,22 @@ class Mothership
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def get(name, context, *args)
|
38
|
-
return @inputs[name] if @inputs.key?(name) && @inputs[name] != []
|
39
|
-
|
40
38
|
return @cache[name] if @cache.key? name
|
41
39
|
|
42
40
|
meta = @command.inputs[name]
|
43
|
-
|
44
41
|
return unless meta
|
45
42
|
|
43
|
+
if @inputs.key?(name) && @inputs[name] != []
|
44
|
+
val =
|
45
|
+
if meta[:from_given]
|
46
|
+
@context.instance_exec(@inputs[name], *args, &meta[:from_given])
|
47
|
+
else
|
48
|
+
@inputs[name]
|
49
|
+
end
|
50
|
+
|
51
|
+
return @cache[name] = val
|
52
|
+
end
|
53
|
+
|
46
54
|
val =
|
47
55
|
if meta[:default].respond_to? :to_proc
|
48
56
|
unless context
|
data/lib/mothership/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mothership
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 4
|
10
|
+
version: 0.0.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Alex Suraci
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-07-
|
18
|
+
date: 2012-07-14 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: rake
|