ggem 1.8.1 → 1.9.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 +7 -7
- data/Gemfile +3 -1
- data/README.md +2 -2
- data/bin/ggem +1 -1
- data/ggem.gemspec +8 -6
- data/lib/ggem.rb +2 -2
- data/lib/ggem/cli.rb +49 -54
- data/lib/ggem/cli/clirb.rb +44 -48
- data/lib/ggem/cli/commands.rb +23 -56
- data/lib/ggem/gem.rb +43 -43
- data/lib/ggem/gemspec.rb +68 -73
- data/lib/ggem/git_repo.rb +39 -44
- data/lib/ggem/template.rb +52 -54
- data/lib/ggem/template_file/Gemfile.erb +3 -1
- data/lib/ggem/template_file/README.md.erb +4 -4
- data/lib/ggem/template_file/gemspec.erb +10 -8
- data/lib/ggem/template_file/lib.rb.erb +2 -2
- data/lib/ggem/template_file/lib_version.rb.erb +1 -1
- data/lib/ggem/template_file/ruby-version.erb +1 -0
- data/lib/ggem/template_file/test_helper.rb.erb +2 -11
- data/lib/ggem/template_file/test_support_factory.rb.erb +1 -2
- data/lib/ggem/version.rb +1 -1
- data/log/.keep +0 -0
- data/test/helper.rb +6 -15
- data/test/support/cmd_tests_helpers.rb +35 -40
- data/test/support/factory.rb +1 -2
- data/test/support/gem1/gem1.gemspec +1 -1
- data/test/support/gem2/gem2.gemspec +2 -2
- data/test/support/name_set.rb +53 -53
- data/test/system/ggem_tests.rb +7 -12
- data/test/unit/cli_tests.rb +100 -121
- data/test/unit/gem_tests.rb +1 -5
- data/test/unit/gemspec_tests.rb +19 -26
- data/test/unit/git_repo_tests.rb +3 -14
- metadata +64 -57
- data/.gitignore +0 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
5
|
-
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: fe73b45d444a8f7ff488f19259fc7a0668c681db033d19f2eb1b221d004edac5
|
4
|
+
data.tar.gz: 5ea32d246eafec3af4fd01f17e6ed94c05c95b4a53a667d8966114cff59d387c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: acf33a27c2b503dc4d6233a3d6afb05dd34b86d326d19f9202b37aeb82b44cef1e70a901e140eff2a34528699e619f761c84caeabdc5029cb62f40227a026ac0
|
7
|
+
data.tar.gz: 00c64f8c24b4de4f2858994d59ff6b52b62474103e2865709a89bc62e48ae8a0d69b700bd967e669c04dd4b8ce24cda86c2f2c61707411370a97fd17776ba051
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -114,7 +114,7 @@ To override the default `https://rubygems.org` push host, add a metadata entry t
|
|
114
114
|
|
115
115
|
```ruby
|
116
116
|
# ...
|
117
|
-
gem.metadata[
|
117
|
+
gem.metadata["allowed_push_host"] = "https://gems.example.com"
|
118
118
|
# ...
|
119
119
|
```
|
120
120
|
|
@@ -175,6 +175,6 @@ $ gem install ggem
|
|
175
175
|
|
176
176
|
1. Fork it
|
177
177
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
178
|
-
3. Commit your changes (`git commit -am
|
178
|
+
3. Commit your changes (`git commit -am "Added some feature"`)
|
179
179
|
4. Push to the branch (`git push origin my-new-feature`)
|
180
180
|
5. Create new Pull Request
|
data/bin/ggem
CHANGED
data/ggem.gemspec
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
lib = File.expand_path(
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
4
|
require "ggem/version"
|
5
5
|
|
@@ -11,16 +11,18 @@ Gem::Specification.new do |gem|
|
|
11
11
|
gem.summary = %q{"Juh Gem", baby! (a gem utility CLI)}
|
12
12
|
gem.description = %q{"Juh Gem", baby! (a gem utility CLI)}
|
13
13
|
gem.homepage = "http://github.com/redding/ggem"
|
14
|
-
gem.license =
|
14
|
+
gem.license = "MIT"
|
15
15
|
|
16
|
-
gem.files = `git ls-files`.split($/)
|
16
|
+
gem.files = `git ls-files | grep "^[^.]"`.split($/)
|
17
17
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
18
18
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
19
19
|
gem.require_paths = ["lib"]
|
20
20
|
|
21
|
-
gem.
|
21
|
+
gem.required_ruby_version = "~> 2.5"
|
22
22
|
|
23
|
-
gem.
|
24
|
-
|
23
|
+
gem.add_development_dependency("assert", ["~> 2.18.2"])
|
24
|
+
|
25
|
+
gem.add_dependency("much-plugin", ["~> 0.2.2"])
|
26
|
+
gem.add_dependency("scmd", ["~> 3.0.3"])
|
25
27
|
|
26
28
|
end
|
data/lib/ggem.rb
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "ggem/version"
|
2
|
+
require "ggem/gem"
|
data/lib/ggem/cli.rb
CHANGED
@@ -1,63 +1,58 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
4
|
-
|
5
|
-
module GGem
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
c.add(ReleaseCommand, 'release', 'r')
|
16
|
-
end
|
1
|
+
require "ggem/version"
|
2
|
+
require "ggem/cli/clirb"
|
3
|
+
require "ggem/cli/commands"
|
4
|
+
|
5
|
+
module GGem; end
|
6
|
+
class GGem::CLI
|
7
|
+
COMMANDS = CommandSet.new{ |unknown| InvalidCommand.new(unknown) }.tap do |c|
|
8
|
+
c.add(GenerateCommand, "generate", "g")
|
9
|
+
c.add(BuildCommand, "build", "b")
|
10
|
+
c.add(InstallCommand, "install", "i")
|
11
|
+
c.add(PushCommand, "push", "p")
|
12
|
+
c.add(TagCommand, "tag", "t")
|
13
|
+
c.add(ReleaseCommand, "release", "r")
|
14
|
+
end
|
17
15
|
|
18
|
-
|
19
|
-
|
20
|
-
|
16
|
+
def self.run(args)
|
17
|
+
self.new.run(args)
|
18
|
+
end
|
21
19
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
20
|
+
def initialize(kernel = nil, stdout = nil, stderr = nil)
|
21
|
+
@kernel = kernel || Kernel
|
22
|
+
@stdout = stdout || $stdout
|
23
|
+
@stderr = stderr || $stderr
|
24
|
+
end
|
27
25
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
end
|
49
|
-
@kernel.exit 0
|
26
|
+
def run(args)
|
27
|
+
begin
|
28
|
+
cmd_name = args.shift
|
29
|
+
cmd = COMMANDS[cmd_name]
|
30
|
+
cmd.run(args)
|
31
|
+
rescue CLIRB::HelpExit
|
32
|
+
@stdout.puts cmd.help
|
33
|
+
rescue CLIRB::VersionExit
|
34
|
+
@stdout.puts GGem::VERSION
|
35
|
+
rescue CLIRB::Error, ArgumentError, InvalidCommandError => exception
|
36
|
+
display_debug(exception)
|
37
|
+
@stderr.puts "#{exception.message}\n\n"
|
38
|
+
@stdout.puts cmd.help
|
39
|
+
@kernel.exit 1
|
40
|
+
rescue CommandExitError
|
41
|
+
@kernel.exit 1
|
42
|
+
rescue StandardError => exception
|
43
|
+
@stderr.puts "#{exception.class}: #{exception.message}"
|
44
|
+
@stderr.puts exception.backtrace.join("\n")
|
45
|
+
@kernel.exit 1
|
50
46
|
end
|
47
|
+
@kernel.exit 0
|
48
|
+
end
|
51
49
|
|
52
|
-
|
50
|
+
private
|
53
51
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
end
|
52
|
+
def display_debug(exception)
|
53
|
+
if ENV["DEBUG"]
|
54
|
+
@stderr.puts "#{exception.class}: #{exception.message}"
|
55
|
+
@stderr.puts exception.backtrace.join("\n")
|
59
56
|
end
|
60
|
-
|
61
57
|
end
|
62
|
-
|
63
58
|
end
|
data/lib/ggem/cli/clirb.rb
CHANGED
@@ -1,59 +1,55 @@
|
|
1
1
|
module GGem; end
|
2
|
-
class GGem::CLI
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
@opts[o.name] = o.value; p.on(*o.parser_args){ |v| @opts[o.name] = v }
|
15
|
-
end
|
16
|
-
p.on_tail('--version', ''){ |v| raise VersionExit, v.to_s }
|
17
|
-
p.on_tail('--help', ''){ |v| raise HelpExit, v.to_s }
|
2
|
+
class GGem::CLI; end
|
3
|
+
class GGem::CLI::CLIRB # Version 1.1.0, https://github.com/redding/cli.rb
|
4
|
+
Error = Class.new(RuntimeError);
|
5
|
+
HelpExit = Class.new(RuntimeError); VersionExit = Class.new(RuntimeError)
|
6
|
+
attr_reader :argv, :args, :opts, :data
|
7
|
+
|
8
|
+
def initialize(&block)
|
9
|
+
@options = []; instance_eval(&block) if block
|
10
|
+
require "optparse"
|
11
|
+
@data, @args, @opts = [], [], {}; @parser = OptionParser.new do |p|
|
12
|
+
p.banner = ""; @options.each do |o|
|
13
|
+
@opts[o.name] = o.value; p.on(*o.parser_args){ |v| @opts[o.name] = v }
|
18
14
|
end
|
15
|
+
p.on_tail("--version", ""){ |v| raise VersionExit, v.to_s }
|
16
|
+
p.on_tail("--help", ""){ |v| raise HelpExit, v.to_s }
|
19
17
|
end
|
18
|
+
end
|
20
19
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
class Option
|
34
|
-
attr_reader :name, :opt_name, :desc, :abbrev, :value, :klass, :parser_args
|
20
|
+
def option(*args); @options << Option.new(*args); end
|
21
|
+
def parse!(argv)
|
22
|
+
@args = (argv || []).dup.tap do |args_list|
|
23
|
+
begin; @parser.parse!(args_list)
|
24
|
+
rescue OptionParser::ParseError => err; raise Error, err.message; end
|
25
|
+
end; @data = @args + [@opts]
|
26
|
+
end
|
27
|
+
def to_s; @parser.to_s; end
|
28
|
+
def inspect
|
29
|
+
"#<#{self.class}:#{"0x0%x" % (object_id << 1)} @data=#{@data.inspect}>"
|
30
|
+
end
|
35
31
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
32
|
+
class Option
|
33
|
+
attr_reader :name, :opt_name, :desc, :abbrev, :value, :klass, :parser_args
|
34
|
+
|
35
|
+
def initialize(name, desc = nil, abbrev: nil, value: nil)
|
36
|
+
@name, @desc = name, desc || ""
|
37
|
+
@opt_name, @abbrev = parse_name_values(name, abbrev)
|
38
|
+
@value, @klass = gvalinfo(value)
|
39
|
+
@parser_args = if [TrueClass, FalseClass, NilClass].include?(@klass)
|
40
|
+
["-#{@abbrev}", "--[no-]#{@opt_name}", @desc]
|
41
|
+
else
|
42
|
+
["-#{@abbrev}", "--#{@opt_name} VALUE", @klass, @desc]
|
45
43
|
end
|
44
|
+
end
|
46
45
|
|
47
|
-
|
46
|
+
private
|
48
47
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
end
|
54
|
-
def gvalinfo(v); v.kind_of?(Class) ? [nil,gklass(v)] : [v,gklass(v.class)]; end
|
55
|
-
def gklass(k); k == Fixnum ? Integer : k; end
|
48
|
+
def parse_name_values(name, custom_abbrev)
|
49
|
+
[ (processed_name = name.to_s.strip.downcase).gsub("_", "-"),
|
50
|
+
custom_abbrev || processed_name.gsub(/[^a-z]/, "").chars.first || "a"
|
51
|
+
]
|
56
52
|
end
|
53
|
+
def gvalinfo(v); v.kind_of?(Class) ? [nil,v] : [v,v.class]; end
|
57
54
|
end
|
58
|
-
|
59
55
|
end
|
data/lib/ggem/cli/commands.rb
CHANGED
@@ -1,14 +1,12 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "ggem/cli/clirb"
|
2
|
+
require "much-plugin"
|
3
3
|
|
4
4
|
module GGem; end
|
5
5
|
class GGem::CLI
|
6
|
-
|
7
6
|
InvalidCommandError = Class.new(ArgumentError)
|
8
7
|
CommandExitError = Class.new(RuntimeError)
|
9
8
|
|
10
9
|
class InvalidCommand
|
11
|
-
|
12
10
|
attr_reader :name, :clirb
|
13
11
|
|
14
12
|
def initialize(name)
|
@@ -21,7 +19,7 @@ class GGem::CLI
|
|
21
19
|
def run(argv)
|
22
20
|
@clirb.parse!([@name, argv].flatten.compact)
|
23
21
|
raise CLIRB::HelpExit if @name.to_s.empty?
|
24
|
-
raise InvalidCommandError, "
|
22
|
+
raise InvalidCommandError, "`#{self.name}` is not a command."
|
25
23
|
end
|
26
24
|
|
27
25
|
def help
|
@@ -30,18 +28,12 @@ class GGem::CLI
|
|
30
28
|
"Commands:\n" \
|
31
29
|
"#{COMMANDS.to_s.split("\n").map{ |l| " #{l}" }.join("\n")}\n"
|
32
30
|
end
|
33
|
-
|
34
31
|
end
|
35
32
|
|
36
33
|
module ValidCommand
|
37
34
|
include MuchPlugin
|
38
35
|
|
39
|
-
|
40
|
-
include InstanceMethods
|
41
|
-
end
|
42
|
-
|
43
|
-
module InstanceMethods
|
44
|
-
|
36
|
+
plugin_instance_methods do
|
45
37
|
def initialize(&clirb_build)
|
46
38
|
@clirb = CLIRB.new(&clirb_build)
|
47
39
|
end
|
@@ -55,22 +47,15 @@ class GGem::CLI
|
|
55
47
|
end
|
56
48
|
|
57
49
|
def summary
|
58
|
-
|
50
|
+
""
|
59
51
|
end
|
60
|
-
|
61
52
|
end
|
62
|
-
|
63
53
|
end
|
64
54
|
|
65
55
|
module NotifyCmdCommand
|
66
56
|
include MuchPlugin
|
67
57
|
|
68
|
-
|
69
|
-
include InstanceMethods
|
70
|
-
end
|
71
|
-
|
72
|
-
module InstanceMethods
|
73
|
-
|
58
|
+
plugin_instance_methods do
|
74
59
|
private
|
75
60
|
|
76
61
|
def notify(success_msg, &cmd_block)
|
@@ -80,14 +65,12 @@ class GGem::CLI
|
|
80
65
|
|
81
66
|
def cmd(&cmd_block)
|
82
67
|
cmd, status, output = cmd_block.call
|
83
|
-
if ENV[
|
68
|
+
if ENV["DEBUG"]
|
84
69
|
@stdout.puts cmd
|
85
70
|
@stdout.puts output
|
86
71
|
end
|
87
72
|
end
|
88
|
-
|
89
73
|
end
|
90
|
-
|
91
74
|
end
|
92
75
|
|
93
76
|
module GitRepoCommand
|
@@ -96,14 +79,13 @@ class GGem::CLI
|
|
96
79
|
plugin_included do
|
97
80
|
include ValidCommand
|
98
81
|
include NotifyCmdCommand
|
99
|
-
include InstanceMethods
|
100
82
|
end
|
101
83
|
|
102
|
-
|
84
|
+
plugin_instance_methods do
|
103
85
|
def initialize(*args)
|
104
86
|
super
|
105
87
|
|
106
|
-
require
|
88
|
+
require "ggem/git_repo"
|
107
89
|
@repo = GGem::GitRepo.new(Dir.pwd)
|
108
90
|
end
|
109
91
|
|
@@ -117,7 +99,6 @@ class GGem::CLI
|
|
117
99
|
raise CommandExitError
|
118
100
|
end
|
119
101
|
end
|
120
|
-
|
121
102
|
end
|
122
103
|
end
|
123
104
|
|
@@ -128,7 +109,7 @@ class GGem::CLI
|
|
128
109
|
super
|
129
110
|
|
130
111
|
begin
|
131
|
-
require
|
112
|
+
require "ggem/gem"
|
132
113
|
path = GGem::Gem.new(Dir.pwd, @clirb.args.first).save!.path
|
133
114
|
@stdout.puts "created gem in #{path}"
|
134
115
|
rescue GGem::Gem::NoNameError => exception
|
@@ -151,7 +132,6 @@ class GGem::CLI
|
|
151
132
|
"Description:\n" \
|
152
133
|
" #{self.summary}"
|
153
134
|
end
|
154
|
-
|
155
135
|
end
|
156
136
|
|
157
137
|
module GemspecCommand
|
@@ -160,14 +140,13 @@ class GGem::CLI
|
|
160
140
|
plugin_included do
|
161
141
|
include ValidCommand
|
162
142
|
include NotifyCmdCommand
|
163
|
-
include InstanceMethods
|
164
143
|
end
|
165
144
|
|
166
|
-
|
145
|
+
plugin_instance_methods do
|
167
146
|
def initialize(*args)
|
168
147
|
super
|
169
148
|
|
170
|
-
require
|
149
|
+
require "ggem/gemspec"
|
171
150
|
begin
|
172
151
|
@spec = GGem::Gemspec.new(Dir.pwd)
|
173
152
|
rescue GGem::Gemspec::NotFoundError => exception
|
@@ -187,7 +166,6 @@ class GGem::CLI
|
|
187
166
|
raise CommandExitError
|
188
167
|
end
|
189
168
|
end
|
190
|
-
|
191
169
|
end
|
192
170
|
end
|
193
171
|
|
@@ -212,7 +190,6 @@ class GGem::CLI
|
|
212
190
|
"Description:\n" \
|
213
191
|
" #{self.summary}"
|
214
192
|
end
|
215
|
-
|
216
193
|
end
|
217
194
|
|
218
195
|
class InstallCommand
|
@@ -225,7 +202,8 @@ class GGem::CLI
|
|
225
202
|
|
226
203
|
def run(argv, *args)
|
227
204
|
super
|
228
|
-
@build_command.run(
|
205
|
+
@build_command.run([])
|
206
|
+
|
229
207
|
notify("#{@spec.name} #{@spec.version} installed to system gems") do
|
230
208
|
@spec.run_install_cmd
|
231
209
|
end
|
@@ -241,7 +219,6 @@ class GGem::CLI
|
|
241
219
|
"Description:\n" \
|
242
220
|
" #{self.summary}"
|
243
221
|
end
|
244
|
-
|
245
222
|
end
|
246
223
|
|
247
224
|
class PushCommand
|
@@ -254,7 +231,7 @@ class GGem::CLI
|
|
254
231
|
|
255
232
|
def run(argv, *args)
|
256
233
|
super
|
257
|
-
@build_command.run(
|
234
|
+
@build_command.run([])
|
258
235
|
|
259
236
|
@stdout.puts "Pushing #{@spec.gem_file_name} to #{@spec.push_host}..."
|
260
237
|
notify("#{@spec.gem_file_name} received.") do
|
@@ -272,7 +249,6 @@ class GGem::CLI
|
|
272
249
|
"Description:\n" \
|
273
250
|
" #{self.summary}"
|
274
251
|
end
|
275
|
-
|
276
252
|
end
|
277
253
|
|
278
254
|
module ForceTagOptionCommand
|
@@ -280,21 +256,17 @@ class GGem::CLI
|
|
280
256
|
|
281
257
|
plugin_included do
|
282
258
|
include ValidCommand
|
283
|
-
include InstanceMethods
|
284
259
|
end
|
285
260
|
|
286
|
-
|
287
|
-
|
261
|
+
plugin_instance_methods do
|
288
262
|
def initialize
|
289
263
|
super do
|
290
|
-
option
|
291
|
-
:abbrev =>
|
264
|
+
option "force-tag", "force tagging even with uncommitted files", {
|
265
|
+
:abbrev => "f"
|
292
266
|
}
|
293
267
|
end
|
294
268
|
end
|
295
|
-
|
296
269
|
end
|
297
|
-
|
298
270
|
end
|
299
271
|
|
300
272
|
class TagCommand
|
@@ -310,7 +282,7 @@ class GGem::CLI
|
|
310
282
|
cmd{ @repo.run_validate_committed_cmd }
|
311
283
|
rescue GGem::GitRepo::CmdError => err
|
312
284
|
@stderr.puts "There are files that need to be committed first."
|
313
|
-
if self.clirb.opts[
|
285
|
+
if self.clirb.opts["force-tag"]
|
314
286
|
@stderr.puts "Forcing tag anyway..."
|
315
287
|
else
|
316
288
|
raise CommandExitError
|
@@ -344,7 +316,6 @@ class GGem::CLI
|
|
344
316
|
"Description:\n" \
|
345
317
|
" #{self.summary}"
|
346
318
|
end
|
347
|
-
|
348
319
|
end
|
349
320
|
|
350
321
|
class ReleaseCommand
|
@@ -359,8 +330,8 @@ class GGem::CLI
|
|
359
330
|
|
360
331
|
def run(argv, *args)
|
361
332
|
super
|
362
|
-
@tag_command.run(
|
363
|
-
@push_command.run(
|
333
|
+
@tag_command.run(self.clirb.opts["force-tag"] ? ["--force-tag"] : [])
|
334
|
+
@push_command.run([])
|
364
335
|
end
|
365
336
|
|
366
337
|
def summary
|
@@ -375,11 +346,9 @@ class GGem::CLI
|
|
375
346
|
" #{self.summary}\n" \
|
376
347
|
" (macro for running `ggem tag && ggem push`)"
|
377
348
|
end
|
378
|
-
|
379
349
|
end
|
380
350
|
|
381
351
|
class CommandSet
|
382
|
-
|
383
352
|
def initialize(&unknown_cmd_block)
|
384
353
|
@lookup = Hash.new{ |h,k| unknown_cmd_block.call(k) }
|
385
354
|
@names = []
|
@@ -396,8 +365,8 @@ class GGem::CLI
|
|
396
365
|
([name] + aliases).each{ |n| @lookup[n] = cmd }
|
397
366
|
@to_s = nil
|
398
367
|
@names << name
|
399
|
-
@aliases[name] = aliases.empty? ?
|
400
|
-
@summaries[name] = cmd.summary.to_s.empty? ?
|
368
|
+
@aliases[name] = aliases.empty? ? "" : "(#{aliases.join(", ")})"
|
369
|
+
@summaries[name] = cmd.summary.to_s.empty? ? "" : "# #{cmd.summary}"
|
401
370
|
end
|
402
371
|
end
|
403
372
|
|
@@ -424,7 +393,5 @@ class GGem::CLI
|
|
424
393
|
"#{n.ljust(max_name_size)} #{@aliases[n].ljust(max_alias_size)} #{@summaries[n]}"
|
425
394
|
end.join("\n")
|
426
395
|
end
|
427
|
-
|
428
396
|
end
|
429
|
-
|
430
397
|
end
|