betterdocs 0.9.0 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.semaphore/semaphore.yml +1 -1
- data/.tool-versions +2 -1
- data/README.md +78 -69
- data/Rakefile +2 -2
- data/VERSION +1 -1
- data/betterdocs.gemspec +9 -9
- data/lib/betterdocs/generator/config_shortcuts.rb +1 -1
- data/lib/betterdocs/generator/markdown.rb +1 -1
- data/lib/betterdocs/version.rb +1 -1
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 43905ca43e64e65668831fed2e7c0d2eb1e0380347948c1d6f1aa7aa77bd8ea7
|
4
|
+
data.tar.gz: 6c52dcacf3ca65b2111f5e1da6655af8ab728c20e552ee90ca953e547c490699
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 493b9879a9c2bdcb1fd4d8858c59d34cf0a83eece18d15f1c7f005e84e57a127c101945c760cf0362d123b90006ecdcf2445a08cce586bd42cb882f4438d7df6
|
7
|
+
data.tar.gz: 4de261093b3b6b0cb4541d99e4d572cb239f41ca9091fbb41b9a2fc6df5be4e33d5a499ded80a19ac0f4bb740cb8709297ae145ee01a407c4ed8166c9ccebc47
|
data/.semaphore/semaphore.yml
CHANGED
data/.tool-versions
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
ruby 3.
|
1
|
+
ruby 3.1.2
|
2
|
+
bundler 2.3.17
|
data/README.md
CHANGED
@@ -22,88 +22,97 @@ This api generator requires that you follow the [representer pattern](http://nic
|
|
22
22
|
|
23
23
|
## Controller
|
24
24
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
param :order do
|
35
|
-
description to <<-end
|
36
|
-
Optional parameter to order the list.
|
37
|
-
end
|
38
|
-
required no
|
39
|
-
value 'created_at:ASC'
|
40
|
-
end
|
41
|
-
|
42
|
-
response do
|
43
|
-
generate_fake_result_with_representer
|
44
|
-
end
|
45
|
-
end
|
46
|
-
# :nocov:
|
47
|
-
def index
|
48
|
-
render json: real_result_with_representer
|
49
|
-
end
|
25
|
+
```ruby
|
26
|
+
class ThingsController < ApplicationController
|
27
|
+
# :nocov: Documentation
|
28
|
+
doc :action do
|
29
|
+
section :things_list
|
30
|
+
title 'A List of things ⇄ [Details](things_details.md)'
|
31
|
+
description to <<-end
|
32
|
+
This action shows a list of things. **Markdown** can be used.
|
33
|
+
end
|
50
34
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
title 'Things Details ⇄ [List](things_list.md)'
|
55
|
-
description to <<-end
|
56
|
-
The details of a thing. You must give an id for the thing
|
57
|
-
end
|
58
|
-
|
59
|
-
param :thing_id do
|
60
|
-
description 'The id of the thing you want to see. Required.'
|
61
|
-
required yes # this is the default
|
62
|
-
value 38
|
63
|
-
end
|
64
|
-
|
65
|
-
response do
|
66
|
-
generate_fake_details_response_with_representer
|
67
|
-
end
|
68
|
-
end
|
69
|
-
# :nocov:
|
70
|
-
def show
|
71
|
-
render json: real_result_with_representer
|
35
|
+
param :order do
|
36
|
+
description to <<-end
|
37
|
+
Optional parameter to order the list.
|
72
38
|
end
|
39
|
+
required no
|
40
|
+
value 'created_at:ASC'
|
41
|
+
end
|
42
|
+
|
43
|
+
response do
|
44
|
+
generate_fake_result_with_representer
|
45
|
+
end
|
46
|
+
end
|
47
|
+
# :nocov:
|
48
|
+
def index
|
49
|
+
render json: real_result_with_representer
|
50
|
+
end
|
51
|
+
|
52
|
+
# :nocov: Documentation
|
53
|
+
doc :action do
|
54
|
+
section :things_details
|
55
|
+
title 'Things Details ⇄ [List](things_list.md)'
|
56
|
+
description to <<-end
|
57
|
+
The details of a thing. You must give an id for the thing
|
58
|
+
end
|
59
|
+
|
60
|
+
param :thing_id do
|
61
|
+
description 'The id of the thing you want to see. Required.'
|
62
|
+
required yes # this is the default
|
63
|
+
value 38
|
73
64
|
end
|
74
65
|
|
66
|
+
response do
|
67
|
+
generate_fake_details_response_with_representer
|
68
|
+
end
|
69
|
+
end
|
70
|
+
# :nocov:
|
71
|
+
def show
|
72
|
+
render json: real_result_with_representer
|
73
|
+
end
|
74
|
+
end
|
75
|
+
```
|
76
|
+
|
75
77
|
## Representer
|
76
78
|
|
77
79
|
Betterdocs comes with its own representer class. It is not documented
|
78
80
|
yet but works kind of like [ROAR](https://github.com/apotonick/roar).
|
79
81
|
|
80
|
-
|
82
|
+
```ruby
|
83
|
+
module ThingsRepresenter
|
81
84
|
|
82
|
-
|
83
|
-
|
85
|
+
extend ActiveSupport::Concern
|
86
|
+
include Betterdocs::Representer
|
84
87
|
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
property :title, as: :name do
|
92
|
-
description to <<-end
|
93
|
-
Represent the internal field "title" as the name of the thing
|
94
|
-
end
|
95
|
-
types String
|
96
|
-
example 'my_name'
|
97
|
-
end
|
88
|
+
property :microfleem_count, if: -> { has_microfleems? }, as: :number_of_fleems do
|
89
|
+
description 'If we have microfleems, return the count'
|
90
|
+
types Integer
|
91
|
+
example '5000'
|
92
|
+
end
|
98
93
|
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
94
|
+
property :title, as: :name do
|
95
|
+
description to <<-end
|
96
|
+
Represent the internal field "title" as the name of the thing
|
97
|
+
end
|
98
|
+
types String
|
99
|
+
example 'my_name'
|
100
|
+
end
|
101
|
+
|
102
|
+
link :self do
|
103
|
+
description to <<-end
|
104
|
+
Link to this resource itself
|
105
|
+
(<a href="opinion_details.md">things details</a>)
|
106
106
|
end
|
107
|
+
url { thing_url(id) }
|
108
|
+
end
|
109
|
+
end
|
110
|
+
```
|
111
|
+
|
112
|
+
RELEASING
|
113
|
+
---------
|
114
|
+
|
115
|
+
Edit `Rakefile` and `VERSION` and run `rake` (because we use gemhadar). Commit changes, run `rake gem:push` and `git push --tags`.
|
107
116
|
|
108
117
|
AUTHORS
|
109
118
|
-------
|
data/Rakefile
CHANGED
@@ -6,7 +6,7 @@ GemHadar do
|
|
6
6
|
name 'betterdocs'
|
7
7
|
author 'betterplace Developers'
|
8
8
|
email 'developers@betterplace.org'
|
9
|
-
homepage "
|
9
|
+
homepage "https://github.com/betterplace/#{name}"
|
10
10
|
summary 'Betterplace API documentation library'
|
11
11
|
description "This library provides tools to generate API documention for a web site's REST-ful JSON API."
|
12
12
|
test_dir 'spec'
|
@@ -17,7 +17,7 @@ GemHadar do
|
|
17
17
|
title "#{name.camelize}"
|
18
18
|
|
19
19
|
dependency 'tins', '~>1.3', '>=1.3.5'
|
20
|
-
dependency 'rails', '>=3', '<
|
20
|
+
dependency 'rails', '>=3', '<8'
|
21
21
|
dependency 'term-ansicolor', '~>1.3'
|
22
22
|
dependency 'complex_config', '~>0.5'
|
23
23
|
dependency 'infobar'
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.10.0
|
data/betterdocs.gemspec
CHANGED
@@ -1,21 +1,21 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
# stub: betterdocs 0.
|
2
|
+
# stub: betterdocs 0.10.0 ruby lib
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "betterdocs".freeze
|
6
|
-
s.version = "0.
|
6
|
+
s.version = "0.10.0"
|
7
7
|
|
8
8
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
9
9
|
s.require_paths = ["lib".freeze]
|
10
10
|
s.authors = ["betterplace Developers".freeze]
|
11
|
-
s.date = "
|
11
|
+
s.date = "2022-08-16"
|
12
12
|
s.description = "This library provides tools to generate API documention for a web site's REST-ful JSON API.".freeze
|
13
13
|
s.email = "developers@betterplace.org".freeze
|
14
14
|
s.extra_rdoc_files = ["README.md".freeze, "lib/betterdocs.rb".freeze, "lib/betterdocs/controller_collector.rb".freeze, "lib/betterdocs/dsl.rb".freeze, "lib/betterdocs/dsl/common.rb".freeze, "lib/betterdocs/dsl/controller.rb".freeze, "lib/betterdocs/dsl/controller/action.rb".freeze, "lib/betterdocs/dsl/controller/action/param.rb".freeze, "lib/betterdocs/dsl/controller/action/response.rb".freeze, "lib/betterdocs/dsl/controller/controller.rb".freeze, "lib/betterdocs/dsl/controller/controller_base.rb".freeze, "lib/betterdocs/dsl/json_params.rb".freeze, "lib/betterdocs/dsl/json_params/param.rb".freeze, "lib/betterdocs/dsl/json_type_mapper.rb".freeze, "lib/betterdocs/dsl/naming.rb".freeze, "lib/betterdocs/dsl/representer.rb".freeze, "lib/betterdocs/dsl/result.rb".freeze, "lib/betterdocs/dsl/result/collection_property.rb".freeze, "lib/betterdocs/dsl/result/link.rb".freeze, "lib/betterdocs/dsl/result/property.rb".freeze, "lib/betterdocs/generator/config_shortcuts.rb".freeze, "lib/betterdocs/generator/markdown.rb".freeze, "lib/betterdocs/generator/swagger.rb".freeze, "lib/betterdocs/global.rb".freeze, "lib/betterdocs/json_params_representer.rb".freeze, "lib/betterdocs/json_params_representer_collector.rb".freeze, "lib/betterdocs/json_time_with_zone.rb".freeze, "lib/betterdocs/mix_into_controller.rb".freeze, "lib/betterdocs/railtie.rb".freeze, "lib/betterdocs/rake_tasks.rb".freeze, "lib/betterdocs/representer.rb".freeze, "lib/betterdocs/result_representer.rb".freeze, "lib/betterdocs/result_representer_collector.rb".freeze, "lib/betterdocs/sanitizer.rb".freeze, "lib/betterdocs/section.rb".freeze, "lib/betterdocs/version.rb".freeze]
|
15
15
|
s.files = [".codeclimate.yml".freeze, ".gitignore".freeze, ".rspec".freeze, ".semaphore/semaphore.yml".freeze, ".tool-versions".freeze, ".vscode/settings.json".freeze, "COPYING".freeze, "Gemfile".freeze, "LICENSE".freeze, "README.md".freeze, "Rakefile".freeze, "VERSION".freeze, "betterdocs.gemspec".freeze, "lib/betterdocs.rb".freeze, "lib/betterdocs/controller_collector.rb".freeze, "lib/betterdocs/dsl.rb".freeze, "lib/betterdocs/dsl/common.rb".freeze, "lib/betterdocs/dsl/controller.rb".freeze, "lib/betterdocs/dsl/controller/action.rb".freeze, "lib/betterdocs/dsl/controller/action/param.rb".freeze, "lib/betterdocs/dsl/controller/action/response.rb".freeze, "lib/betterdocs/dsl/controller/controller.rb".freeze, "lib/betterdocs/dsl/controller/controller_base.rb".freeze, "lib/betterdocs/dsl/json_params.rb".freeze, "lib/betterdocs/dsl/json_params/param.rb".freeze, "lib/betterdocs/dsl/json_type_mapper.rb".freeze, "lib/betterdocs/dsl/naming.rb".freeze, "lib/betterdocs/dsl/representer.rb".freeze, "lib/betterdocs/dsl/result.rb".freeze, "lib/betterdocs/dsl/result/collection_property.rb".freeze, "lib/betterdocs/dsl/result/link.rb".freeze, "lib/betterdocs/dsl/result/property.rb".freeze, "lib/betterdocs/generator/config_shortcuts.rb".freeze, "lib/betterdocs/generator/markdown.rb".freeze, "lib/betterdocs/generator/markdown/templates/README.md.erb".freeze, "lib/betterdocs/generator/markdown/templates/section.md.erb".freeze, "lib/betterdocs/generator/swagger.rb".freeze, "lib/betterdocs/generator/swagger_static/index.html".freeze, "lib/betterdocs/global.rb".freeze, "lib/betterdocs/json_params_representer.rb".freeze, "lib/betterdocs/json_params_representer_collector.rb".freeze, "lib/betterdocs/json_time_with_zone.rb".freeze, "lib/betterdocs/mix_into_controller.rb".freeze, "lib/betterdocs/railtie.rb".freeze, "lib/betterdocs/rake_tasks.rb".freeze, "lib/betterdocs/representer.rb".freeze, "lib/betterdocs/result_representer.rb".freeze, "lib/betterdocs/result_representer_collector.rb".freeze, "lib/betterdocs/sanitizer.rb".freeze, "lib/betterdocs/section.rb".freeze, "lib/betterdocs/tasks/doc.rake".freeze, "lib/betterdocs/version.rb".freeze, "spec/assets/app/assets/images/logos/logo.png".freeze, "spec/assets/app/controllers/api/foos_controller.rb".freeze, "spec/assets/app/views/api_v4/documentation/assets/CHANGELOG.md".freeze, "spec/assets/config/betterdocs.yml".freeze, "spec/betterdocs/dsl/controller/action/param_spec.rb".freeze, "spec/betterdocs/dsl/controller/action/response_spec.rb".freeze, "spec/betterdocs/dsl/json_type_mapper_spec.rb".freeze, "spec/betterdocs/dsl/result/collection_property_spec.rb".freeze, "spec/betterdocs/dsl/result/link_spec.rb".freeze, "spec/betterdocs/dsl/result/property_spec.rb".freeze, "spec/betterdocs/generator/markdown_spec.rb".freeze, "spec/betterdocs/global_spec.rb".freeze, "spec/betterdocs/json_params_representer_spec.rb".freeze, "spec/betterdocs/result_representer_spec.rb".freeze, "spec/betterdocs/sanitizer_spec.rb".freeze, "spec/controller_dsl_spec.rb".freeze, "spec/result_representer_dsl_spec.rb".freeze, "spec/spec_helper.rb".freeze]
|
16
|
-
s.homepage = "
|
16
|
+
s.homepage = "https://github.com/betterplace/betterdocs".freeze
|
17
17
|
s.rdoc_options = ["--title".freeze, "Betterdocs".freeze, "--main".freeze, "README.md".freeze]
|
18
|
-
s.rubygems_version = "3.
|
18
|
+
s.rubygems_version = "3.3.19".freeze
|
19
19
|
s.summary = "Betterplace API documentation library".freeze
|
20
20
|
s.test_files = ["spec/assets/app/controllers/api/foos_controller.rb".freeze, "spec/betterdocs/dsl/controller/action/param_spec.rb".freeze, "spec/betterdocs/dsl/controller/action/response_spec.rb".freeze, "spec/betterdocs/dsl/json_type_mapper_spec.rb".freeze, "spec/betterdocs/dsl/result/collection_property_spec.rb".freeze, "spec/betterdocs/dsl/result/link_spec.rb".freeze, "spec/betterdocs/dsl/result/property_spec.rb".freeze, "spec/betterdocs/generator/markdown_spec.rb".freeze, "spec/betterdocs/global_spec.rb".freeze, "spec/betterdocs/json_params_representer_spec.rb".freeze, "spec/betterdocs/result_representer_spec.rb".freeze, "spec/betterdocs/sanitizer_spec.rb".freeze, "spec/controller_dsl_spec.rb".freeze, "spec/result_representer_dsl_spec.rb".freeze, "spec/spec_helper.rb".freeze]
|
21
21
|
|
@@ -24,23 +24,23 @@ Gem::Specification.new do |s|
|
|
24
24
|
end
|
25
25
|
|
26
26
|
if s.respond_to? :add_runtime_dependency then
|
27
|
-
s.add_development_dependency(%q<gem_hadar>.freeze, ["~> 1.
|
27
|
+
s.add_development_dependency(%q<gem_hadar>.freeze, ["~> 1.12.0"])
|
28
28
|
s.add_development_dependency(%q<rake>.freeze, [">= 0"])
|
29
29
|
s.add_development_dependency(%q<simplecov>.freeze, [">= 0"])
|
30
30
|
s.add_development_dependency(%q<rspec>.freeze, [">= 0"])
|
31
31
|
s.add_runtime_dependency(%q<tins>.freeze, ["~> 1.3", ">= 1.3.5"])
|
32
|
-
s.add_runtime_dependency(%q<rails>.freeze, [">= 3", "<
|
32
|
+
s.add_runtime_dependency(%q<rails>.freeze, [">= 3", "< 8"])
|
33
33
|
s.add_runtime_dependency(%q<term-ansicolor>.freeze, ["~> 1.3"])
|
34
34
|
s.add_runtime_dependency(%q<complex_config>.freeze, ["~> 0.5"])
|
35
35
|
s.add_runtime_dependency(%q<infobar>.freeze, [">= 0"])
|
36
36
|
s.add_runtime_dependency(%q<mize>.freeze, [">= 0"])
|
37
37
|
else
|
38
|
-
s.add_dependency(%q<gem_hadar>.freeze, ["~> 1.
|
38
|
+
s.add_dependency(%q<gem_hadar>.freeze, ["~> 1.12.0"])
|
39
39
|
s.add_dependency(%q<rake>.freeze, [">= 0"])
|
40
40
|
s.add_dependency(%q<simplecov>.freeze, [">= 0"])
|
41
41
|
s.add_dependency(%q<rspec>.freeze, [">= 0"])
|
42
42
|
s.add_dependency(%q<tins>.freeze, ["~> 1.3", ">= 1.3.5"])
|
43
|
-
s.add_dependency(%q<rails>.freeze, [">= 3", "<
|
43
|
+
s.add_dependency(%q<rails>.freeze, [">= 3", "< 8"])
|
44
44
|
s.add_dependency(%q<term-ansicolor>.freeze, ["~> 1.3"])
|
45
45
|
s.add_dependency(%q<complex_config>.freeze, ["~> 0.5"])
|
46
46
|
s.add_dependency(%q<infobar>.freeze, [">= 0"])
|
@@ -102,7 +102,7 @@ module Betterdocs
|
|
102
102
|
|
103
103
|
def render_to(filename, template, binding)
|
104
104
|
File.open(filename, 'w') do |output|
|
105
|
-
rendered = ERB.new(template,
|
105
|
+
rendered = ERB.new(template, trim_mode: '-').result(binding)
|
106
106
|
output.write rendered
|
107
107
|
end
|
108
108
|
self
|
data/lib/betterdocs/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: betterdocs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- betterplace Developers
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-08-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gem_hadar
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.
|
19
|
+
version: 1.12.0
|
20
20
|
type: :development
|
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: 1.
|
26
|
+
version: 1.12.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -95,7 +95,7 @@ dependencies:
|
|
95
95
|
version: '3'
|
96
96
|
- - "<"
|
97
97
|
- !ruby/object:Gem::Version
|
98
|
-
version: '
|
98
|
+
version: '8'
|
99
99
|
type: :runtime
|
100
100
|
prerelease: false
|
101
101
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -105,7 +105,7 @@ dependencies:
|
|
105
105
|
version: '3'
|
106
106
|
- - "<"
|
107
107
|
- !ruby/object:Gem::Version
|
108
|
-
version: '
|
108
|
+
version: '8'
|
109
109
|
- !ruby/object:Gem::Dependency
|
110
110
|
name: term-ansicolor
|
111
111
|
requirement: !ruby/object:Gem::Requirement
|
@@ -275,7 +275,7 @@ files:
|
|
275
275
|
- spec/controller_dsl_spec.rb
|
276
276
|
- spec/result_representer_dsl_spec.rb
|
277
277
|
- spec/spec_helper.rb
|
278
|
-
homepage:
|
278
|
+
homepage: https://github.com/betterplace/betterdocs
|
279
279
|
licenses: []
|
280
280
|
metadata: {}
|
281
281
|
post_install_message:
|
@@ -297,7 +297,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
297
297
|
- !ruby/object:Gem::Version
|
298
298
|
version: '0'
|
299
299
|
requirements: []
|
300
|
-
rubygems_version: 3.
|
300
|
+
rubygems_version: 3.3.19
|
301
301
|
signing_key:
|
302
302
|
specification_version: 4
|
303
303
|
summary: Betterplace API documentation library
|