mothership 0.0.9 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/mothership/inputs.rb +7 -2
- data/lib/mothership/parser.rb +1 -1
- data/lib/mothership/pretty.rb +5 -2
- data/lib/mothership/version.rb +1 -1
- metadata +4 -4
data/lib/mothership/inputs.rb
CHANGED
@@ -10,17 +10,21 @@ class Mothership
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def given?(name)
|
13
|
-
@given.key?(name)
|
13
|
+
@inputs.key?(name) || @given.key?(name)
|
14
14
|
end
|
15
15
|
|
16
16
|
def given(name)
|
17
|
-
@given[name]
|
17
|
+
@inputs[name] || @given[name]
|
18
18
|
end
|
19
19
|
|
20
20
|
def merge(inputs)
|
21
21
|
self.class.new(@command, @context, @given, @inputs.merge(inputs))
|
22
22
|
end
|
23
23
|
|
24
|
+
def merge_given(inputs)
|
25
|
+
self.class.new(@command, @context, @given.merge(inputs), @inputs)
|
26
|
+
end
|
27
|
+
|
24
28
|
def without(*names)
|
25
29
|
given = @given.dup
|
26
30
|
inputs = @inputs.dup
|
@@ -46,6 +50,7 @@ class Mothership
|
|
46
50
|
return @inputs[name] = [@inputs[singular]] if @inputs.key?(singular)
|
47
51
|
|
48
52
|
given = @given[name] if @given.key?(name)
|
53
|
+
given ||= [@given[singular]] if @given.key?(singular)
|
49
54
|
|
50
55
|
# value given; convert if needed
|
51
56
|
if given && given != []
|
data/lib/mothership/parser.rb
CHANGED
data/lib/mothership/pretty.rb
CHANGED
@@ -71,12 +71,15 @@ module Mothership::Pretty
|
|
71
71
|
|
72
72
|
return str unless color
|
73
73
|
|
74
|
-
"\e[#{bright ? 9 : 3}#{COLOR_CODES[color]}m
|
74
|
+
code = "\e[#{bright ? 9 : 3}#{COLOR_CODES[color]}m"
|
75
|
+
"#{code}#{str.gsub("\e[0m", "\e[0m#{code}")}\e[0m"
|
75
76
|
end
|
76
77
|
|
77
78
|
# bold text
|
78
79
|
def b(str)
|
79
80
|
return str unless color?
|
80
|
-
|
81
|
+
|
82
|
+
code = "\e[1m"
|
83
|
+
"#{code}#{str.gsub("\e[0m", "\e[0m#{code}")}\e[0m"
|
81
84
|
end
|
82
85
|
end
|
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: 11
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 10
|
10
|
+
version: 0.0.10
|
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-23 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: rake
|