rack-app 3.3.0 → 3.4.0
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c7d43893840f6f431d6de3d315663c8b3b218efe
|
4
|
+
data.tar.gz: 3ee8f9c6590d842ab89bb32f1703c344d28b229b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 463db659b98c7c6c523e6a1262e1a4d90352593e77d640474889ec231a3f12bbf074ef7f962935724e157e05cc8d72fbeb0added3f3479217df28482defc9fb7
|
7
|
+
data.tar.gz: 9752ef90b016d737795873ccf79ee631a5ef3acf46533f8ef0462a70191d0a9b2b8e90a2de590afc99ec97f3d92562757518aff1e1352f98bdc9df68d941fcb1
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.
|
1
|
+
3.4.0
|
@@ -2,15 +2,19 @@ module Rack::App::CLI::DefaultCommands::ListCommands
|
|
2
2
|
|
3
3
|
extend self
|
4
4
|
|
5
|
+
PRESERVED_KEYWORDS = ['commands', 'help', 'routes']
|
6
|
+
|
5
7
|
def get_message(known_commands)
|
6
8
|
puts_collection = []
|
7
9
|
|
8
10
|
add_header(puts_collection)
|
9
11
|
|
10
12
|
list_command_name = 'commands'
|
11
|
-
rjust = known_commands.keys.push(
|
13
|
+
rjust = known_commands.keys.push(*PRESERVED_KEYWORDS).map(&:to_s).map(&:length).max + 3
|
12
14
|
|
13
15
|
puts_collection << [list_command_name.to_s.rjust(rjust), 'list all available command'].join(' ')
|
16
|
+
puts_collection << ['routes'.to_s.rjust(rjust), 'list all available endpoint'].join(' ')
|
17
|
+
|
14
18
|
known_commands.sort_by { |name, _| name.to_s }.each do |name, command|
|
15
19
|
puts_collection << [name.to_s.rjust(rjust), command.class.description].join(' ')
|
16
20
|
end
|
data/lib/rack/app/cli/runner.rb
CHANGED
@@ -21,26 +21,28 @@ class Rack::App::CLI::Runner
|
|
21
21
|
command_name = argv.shift
|
22
22
|
command = command_for(command_name)
|
23
23
|
options_parser = configure_command(command,command_name)
|
24
|
-
|
25
24
|
$stdout.puts(options_parser.help)
|
26
|
-
rescue CommandNotFound
|
27
|
-
show_commands
|
28
25
|
end
|
29
26
|
|
30
27
|
def start_command_for(command_name, argv)
|
31
28
|
case command_name.to_s
|
32
29
|
|
33
30
|
when 'commands'
|
34
|
-
|
31
|
+
show_commands
|
35
32
|
|
36
33
|
when 'help'
|
37
|
-
|
34
|
+
show_help_message(argv)
|
35
|
+
|
36
|
+
when 'routes'
|
37
|
+
Rack::App::CLI::DefaultCommands::ShowRoutes.new.start(argv)
|
38
38
|
|
39
39
|
else
|
40
40
|
command = command_for(command_name)
|
41
|
-
|
41
|
+
run_command(argv, command, command_name)
|
42
42
|
|
43
43
|
end
|
44
|
+
rescue CommandNotFound
|
45
|
+
show_commands
|
44
46
|
end
|
45
47
|
|
46
48
|
def run_command(argv, command, command_name)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-app
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Luzsi
|
@@ -95,6 +95,7 @@ files:
|
|
95
95
|
- lib/rack/app/cli/command/configurator.rb
|
96
96
|
- lib/rack/app/cli/default_commands.rb
|
97
97
|
- lib/rack/app/cli/default_commands/list_commands.rb
|
98
|
+
- lib/rack/app/cli/default_commands/show_routes.rb
|
98
99
|
- lib/rack/app/cli/runner.rb
|
99
100
|
- lib/rack/app/constants.rb
|
100
101
|
- lib/rack/app/endpoint.rb
|