mothership 0.1.0 → 0.1.1

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.
@@ -25,11 +25,11 @@ class Mothership
25
25
  end
26
26
 
27
27
  def merge(inputs)
28
- self.class.new(@command, @context, @inputs.merge(inputs), @given)
28
+ self.class.new(@command, @context, @inputs.merge(inputs), @given, @global)
29
29
  end
30
30
 
31
31
  def merge_given(inputs)
32
- self.class.new(@command, @context, @inputs, @given.merge(inputs))
32
+ self.class.new(@command, @context, @inputs, @given.merge(inputs), @global)
33
33
  end
34
34
 
35
35
  def without(*names)
@@ -40,7 +40,7 @@ class Mothership
40
40
  inputs.delete(n)
41
41
  end
42
42
 
43
- self.class.new(@command, @context, given, inputs)
43
+ self.class.new(@command, @context, given, inputs, @global)
44
44
  end
45
45
 
46
46
  def [](name, *args)
@@ -57,16 +57,13 @@ class Mothership
57
57
  def get(name, context, *args)
58
58
  return @inputs[name] if @inputs.key?(name)
59
59
 
60
- if meta = @command.inputs[name]
60
+ if @command && meta = @command.inputs[name]
61
61
  # special case so #invoke can be called with singular-named inputs
62
62
  singular = meta[:singular]
63
63
  return @inputs[name] = [@inputs[singular]] if @inputs.key?(singular)
64
64
 
65
65
  found, val = find_in(@given, name, meta, context, *args)
66
- end
67
-
68
- # if not found locally and the default is nil, search globally
69
- if !found && val.nil? && meta = Mothership.global_option(name)
66
+ elsif meta = Mothership.global_option(name)
70
67
  found, val = find_in(@global, name, meta, context, *args)
71
68
  end
72
69
 
@@ -1,3 +1,3 @@
1
1
  class Mothership
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
data/lib/mothership.rb CHANGED
@@ -29,7 +29,10 @@ class Mothership
29
29
 
30
30
  app = new
31
31
 
32
- return app.default_action unless name
32
+ unless name
33
+ app.input = Inputs.new(@@global, app, global_parser.given)
34
+ return app.default_action
35
+ end
33
36
 
34
37
  cmdname = name.gsub("-", "_").to_sym
35
38
 
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: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 0
10
- version: 0.1.0
9
+ - 1
10
+ version: 0.1.1
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-08-22 00:00:00 Z
18
+ date: 2012-08-29 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: rake