rasti-web-api_doc 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.ruby-version +1 -1
- data/lib/rasti/web/api_doc.rb +1 -1
- data/lib/rasti/web/api_doc/request.rb +4 -3
- data/lib/rasti/web/api_doc/task.rb +18 -11
- data/lib/rasti/web/api_doc/tracker.rb +4 -4
- data/lib/rasti/web/api_doc/version.rb +1 -1
- data/rasti-web-api_doc.gemspec +3 -3
- metadata +28 -30
- data/bin/console +0 -14
- data/bin/setup +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f2918bc3d975edbbf5fc8ed202d501748a944426ea11a30ae013ef6a9a2d961d
|
4
|
+
data.tar.gz: 989e07a070c1140e02356fc9f124e24ee4346d379b23a53482b4368242696963
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c05140e0b79fd99903b5f130c2d40dce228ee3dc03d5c04bbb65125ab33ef886e7f9283c7a87d78d3bfbc25881f5ebb1f790151d069469d18ca50fff676f5089
|
7
|
+
data.tar.gz: 70c5dc918ad9af7f6e9b671472e3a6215dcdae74ea66de6c3a52563dafe79cd8932d54327e865d1f967d72bc1914896940b2e2ac1adf6b82222c1744593aaf93
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby
|
1
|
+
ruby-2.5.0
|
data/lib/rasti/web/api_doc.rb
CHANGED
@@ -36,9 +36,10 @@ module Rasti
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def headers
|
39
|
-
|
40
|
-
|
41
|
-
|
39
|
+
headers = env.select { |k,v| k.start_with?('HTTP_') || k == 'CONTENT_TYPE' }
|
40
|
+
.map { |k,v| [k.sub(/^HTTP_/, '').split('_').map(&:capitalize).join('-'), v] }
|
41
|
+
.sort
|
42
|
+
Hash[headers]
|
42
43
|
end
|
43
44
|
|
44
45
|
private
|
@@ -28,22 +28,28 @@ module Rasti
|
|
28
28
|
|
29
29
|
Rasti::Web::ApiDoc.tracker = Tracker.new application.all_routes
|
30
30
|
|
31
|
-
|
32
|
-
$stdout = StringIO.new
|
33
|
-
$stderr = StringIO.new
|
31
|
+
disable_test_runner_output
|
34
32
|
|
35
33
|
at_exit do
|
36
34
|
write_file
|
37
35
|
print_summary
|
38
36
|
end
|
39
37
|
|
40
|
-
|
41
|
-
STDOUT.puts 'Building documentation'
|
42
|
-
$LOAD_PATH.unshift path
|
43
|
-
Dir.glob(File.expand_path(pattern)).each { |f| require f }
|
38
|
+
run_all_tests
|
44
39
|
end
|
45
40
|
end
|
46
41
|
|
42
|
+
def disable_test_runner_output
|
43
|
+
$stdout = StringIO.new
|
44
|
+
$stderr = StringIO.new
|
45
|
+
end
|
46
|
+
|
47
|
+
def run_all_tests
|
48
|
+
STDOUT.puts 'Building documentation'
|
49
|
+
$LOAD_PATH.unshift path
|
50
|
+
Dir.glob(File.expand_path(pattern)).each { |f| require f }
|
51
|
+
end
|
52
|
+
|
47
53
|
def write_file
|
48
54
|
File.open(File.expand_path(output), 'w') do |f|
|
49
55
|
f.puts '# **Endpoints**'
|
@@ -96,15 +102,16 @@ module Rasti
|
|
96
102
|
STDOUT.puts "\nPending endpoints" unless summary[:pending_list].empty?
|
97
103
|
summary[:pending_list].each do |method, routes|
|
98
104
|
routes.each do |route|
|
99
|
-
STDOUT.puts " #{method} #{route}"
|
105
|
+
STDOUT.puts " #{Colorin.amber_300(method.ljust(6, ' ')).bold} #{route}"
|
100
106
|
end
|
101
107
|
end
|
102
108
|
|
103
109
|
STDOUT.puts
|
104
|
-
STDOUT.print "#{summary[:endpoints]} endpoints
|
105
|
-
STDOUT.print "
|
110
|
+
STDOUT.print Colorin.blue_a700("#{summary[:endpoints]} endpoints")
|
111
|
+
STDOUT.print ", "
|
112
|
+
STDOUT.print Colorin.green_500("#{summary[:documented]} documented")
|
106
113
|
STDOUT.print ", "
|
107
|
-
STDOUT.puts "#{summary[:pending]} pending"
|
114
|
+
STDOUT.puts Colorin.amber_300("#{summary[:pending]} pending")
|
108
115
|
end
|
109
116
|
|
110
117
|
end
|
@@ -5,9 +5,9 @@ module Rasti
|
|
5
5
|
|
6
6
|
attr_reader :tracks
|
7
7
|
|
8
|
-
def initialize(
|
8
|
+
def initialize(routes_by_method)
|
9
9
|
@tracks = Hash.new { |h,k| h[k] = {} }
|
10
|
-
|
10
|
+
routes_by_method.each do |method, routes|
|
11
11
|
routes.each do |route|
|
12
12
|
tracks[method][route] = nil
|
13
13
|
end
|
@@ -19,7 +19,7 @@ module Rasti
|
|
19
19
|
res = Rasti::Web::ApiDoc::Response.new(*response)
|
20
20
|
|
21
21
|
if !tracks[req.method][req.route]
|
22
|
-
STDOUT.puts " #{req.method} #{req.route}"
|
22
|
+
STDOUT.puts " #{Colorin.green_500(req.method.ljust(6, ' ')).bold} #{req.route}"
|
23
23
|
tracks[req.method][req.route] = [req, res]
|
24
24
|
end
|
25
25
|
end
|
@@ -32,7 +32,7 @@ module Rasti
|
|
32
32
|
{
|
33
33
|
endpoints: endpoints,
|
34
34
|
documented: documented,
|
35
|
-
pending: pending.count,
|
35
|
+
pending: pending.values.map(&:count).sum,
|
36
36
|
pending_list: pending
|
37
37
|
}
|
38
38
|
end
|
data/rasti-web-api_doc.gemspec
CHANGED
@@ -19,10 +19,10 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
20
|
spec.require_paths = ['lib']
|
21
21
|
|
22
|
+
spec.add_dependency 'colorin', '~> 2.0'
|
22
23
|
spec.add_dependency 'rasti-web'
|
23
|
-
spec.add_dependency '
|
24
|
-
spec.add_dependency '
|
25
|
-
spec.add_dependency 'rack-test', '~> 0.6'
|
24
|
+
spec.add_dependency 'rake'
|
25
|
+
spec.add_dependency 'rack-test'
|
26
26
|
|
27
27
|
spec.add_development_dependency 'bundler', '~> 1.11'
|
28
28
|
end
|
metadata
CHANGED
@@ -1,83 +1,83 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rasti-web-api_doc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gabriel Naiman
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-09-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: colorin
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
19
|
+
version: '2.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
26
|
+
version: '2.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: rasti-web
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0
|
33
|
+
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '0
|
40
|
+
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '0'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rack-test
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '0
|
61
|
+
version: '0'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '0
|
68
|
+
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: bundler
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - ~>
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '1.11'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - ~>
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '1.11'
|
83
83
|
description: Generate documentation of endpoint usage based on tests
|
@@ -87,15 +87,13 @@ executables: []
|
|
87
87
|
extensions: []
|
88
88
|
extra_rdoc_files: []
|
89
89
|
files:
|
90
|
-
- .gitignore
|
91
|
-
- .ruby-gemset
|
92
|
-
- .ruby-version
|
90
|
+
- ".gitignore"
|
91
|
+
- ".ruby-gemset"
|
92
|
+
- ".ruby-version"
|
93
93
|
- Gemfile
|
94
94
|
- LICENSE.txt
|
95
95
|
- README.md
|
96
96
|
- Rakefile
|
97
|
-
- bin/console
|
98
|
-
- bin/setup
|
99
97
|
- lib/rasti/web/api_doc.rb
|
100
98
|
- lib/rasti/web/api_doc/request.rb
|
101
99
|
- lib/rasti/web/api_doc/response.rb
|
@@ -113,17 +111,17 @@ require_paths:
|
|
113
111
|
- lib
|
114
112
|
required_ruby_version: !ruby/object:Gem::Requirement
|
115
113
|
requirements:
|
116
|
-
- -
|
114
|
+
- - ">="
|
117
115
|
- !ruby/object:Gem::Version
|
118
116
|
version: '0'
|
119
117
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
120
118
|
requirements:
|
121
|
-
- -
|
119
|
+
- - ">="
|
122
120
|
- !ruby/object:Gem::Version
|
123
121
|
version: '0'
|
124
122
|
requirements: []
|
125
123
|
rubyforge_project:
|
126
|
-
rubygems_version: 2.
|
124
|
+
rubygems_version: 2.7.3
|
127
125
|
signing_key:
|
128
126
|
specification_version: 4
|
129
127
|
summary: Generate documentation of endpoint usage based on tests
|
data/bin/console
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "rasti/web/api_doc"
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start
|