rubtools 0.0.5 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rubtools.rb +59 -14
- data/lib/rubtools/version.rb +1 -1
- data/rubtools_completion.bash +10 -0
- data/rubtools_completion.zsh +10 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 21adde933d92eb32f75a27e329aadf1ebf5e10a2
|
4
|
+
data.tar.gz: 17ed0cdbb5fdcb4bfc64e4597970dd1b532b974c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 70c7bef23f8dd9002fb5145493b5793de4fc2753f34ef1555154467f44372782bee14df42479883e04384fc3e9644099622fd584c1d5e275348e2c4516b8b09a
|
7
|
+
data.tar.gz: d8dfcc83a230e54dffa971a8dec8a8f7bf076b2e79f87da8a403b3aaba9cd5338e6f890138b1a873223b2bce24f12b8c65d6f4ab1e003c1e505557485e446c72
|
data/lib/rubtools.rb
CHANGED
@@ -49,6 +49,10 @@ module Rubtools
|
|
49
49
|
@options[:list] = l
|
50
50
|
end
|
51
51
|
|
52
|
+
opts.on_tail("-C", "--cmplt", "Complete command") do |c|
|
53
|
+
@options[:cmplt] = c
|
54
|
+
end
|
55
|
+
|
52
56
|
opts.on_tail("-h", "--help", "Show help") do
|
53
57
|
Logger.verbose opts
|
54
58
|
exit
|
@@ -96,20 +100,8 @@ module Rubtools
|
|
96
100
|
end
|
97
101
|
end
|
98
102
|
|
99
|
-
|
100
|
-
|
101
|
-
for constant in @tools.keys
|
102
|
-
for method_hash in @tools[constant]
|
103
|
-
params = method_hash.first.last.any? ? "(#{method_hash.first.last.join(", ")})" : nil
|
104
|
-
Logger.success "#{constant}:#{method_hash.keys.first}#{params}"
|
105
|
-
end
|
106
|
-
|
107
|
-
if @tools[constant].any? && @tools.keys.last != constant
|
108
|
-
Logger.verbose "\n"
|
109
|
-
end
|
110
|
-
end
|
111
|
-
exit
|
112
|
-
end
|
103
|
+
# Execute options before running recipes
|
104
|
+
execute_options
|
113
105
|
|
114
106
|
begin
|
115
107
|
raise ArgumentError, "missing arguments" unless @args.any?
|
@@ -144,5 +136,58 @@ module Rubtools
|
|
144
136
|
end
|
145
137
|
end
|
146
138
|
end
|
139
|
+
|
140
|
+
|
141
|
+
private
|
142
|
+
|
143
|
+
## Check and execute options
|
144
|
+
# - List available commands
|
145
|
+
# - Complete commands
|
146
|
+
#
|
147
|
+
def execute_options
|
148
|
+
|
149
|
+
for option in @options
|
150
|
+
## List available commands
|
151
|
+
#
|
152
|
+
if option.first == :list && option.last
|
153
|
+
Logger.verbose "Available commands: \n\n"
|
154
|
+
for constant in @tools.keys
|
155
|
+
for method_hash in @tools[constant]
|
156
|
+
params = method_hash.first.last.any? ? "(#{method_hash.first.last.join(", ")})" : nil
|
157
|
+
Logger.success "#{constant}:#{method_hash.keys.first}#{params}"
|
158
|
+
end
|
159
|
+
|
160
|
+
if @tools[constant].any? && @tools.keys.last != constant
|
161
|
+
Logger.verbose "\n"
|
162
|
+
end
|
163
|
+
end
|
164
|
+
exit 0
|
165
|
+
|
166
|
+
## Complete command
|
167
|
+
#
|
168
|
+
elsif option.first == :cmplt && option.last
|
169
|
+
args = @args.first.split(":")
|
170
|
+
|
171
|
+
if args.size == 1
|
172
|
+
for constant in @tools.keys
|
173
|
+
if constant.to_s.start_with? args.first
|
174
|
+
print constant.to_s + ":"
|
175
|
+
exit 0
|
176
|
+
end
|
177
|
+
end
|
178
|
+
elsif args.size == 2
|
179
|
+
for constant in @tools.keys
|
180
|
+
for method_hash in @tools[constant]
|
181
|
+
method_name = method_hash.keys.first
|
182
|
+
if method_name.to_s.start_with? args.last
|
183
|
+
print constant.to_s + ":" + method_name.to_s
|
184
|
+
exit 0
|
185
|
+
end
|
186
|
+
end
|
187
|
+
end
|
188
|
+
end
|
189
|
+
end
|
190
|
+
end
|
191
|
+
end
|
147
192
|
end
|
148
193
|
end
|
data/lib/rubtools/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubtools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pierre FILSTROFF
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-06-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: term-ansicolor
|
@@ -117,6 +117,8 @@ files:
|
|
117
117
|
- lib/tools/git.rb
|
118
118
|
- lib/tools/svn.rb
|
119
119
|
- rubtools.gemspec
|
120
|
+
- rubtools_completion.bash
|
121
|
+
- rubtools_completion.zsh
|
120
122
|
homepage: ''
|
121
123
|
licenses:
|
122
124
|
- MIT
|