betterdocs 0.15.1 → 0.16.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
  SHA256:
3
- metadata.gz: cde89dbb0e6898ae3d9a76809ba6af7c91817a332aa7bcff0b345b01352664c6
4
- data.tar.gz: be8ebf611fecd6a88e2ad806233b67da0fcaf80364fab1ed157e91f88e5333f0
3
+ metadata.gz: 55bfcb8fa9c2b7524866b130f27c59362ddfe9cfa7875037ab06888822d7f463
4
+ data.tar.gz: 9b425a54443c54a11deac9dd91667ff36f846095b2f7b76403098ca607814492
5
5
  SHA512:
6
- metadata.gz: 40b464e3754f834a08eae7f651eee0bd3cafe077786a368a2f52b8038aa6c4e7d7d6aeb56b296344ab961b1d984150e9b6dbc6e67d3fd5971af35f7996b031eb
7
- data.tar.gz: 4d3eff6cc5a3c7c602ee788eb8df2704064e3fdd68e6cd2d3d2af7e2febcebe189283b40516b62350a40d7e13df1abc6de9a5a39000e939ad21a9f4e74a2f2db
6
+ metadata.gz: 0f0357898a75f7986272f7355d9f1211503fb791776f58b7b6bb348927ba33ad8cd2cc616459b9c7c5964fa8c138dcbf311263bf088107f4c5e8e937c92a7c55
7
+ data.tar.gz: 241722e0902ba09c38460460cca6ba250e23bea2c2da144eb6c3c226e3f1eb6f07a3de626e7d03b76dd0593417246c6b42aeeed0f7cbbde253f2bd71f2947a5d
@@ -0,0 +1,51 @@
1
+ # Simple workflow for deploying static content to GitHub Pages
2
+ name: Deploy static content to Pages
3
+
4
+ on:
5
+ # Runs on pushes targeting the default branch
6
+ push:
7
+ branches: [ "master" ]
8
+
9
+ # Allows you to run this workflow manually from the Actions tab
10
+ workflow_dispatch:
11
+
12
+ # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
13
+ permissions:
14
+ contents: read
15
+ pages: write
16
+ id-token: write
17
+
18
+ # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
19
+ # However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
20
+ concurrency:
21
+ group: "pages"
22
+ cancel-in-progress: false
23
+
24
+ jobs:
25
+ # Single deploy job since we're just deploying
26
+ deploy:
27
+ environment:
28
+ name: github-pages
29
+ url: ${{ steps.deployment.outputs.page_url }}
30
+ runs-on: ubuntu-latest
31
+ steps:
32
+ - name: Checkout
33
+ uses: actions/checkout@v7
34
+ - name: Setup Pages
35
+ uses: actions/configure-pages@v6
36
+ - name: Setup Ruby
37
+ uses: ruby/setup-ruby@v1
38
+ with:
39
+ ruby-version: '4.0'
40
+ - name: Generate Documentation
41
+ run: |
42
+ gem install gem_hadar
43
+ bundle install
44
+ rake doc
45
+ - name: Upload artifact
46
+ uses: actions/upload-pages-artifact@v5
47
+ with:
48
+ path: 'doc'
49
+ - name: Deploy to GitHub Pages
50
+ id: deployment
51
+ uses: actions/deploy-pages@v5
data/.rspec CHANGED
@@ -1,2 +1,3 @@
1
1
  --color
2
2
  --backtrace
3
+ -rspec_helper
data/.tool-versions CHANGED
@@ -1 +1 @@
1
- ruby 3.4.8
1
+ ruby 3.4.13
data/CHANGES.md CHANGED
@@ -1,246 +1,470 @@
1
1
  # Changes
2
2
 
3
+ ## 2026-11-24 v0.16.0
4
+
5
+ ### Features
6
+ - Added an explicit `json` runtime dependency (`>= 3`, `< 4`)
7
+ to the `Rakefile` and regenerated `betterdocs.gemspec`.
8
+
9
+ ### Improvements
10
+ - Updated Ruby to **3.4.13** in `.tool-versions`.
11
+ - Updated `gem_hadar` development dependency to **2.27.2**.
12
+ - Removed vim modeline comments from `Gemfile` and `Rakefile`.
13
+ - Consolidated `require 'spec_helper'` into `.rspec` via
14
+ `-rspec_helper`, removing the redundant line from all 11
15
+ spec files.
16
+
17
+ ### Build & CI
18
+ - Added a GitHub Pages workflow (`.github/workflows/static.yml`)
19
+ to deploy YARD docs from `doc/` on push to `master` and via
20
+ `workflow_dispatch`; registered via `github_workflows('static.yml'
21
+ => {})` in `Rakefile`.
22
+
23
+ ### Testing
24
+ - Added `json_params_representer_collector_spec.rb` with 9
25
+ examples, bringing `JsonParamsRepresenterCollector` to 100%
26
+ line and branch coverage.
27
+
28
+ ### Documentation
29
+ - Added a `LINKS` section to `README.md` with links to the
30
+ source repository and the hosted YARD API reference
31
+ (https://betterplace.github.io/betterdocs/).
32
+ - Restructured `CHANGES.md` history into categorized
33
+ `### Breaking` / `Features` / `Fixes` / `Improvements` /
34
+
3
35
  ## 2026-01-28 v0.15.1
4
36
 
5
- - Updated CI/CD configuration to use **ubuntu2404** image for Semaphore CI
6
- - Refactored Rails integration by removing the top-level `RakeTasks` module and
7
- moving rake task loading into `Betterdocs::Railtie#rake_tasks`
8
- - Updated development dependency `gem_hadar` from **2.16.3** to **2.17.0**
9
- - Modified `.all_images.yml` to use parallel bundle install with
10
- `--jobs=$(getconf _NPROCESSORS_ONLN)`
11
- - Added `rm -vf Gemfile.lock` cleanup in `before` and `after` sections for consistent builds
12
- - Updated gemspec file lists to include `.tool-versions` and exclude `lib/betterdocs/rake_tasks.rb`
13
- - Replaced `simplecov` with `gem_hadar/simplecov` in `spec/spec_helper.rb`
14
- - Updated `s.extra_rdoc_files` and `s.files` in gemspec to reflect current file structure
15
- - Updated Ruby version to **3.4.8** in `.tool-versions` file
37
+ ### Improvements
38
+ - Refactored Rails integration by removing the top-level
39
+ `RakeTasks` class and consolidating rake task loading into
40
+ `Betterdocs::Railtie#rake_tasks`.
41
+ - Updated `spec_helper.rb` to use `GemHadar::SimpleCov.start` instead of
42
+ manually requiring and configuring `SimpleCov`.
43
+
44
+ ### Build & CI
45
+ - Updated Semaphore CI to use the `ubuntu2404` image.
46
+ - Modified `.all_images.yml` to use parallel `bundle install` and added
47
+ `Gemfile.lock` cleanup steps for consistent builds.
48
+ - Updated the `gemspec` to include `.tool-versions` and exclude
49
+ `lib/betterdocs/rake_tasks.rb` from the file list.
50
+ - Updated the development dependency `gem_hadar` to version **2.17.0**.
51
+ - Added `.tool-versions` to specify Ruby **3.4.8** for the development
52
+ environment.
16
53
 
17
54
  ## 2026-01-08 v0.15.0
18
55
 
19
- - Added `CHANGES.md` changelog file and integrated it into the gem build
20
- process
21
- - Updated `Rakefile` to configure `CHANGES.md` as the changelog filename for
22
- gem building
23
- - Updated CI configuration to test against Ruby **4.0** and manage dependencies
56
+ ### Features
57
+ - Added a `CHANGES.md` changelog file and configured it for inclusion
58
+ in the gem package.
59
+
60
+ ### Build & CI
61
+ - Added Ruby **4.0** to the CI test matrix.
62
+ - Added `openssl-dev` to the Docker image and updated the test script to
63
+ use `bundle update --all`, `bundle install`, and `bundle exec rake spec`.
64
+ - Removed the `.tool-versions` file.
65
+
66
+ ### Testing
67
+ - Added a `TODO` message to a skipped test case.
24
68
 
25
69
  ## 2025-02-13 v0.14.0
26
70
 
27
- - Renamed `COPYING` file to `LICENSE`
28
- - Added Apache license to gemspec
71
+ ### Build & CI
72
+ - Renamed `COPYING` to `LICENSE` and updated it with the full Apache 2.0
73
+ license text.
74
+ - Added `Apache-2.0` to the gemspec licenses metadata.
75
+ - Added `all_images` as a development dependency.
76
+ - Updated the gemspec files list to include `.all_images.yml` and
77
+ `LICENSE`.
29
78
 
30
79
  ## 2025-02-13 v0.13.1
31
80
 
32
- - Added `all_images` gem dependency in `Rakefile`
33
- - Updated `.all_images.yml` file to include Docker image configurations
34
- - Changed test URL in `controller_dsl_spec.rb` to remove unnecessary path
35
- prefix
81
+ ### Build & CI
82
+ - Added `all_images` as a development dependency to the `Rakefile` and
83
+ introduced `.all_images.yml` to define a matrix of Ruby Docker images
84
+ (**3.1** through **3.4**) for automated testing.
85
+ - Updated the local development environment to use Ruby **3.4.1** by
86
+ modifying `.tool-versions`.
87
+
88
+ ### Testing
89
+ - Fixed the URL extraction regex in `spec/controller_dsl_spec.rb` to
90
+ correctly isolate the specification path and prevent the generation of
91
+ the `betterdocs/` prefix in expected output.
36
92
 
37
93
  ## 2025-01-07 v0.13.0
38
94
 
39
- - Updated Rails compatibility to support **Rails 8**
40
- - Relaxed version constraints to ensure compatibility with **Rails 8.0**
41
- - Spread compatibility support to **Rails 8** version range
95
+ ### Build & CI
96
+ - Relaxed the `rails` version constraint in the gemspec to
97
+ support versions **8.0** through **8.9** (now `>= 3`, `< 9`).
98
+ - Updated the `rails` dependency in the `Rakefile` to match the
99
+ new version range.
42
100
 
43
101
  ## 2024-09-17 v0.12.5
44
102
 
45
- - Updated Ruby version to **3.2.5**
46
- - Replaced `byebug` gem with `debug` gem as development dependency
47
- - Removed `.byebug_history` from `.gitignore` file
48
- - Updated `Gemfile` to remove `byebug` gem
49
- - Updated `Rakefile` to remove `.byebug_history` from ignored files
50
- - Updated `spec/spec_helper.rb` to require `debug` instead of `byebug`
51
- - Modified example generation to only include data from the response
52
- - Ensured generated examples use correct attributes and JSON format
103
+ ### Improvements
104
+ - Replaced `byebug` with the `debug` gem for development debugging.
105
+ - Updated the Ruby version to **3.2.5** and removed the pinned
106
+ `bundler` version from `.tool-versions`.
107
+ - Updated `gem_hadar` development dependency constraint to `~> 1.17.1`.
108
+ - Simplified `betterdocs.gemspec` syntax by using `add_development_dependency`
109
+ and `add_runtime_dependency` methods directly.
110
+ - Removed `.byebug_history` from `.gitignore` and `Rakefile` ignore lists.
111
+ - Added `ostruct` requirement to `spec/spec_helper.rb`.
112
+
113
+ ### Fixes
114
+ - Ensure generated response examples only include data from the response
115
+ payload by using `action.response.data.as_json`.
53
116
 
54
117
  ## 2023-04-06 v0.12.4
55
118
 
56
- - Force response data to JSON format for Swagger documentation
57
- - Update swagger response handling to ensure proper JSON serialization
58
- - Address DEV-11363 issue related to swagger response data formatting
119
+ ### Fixes
120
+ - Force response data to JSON in the Swagger generator by
121
+ invoking `to_json` on `action.response` before parsing.
59
122
 
60
123
  ## 2023-04-04 v0.12.3
61
124
 
62
- - Allow end points with a hyphen in their URL, such as
63
- `.../api_v4/clients/ww-testclient/projects.json`
64
- - Change gemspec update date
65
- - Update version number
125
+ ### Fixes
126
+ - Allow endpoint paths to include hyphens in their URLs, such as in
127
+ `.../api_v4/clients/ww-testclient/projects.json`, by updating the
128
+ regular expression in `lib/betterdocs/generator/swagger.rb`.
66
129
 
67
130
  ## 2022-12-10 v0.12.2
68
131
 
69
- - Fixed issue where `BigDecimal` was being incorrectly hoisted with its own
70
- petard, resolving potential rounding errors in decimal calculations
71
- - Improved internal handling of decimal precision to prevent unexpected
72
- behavior in mathematical operations
73
- - Enhanced test coverage for edge cases in `BigDecimal` arithmetic operations
74
- - Corrected memory allocation patterns in `BigDecimal` constructor methods
75
- - Refactored internal `BigDecimal` rounding logic to ensure consistent results
76
- across different platforms
132
+ ### Improvements
133
+ - Removed the `implement :to_hash, :submodule`
134
+ directive from `Betterdocs::Responding` to prevent unintended
135
+ behavior.
77
136
 
78
137
  ## 2022-12-09 v0.12.1
79
138
 
80
- - Moved `interface` down in the inheritance hierarchy
81
- - Reorganized class structure to improve code maintainability
82
- - Updated inheritance relationships for better object-oriented design
83
- - Modified class hierarchy to support future enhancements
84
- - Refactored code to align with updated inheritance patterns
139
+ ### Improvements
140
+ - Moved the `Betterdocs::Responding` module include from the
141
+ `Betterdocs::Representer` module to the
142
+ `Betterdocs::ResultRepresenter` module to refine the inheritance
143
+ hierarchy.
85
144
 
86
145
  ## 2022-12-09 v0.12.0
87
146
 
88
- - Introduces `Betterdocs::Responding` interface for validating API response
89
- data objects
90
- - Adds validation to ensure data objects respond to `#to_hash` method
91
- - Implements check for valid data objects used in API responses
92
- - Supports data objects that respond to `#to_hash` method for API response
93
- handling
147
+ ### Features
148
+ - Introduce the `Betterdocs::Responding` module to define the interface
149
+ for objects used in API responses.
150
+ - Require response data to include `Betterdocs::Responding` and implement
151
+ the `#to_hash` method.
152
+
153
+ ### Improvements
154
+ - Enhance error messages in `Betterdocs::Dsl::Controller::Action::Response`
155
+ to distinguish between missing data and invalid data types.
156
+ - Add validation in `#to_json` to raise an error if the response data is
157
+ `nil` or does not include `Betterdocs::Responding`.
158
+ - Include `Betterdocs::Responding` in `Betterdocs::Representer` and alias
159
+ `#as_json` to `#to_hash`.
160
+
161
+ ### Testing
162
+ - Update `response_spec.rb` to verify that response data includes
163
+ `Betterdocs::Responding` and handles invalid data types.
164
+ - Remove a skipped test from `json_params_representer_spec.rb`.
94
165
 
95
166
  ## 2022-12-07 v0.11.0
96
167
 
97
- - Added check for response data presence to ensure example responses are
98
- displayed in generated documentation
99
- - Upgraded Ruby to newest version
100
- - Improved README documentation
168
+ ### Features
169
+ - Raise an `Error` if the `data` key is missing or empty in
170
+ the example response.
171
+
172
+ ### Improvements
173
+ - Propagate the original `Error` object in the `data` method
174
+ of `Response` instead of wrapping it.
175
+ - Upgrade the Ruby runtime requirement to **3.1.3**.
176
+
177
+ ### Testing
178
+ - Update response specs to use `to_hash` and verify the new
179
+ empty data validation.
180
+
181
+ ### Documentation
182
+ - Add a section describing the `rake` tasks for generating and
183
+ pushing API documentation.
184
+ - Clarify the purpose of the controller DSL in the README.
101
185
 
102
186
  ## 2022-08-16 v0.10.0
103
187
 
104
- - Updated ERB implementation to use new keyword arguments syntax
105
- - Replaced old argument passing style with modern keyword argument approach in
106
- ERB processing
107
- - Enhanced ERB template handling with improved argument structure for **2.0**
108
- compatibility
188
+ ### Improvements
189
+ - Update `ERB` instantiation in `markdown.rb` to use the
190
+ `trim_mode` keyword argument for compatibility with Ruby **3.1**.
109
191
 
110
192
  ## 2022-07-20 v0.9.2
111
193
 
112
- - Loosened Rails dependency to allow versions **< 8**
113
- - Updated web protocol implementation to use new, experimental protocol for web
114
- stuff
115
- - Added Rails **7** compatibility
116
- - Set data via `Rakefile` and `gemhadar`
194
+ ### Build & CI
195
+ - Updated the `rails` dependency constraint to allow
196
+ versions up to **< 8**.
197
+ - Updated the `Rakefile` `homepage` to use `https`.
198
+ - Regenerated `betterdocs.gemspec` with the updated
199
+ `rails` dependency and `homepage`.
200
+
201
+ ### Documentation
202
+ - Added `RELEASING` section to `README.md`.
203
+ - Updated `README.md` release instructions to include
204
+ editing `VERSION` and running `rake gem:push`.
117
205
 
118
206
  ## 2022-07-14 v0.9.1
119
207
 
120
- - Fixed a bug in the code logic
121
- - Upgraded Ruby and Bundler dependencies to newer versions
122
- - Marked code examples in the README file as Ruby code for proper syntax
123
- highlighting
124
- - Updated project to use newer versions of dependencies and tools
208
+ ### Fixes
209
+ - Fixed a bug in the `sections` method of
210
+ `lib/betterdocs/generator/config_shortcuts.rb` by
211
+ iterating directly over `config.api_controllers`
212
+ instead of using `Dir` globbing, resolving an
213
+ issue where controller paths were not processed
214
+ correctly.
215
+
216
+ ### Improvements
217
+ - Upgraded the Ruby version to **3.0.4** and the
218
+ Bundler version to **2.3.8** in the
219
+ `.tool-versions` file.
220
+
221
+ ### Build & CI
222
+ - Updated the CI environment to use `ubuntu2004`
223
+ in the Semaphore configuration, replacing
224
+ `ubuntu1804`.
225
+ - Updated the `gem_hadar` dependency to version
226
+ **1.12.0** in the gemspec.
227
+
228
+ ### Documentation
229
+ - Wrapped Ruby code examples in the README with
230
+ `ruby` language fences to enable proper syntax
231
+ highlighting.
125
232
 
126
233
  ## 2021-09-21 v0.9.0
127
234
 
128
- - Updated Ruby version to **3.0.2**
235
+ ### Improvements
236
+ - Updated the development Ruby version to **3.0.2** in `.tool-versions`.
129
237
 
130
238
  ## 2021-07-30 v0.8.1
131
239
 
132
- - Added optional `descriptor` parameter to documentation generation
133
- - Implemented Swagger JSON generator for OpenAPI **3.0.2** specification
134
- - Fixed compatibility issues for Ruby **3** runtime environment
240
+ ### Features
241
+ - Add an OpenAPI 3.0.2 Swagger JSON generator that creates
242
+ interactive API documentation from existing DSL definitions.
243
+ - Introduce `swagger_output_directory`, `swagger_assets`, and
244
+ related configuration options to `Betterdocs::Global`.
245
+ - Support an optional descriptor for properties in the Swagger
246
+ output, allowing non-required fields to be documented.
247
+ - Add a `doc:api:swagger` rake task to generate the Swagger
248
+ documentation bundle.
249
+
250
+ ### Fixes
251
+ - Ensure compatibility with Ruby **3.0** by explicitly requiring
252
+ `active_support/time_with_zone` and correcting keyword argument
253
+ splat usage in `Betterdocs::Dsl::JsonParams::Param` and
254
+ `Betterdocs::Dsl::Result::Property`.
255
+ - Update `Betterdocs::Representer#doc` and
256
+ `Betterdocs::ResultRepresenter#doc` to pass keyword arguments
257
+ correctly to `docs.add_element`.
258
+
259
+ ### Improvements
260
+ - Remove the `.travis.yml` configuration file in favor of existing
261
+ CI setups.
262
+ - Refactor `Betterdocs::Global` URL handling and asset iteration
263
+ for clarity and consistency.
264
+
265
+ ### Build & CI
266
+ - Add Ruby version management via `.tool-versions`.
267
+ - Update gemspec metadata and file listings to include new
268
+ Swagger generator files and static assets.
135
269
 
136
270
  ## 2021-06-01 v0.7.1
137
271
 
138
- - Raise `TypeError` during generation instead of displaying 'undefined' to
139
- prevent confusing Swagger specifications
140
- - Improved error handling for generation process to provide clearer type errors
272
+ ### Fixes
273
+ - Raise `TypeError` in `derive_json_type_from` for unmapped types to prevent
274
+ invalid Swagger specs.
141
275
 
142
276
  ## 2021-05-21 v0.7.0
143
277
 
144
- - Added support for **Ruby 3.0.1**
145
- - Updated to work with newest **Ruby 3.0.x** releases
146
- - Added semaphore configuration
147
- - Added testing on **Ruby 2.7**
148
- - Upgraded Bundler
278
+ ### Features
279
+ - Added support for Ruby 3.0.1.
280
+
281
+ ### Fixes
282
+ - Replaced `ActiveSupport::TimeWithZone` checks with `respond_to?(:iso8601)` in
283
+ `json_params/param.rb` and `result/property.rb` for compatibility.
284
+ - Updated `doc` method calls in `representer.rb` and `result_representer.rb`
285
+ to explicitly pass keyword arguments.
286
+
287
+ ### Build & CI
288
+ - Migrated CI configuration from Travis CI to Semaphore.
289
+ - Updated `.gemspec` dependencies and removed outdated Ruby version
290
+ specifications.
149
291
 
150
292
  ## 2019-08-23 v0.6.7
151
293
 
152
- - Support **Rails 6** compatibility
153
- - Fix and cleanup previous version
154
- - Update dependencies and codebase
294
+ ### Fixes
295
+ - Remove debug `puts` statements from the markdown template for
296
+ section rendering.
297
+
298
+ ### Improvements
299
+ - Expand the `rails` dependency constraint to support Rails **6**,
300
+ changing the upper bound from `<6` to `<7`.
301
+ - Update the CI Ruby version from **2.5.0** to **2.6.3** in
302
+ `.travis.yml`.
303
+
304
+ ### Documentation
305
+ - Correct capitalization and whitespace in the `README.md`
306
+ description and code examples.
155
307
 
156
308
  ## 2018-11-23 v0.6.5
157
309
 
158
- - Allow random strings in the `required` field configuration
159
- - Update **2.0.0** version number in gemspec file
310
+ ### Improvements
311
+ - Allowed custom strings for the `required` field in the Markdown generator
312
+ template, replacing the previous hardcoded boolean labels.
160
313
 
161
314
  ## 2018-10-10 v0.6.4
162
315
 
163
- - **Cut down backtrace for errors in response blocks** - Reduced backtrace
164
- length for errors occurring in response blocks to improve error message
165
- clarity
166
- - **Update code formatting style to "Cirru"** - Updated code formatting style
167
- to follow the Cirru style guide as defined in the referenced gist
168
- - **Test on latest rubies** - Added testing support for latest Ruby versions to
169
- ensure compatibility
316
+ ### Fixes
317
+ - Raised a custom `Error` in `Betterdocs::Dsl::Controller::Action::Response#data`
318
+ to filter backtraces to the Rails root, improving error visibility.
319
+ - Updated `Betterdocs::Generator::Markdown#fail_while_rendering` to omit the
320
+ template name for response errors and label the backtrace as "Location:".
321
+
322
+ ### Improvements
323
+ - Changed the code block language in `section.md.erb` from "Rebol" to
324
+ "Cirru" for improved syntax highlighting.
325
+
326
+ ### Build & CI
327
+ - Added `rake` as a development dependency in `Rakefile` and
328
+ `betterdocs.gemspec`.
329
+ - Updated Travis CI configuration to test on Ruby **2.4.3** and **2.5.0**,
330
+ including a `before_install` step to update RubyGems and Bundler.
170
331
 
171
332
  ## 2017-08-18 v0.6.3
172
333
 
173
- - Fixed display of nested attributes in the form
174
- - Added important empty line to improve code readability
334
+ ### Fixes
335
+ - Fixed the display of nested attributes in the generated documentation.
175
336
 
176
337
  ## 2017-03-30 v0.6.2
177
338
 
178
- - Avoided issues with GitHub's new markdown parser by updating documentation
179
- formatting
180
- - Ensured proper rendering of changelog entries in GitHub's markdown parser
181
- - Fixed potential confusion in documentation caused by GitHub's updated
182
- markdown processing
183
- - Improved compatibility with GitHub's markdown parser version **2.0** and
184
- later
185
- - Updated markdown syntax in documentation files to prevent parsing issues
186
- - Resolved conflicts with GitHub's new markdown parser behavior in changelog
187
- formatting
339
+ ### Fixes
340
+ - Removed an extra blank line from the generated Markdown table in
341
+ `section.md.erb` to prevent rendering issues with GitHub's parser.
188
342
 
189
343
  ## 2017-03-30 v0.6.1
190
344
 
191
- - Allow using markdown in `link` `full_name` as well
192
- - Fix `link` `full_name` to support markdown formatting
193
- - Add markdown support to `link` `full_name` attribute
194
- - Enable markdown rendering in `link` `full_name` field
345
+ ### Features
346
+ - Allow using markdown in link `full_name` fields.
195
347
 
196
348
  ## 2017-03-30 v0.6.0
197
349
 
198
- - Added support for markdown descriptions in HTML tables of sections
199
- - Implemented automatic HTML sanitization for string values in result
200
- properties
201
- - Refactored spec structure and added more comprehensive tests, primarily for
202
- smaller units
203
- - Enhanced security by sanitizing HTML content in result properties
204
- - Improved test coverage with additional specifications for unit-level
205
- functionality
350
+ ### Features
351
+ - Support Markdown syntax in section descriptions within
352
+ HTML tables.
353
+ - Add automatic HTML sanitization to string values in result
354
+ properties via a new `Betterdocs::Sanitizer` class.
355
+
356
+ ### Fixes
357
+ - Fix syntax error in `README.md.erb` template to correctly
358
+ render section links.
359
+ - Ensure asset file paths are resolved relative to the Rails
360
+ root during document generation.
361
+
362
+ ### Improvements
363
+ - Refactor internal structure of `Response` and `Global`
364
+ modules for improved clarity.
365
+ - Update infobar progress messages to include spacing and
366
+ completion details.
367
+ - Remove development environment restriction from global
368
+ configuration loading.
369
+
370
+ ### Build & CI
371
+ - Add `mize` as a runtime dependency for HTML sanitization.
372
+
373
+ ### Testing
374
+ - Refactor spec structure and add new unit tests for
375
+ `Sanitizer`, `Property`, `Link`, `CollectionProperty`,
376
+ `Param`, `Response`, and `Markdown` generator.
206
377
 
207
378
  ## 2017-03-20 v0.5.0
208
379
 
209
- - Added automatic HTML sanitization to string values in result properties
210
- - Refactored the structure of the specs
211
- - Added more specs, mostly for smaller units
212
- - Added `.travis.yml` configuration file back
213
- - Modified `byebug` loading to only occur on MRI rubies
214
- - Moved `require` statement to a different location
215
- - Added `.yardoc` directory to `.gitignore`
216
- - Replaced deprecated `Fixnum` with `Integer` to support Ruby **2.4**
217
- - Added infobar to display progress
218
- - Removed Travis CI and CodeClimate configurations
380
+ ### Features
381
+ - Add automatic HTML sanitization to string values in result
382
+ properties via the `Betterdocs::Sanitizer` class.
383
+ - Add support for a global `default_sanitize` configuration option
384
+ in `Betterdocs::Global`.
385
+
386
+ ### Fixes
387
+ - Resolve asset paths relative to the Rails root directory to
388
+ ensure correct file copying during documentation generation.
389
+ - Replace deprecated `Fixnum` references with `Integer` in specs
390
+ for Ruby **2.4.0** compatibility.
391
+ - Load `byebug` only on the MRI platform to support other Ruby
392
+ implementations.
393
+
394
+ ### Improvements
395
+ - Implement progress bars using the `infobar` gem to display
396
+ generation status and estimated time of completion.
397
+ - Refactor the representer lookup logic in
398
+ `Betterdocs::Dsl::Controller::Action::Response` for clarity and
399
+ robustness.
400
+ - Enable YAML-based configuration in all environments, removing
401
+ the previous restriction to development mode.
402
+
403
+ ### Build & CI
404
+ - Add `mize` as a runtime dependency to support the new sanitizer
405
+ functionality.
406
+ - Add `infobar` as a runtime dependency to support progress
407
+ reporting.
408
+ - Re-add `.travis.yml` to configure CI with Ruby **2.4.0**.
409
+ - Remove CodeClimate test reporter configuration and dependencies.
410
+
411
+ ### Testing
412
+ - Refactor and expand the spec suite structure to cover smaller
413
+ units, including `Param`, `Response`, `Property`, `Link`, and
414
+ `Sanitizer`.
415
+ - Add test fixtures for assets and global configuration in spec
416
+ assets.
219
417
 
220
418
  ## 2016-12-07 v0.4.0
221
419
 
222
- - Added compatibility for **Rails 5**
223
- - Changed default behavior to always use `quirks_mode`
420
+ ### Improvements
421
+ - Use `quirks_mode` when generating JSON response examples in
422
+ markdown templates to ensure compatibility with modern Rails
423
+ versions.
424
+ - Replace `ActionController::Parameters` with `HashWithIndifferentAccess`
425
+ in `JsonParamsRepresenter` to avoid relying on Rails-specific
426
+ parameter classes.
427
+
428
+ ### Fixes
429
+ - Allow compatibility with Rails 5 by removing the version constraint
430
+ that previously restricted `rails` to versions below 5.
224
431
 
225
432
  ## 2016-06-13 v0.3.0
226
433
 
227
- - Updated configuration method to use `complex_config` for setup
228
- - Enhanced `Betterdocs::Global` specification in tests
229
- - Extended `ActiveSupport::TimeWithZone` to work around Rails issues
230
- - Added support for configuring via `complex_config`
231
- - Improved error messages for better clarity
232
- - Added testing for **Ruby 2.3.0** and **Ruby 2.3.1** on Travis CI
233
- - Updated to use newest `gem_hadar` version
234
- - Fixed compatibility issues with old Bundler versions
235
- - Made tests run on machines other than the developer's local environment
434
+ ### Features
435
+ - Integrate `complex_config` to support YAML-based configuration for `Betterdocs::Global`
436
+ - Add a Rails railtie to automatically initialize the global configuration
437
+ - Serialize `ActiveSupport::TimeWithZone` values as ISO 8601 strings in JSON output
438
+ - Introduce `api_url`, `asset_url`, and `platform_url` methods to manage and parse host settings
439
+ - Add a `controllers_dir` accessor to customize the directory for API controller discovery
440
+
441
+ ### Fixes
442
+ - Improve error handling for URL generation failures by raising a descriptive exception
443
+
444
+ ### Improvements
445
+ - Refactor the assets configuration API to support both hash and individual assignment
446
+
447
+ ### Build & CI
448
+ - Drop support for Ruby **2.0**, **2.1**, and **2.2** in the CI test matrix
449
+ - Update the CI test matrix to run against Ruby **2.3.1**
450
+ - Ensure `Bundler` is updated before installation in the CI environment
451
+
452
+ ### Testing
453
+ - Add a test suite for `Betterdocs::Global` to verify configuration and URL handling
454
+ - Update API controller tests to be independent of the absolute file path
236
455
 
237
456
  ## 2016-03-30 v0.2.0
238
457
 
239
- - Updated to use the newest **gem_hadar** version
240
- - Removed `Tins::To` functionality
241
- - Replaced usage of `to` with `<<~` syntax
242
- - Added CodeClimate configuration settings to replace web interface settings
458
+ ### Breaking
459
+ - Removed the inclusion of `Tins::To` from `Betterdocs::Dsl::Common`.
460
+
461
+ ### Improvements
462
+ - Upgraded the development dependency on `gem_hadar` to **1.6.1**.
463
+ - Added a `.codeclimate.yml` file to configure Code Climate.
464
+
465
+ ### Build & CI
466
+ - Removed the `.ruby-version` file.
243
467
 
244
468
  ## 2015-09-04 v0.1.0
245
469
 
246
- * Start
470
+ * Start
data/Gemfile CHANGED
@@ -1,5 +1,3 @@
1
- # vim: set filetype=ruby et sw=2 ts=2:
2
-
3
1
  source 'https://rubygems.org'
4
2
 
5
3
  gemspec
data/README.md CHANGED
@@ -123,6 +123,12 @@ RELEASING
123
123
 
124
124
  Edit `Rakefile` and `VERSION` and run `rake` (because we use gemhadar). Commit changes, run `rake gem:push` and `git push --tags`.
125
125
 
126
+ LINKS
127
+ -----
128
+
129
+ - **Source**: https://github.com/betterplace/betterdocs
130
+ - **Documentation**: https://betterplace.github.io/betterdocs/
131
+
126
132
  AUTHORS
127
133
  -------
128
134
  Florian Frank <flori@ping.de>
@@ -139,4 +145,3 @@ TODO
139
145
  - Automatically document error result documents
140
146
  - Use private flag action/controller to skip docu creation by default. Make it
141
147
  configurable to create private API as well.
142
-
data/Rakefile CHANGED
@@ -1,5 +1,3 @@
1
- # vim: set filetype=ruby et sw=2 ts=2:
2
-
3
1
  require 'gem_hadar'
4
2
 
5
3
  GemHadar do
@@ -22,6 +20,11 @@ GemHadar do
22
20
  filename 'CHANGES.md'
23
21
  end
24
22
 
23
+ github_workflows(
24
+ 'static.yml' => {}
25
+ )
26
+
27
+ dependency 'json', '>= 3', '< 4'
25
28
  dependency 'tins', '~>1.3', '>=1.3.5'
26
29
  dependency 'rails', '>=3', '<9'
27
30
  dependency 'term-ansicolor', '~>1.3'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.15.1
1
+ 0.16.0
data/betterdocs.gemspec CHANGED
@@ -1,9 +1,9 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: betterdocs 0.15.1 ruby lib
2
+ # stub: betterdocs 0.16.0 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "betterdocs".freeze
6
- s.version = "0.15.1".freeze
6
+ s.version = "0.16.0".freeze
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]
@@ -12,22 +12,23 @@ Gem::Specification.new do |s|
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/representer.rb".freeze, "lib/betterdocs/responding.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
- s.files = [".all_images.yml".freeze, ".codeclimate.yml".freeze, ".gitignore".freeze, ".rspec".freeze, ".semaphore/semaphore.yml".freeze, ".tool-versions".freeze, ".vscode/settings.json".freeze, "CHANGES.md".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/representer.rb".freeze, "lib/betterdocs/responding.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]
15
+ s.files = [".all_images.yml".freeze, ".codeclimate.yml".freeze, ".github/workflows/static.yml".freeze, ".gitignore".freeze, ".rspec".freeze, ".semaphore/semaphore.yml".freeze, ".tool-versions".freeze, ".vscode/settings.json".freeze, "CHANGES.md".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/representer.rb".freeze, "lib/betterdocs/responding.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_collector_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
16
  s.homepage = "https://github.com/betterplace/betterdocs".freeze
17
17
  s.licenses = ["Apache-2.0".freeze]
18
18
  s.rdoc_options = ["--title".freeze, "Betterdocs".freeze, "--main".freeze, "README.md".freeze]
19
- s.rubygems_version = "4.0.3".freeze
19
+ s.rubygems_version = "3.6.9".freeze
20
20
  s.summary = "Betterplace API documentation library".freeze
21
- 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
+ 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_collector_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]
22
22
 
23
23
  s.specification_version = 4
24
24
 
25
- s.add_development_dependency(%q<gem_hadar>.freeze, [">= 2.17.0".freeze])
25
+ s.add_development_dependency(%q<gem_hadar>.freeze, [">= 2.27.2".freeze])
26
26
  s.add_development_dependency(%q<rake>.freeze, [">= 0".freeze])
27
27
  s.add_development_dependency(%q<simplecov>.freeze, [">= 0".freeze])
28
28
  s.add_development_dependency(%q<rspec>.freeze, [">= 0".freeze])
29
29
  s.add_development_dependency(%q<debug>.freeze, [">= 0".freeze])
30
30
  s.add_development_dependency(%q<all_images>.freeze, [">= 0".freeze])
31
+ s.add_runtime_dependency(%q<json>.freeze, [">= 3".freeze, "< 4".freeze])
31
32
  s.add_runtime_dependency(%q<tins>.freeze, ["~> 1.3".freeze, ">= 1.3.5".freeze])
32
33
  s.add_runtime_dependency(%q<rails>.freeze, [">= 3".freeze, "< 9".freeze])
33
34
  s.add_runtime_dependency(%q<term-ansicolor>.freeze, ["~> 1.3".freeze])
@@ -1,6 +1,11 @@
1
+ # Version information for the Betterdocs gem.
2
+ #
3
+ # This module is auto-generated by GemHadar and exposes the
4
+ # current release version as a set of constants. Do not edit it
5
+ # by hand; it is rewritten on every `rake version` invocation.
1
6
  module Betterdocs
2
- # Betterdocs version
3
- VERSION = '0.15.1'
7
+ # The current version of the Betterdocs gem as a String.
8
+ VERSION = '0.16.0'
4
9
  VERSION_ARRAY = VERSION.split('.').map(&:to_i) # :nodoc:
5
10
  VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
6
11
  VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  describe Betterdocs::Dsl::Controller::Action::Param do
4
2
  let :param do
5
3
  described_class.new('test') do
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  describe Betterdocs::Dsl::Controller::Action::Response do
4
2
  let :docs do
5
3
  double(
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  describe Betterdocs::Dsl::JsonTypeMapper do
4
2
  let :jtm do Betterdocs::Dsl::JsonTypeMapper end
5
3
 
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  describe Betterdocs::Dsl::Result::CollectionProperty do
4
2
  let :result do
5
3
  {}
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  describe Betterdocs::Dsl::Result::Link do
4
2
  let :result do
5
3
  {
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  describe Betterdocs::Dsl::Result::Property do
4
2
  let :result do
5
3
  {}
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  describe Betterdocs::Generator::Markdown do
4
2
  let :rails do
5
3
  double(
@@ -1,4 +1,3 @@
1
- require 'spec_helper'
2
1
  require 'pathname'
3
2
 
4
3
  describe Betterdocs::Global do
@@ -0,0 +1,80 @@
1
+ describe Betterdocs::JsonParamsRepresenterCollector do
2
+ let :collector do
3
+ described_class.new
4
+ end
5
+
6
+ describe '#initialize' do
7
+ it 'starts with an empty params hash' do
8
+ expect(collector.params).to eq({})
9
+ end
10
+ end
11
+
12
+ describe '#param' do
13
+ it 'returns nil for an unknown param name' do
14
+ expect(collector.param(:nonexistent)).to be_nil
15
+ end
16
+
17
+ it 'returns the stored param for a known name' do
18
+ collector.add_element('MyRep', :param, :email) do
19
+ description 'An email address'
20
+ types String
21
+ end
22
+ param = collector.param(:email)
23
+ expect(param).to be_a Betterdocs::Dsl::JsonParams::Param
24
+ expect(param.description).to eq 'An email address'
25
+ end
26
+ end
27
+
28
+ describe '#add_element' do
29
+ it 'stores a Param element keyed by its name' do
30
+ collector.add_element('MyRep', :param, :email) do
31
+ description 'An email'
32
+ types String
33
+ end
34
+ expect(collector.params.keys).to eq [ :email ]
35
+ end
36
+
37
+ it 'raises ArgumentError for an unknown element type' do
38
+ expect {
39
+ collector.add_element('MyRep', :widget, :foo)
40
+ }.to raise_error(ArgumentError,
41
+ /unknown documentation element type :widget/)
42
+ end
43
+ end
44
+
45
+ describe '#representer' do
46
+ it 'returns nil when the collector is empty' do
47
+ expect(collector.representer).to be_nil
48
+ end
49
+
50
+ it 'returns the representer of the first param that has one' do
51
+ collector.add_element('MyRep', :param, :email) do
52
+ description 'An email'
53
+ types String
54
+ end
55
+ expect(collector.representer).to eq 'MyRep'
56
+ end
57
+ end
58
+
59
+ describe '#to_s' do
60
+ it 'renders a header with no properties when empty' do
61
+ expect(collector.to_s).to eq "*** ***\n"
62
+ end
63
+
64
+ it 'lists documented params with types and descriptions' do
65
+ collector.add_element('MyRep', :param, :email) do
66
+ description 'An email address'
67
+ types String
68
+ end
69
+ collector.add_element('MyRep', :param, :age) do
70
+ description 'User age'
71
+ types Integer
72
+ end
73
+ output = collector.to_s
74
+ expect(output).to start_with "*** MyRep ***\n"
75
+ expect(output).to include "\nProperties:"
76
+ expect(output).to include "email: (string): An email address"
77
+ expect(output).to include "age: (number): User age"
78
+ end
79
+ end
80
+ end
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  describe Betterdocs::JsonParamsRepresenter do
4
2
  module MyJsonParams
5
3
  include Betterdocs::JsonParamsRepresenter
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  describe Betterdocs::ResultRepresenter do
4
2
  module MySubRepresenter
5
3
  include Betterdocs::ResultRepresenter
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  describe Betterdocs::Sanitizer do
4
2
  let :sanitizer do
5
3
  described_class.new do |text|
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  describe 'controller dsl' do
4
2
  let :docs do
5
3
  Betterdocs::ControllerCollector.new
@@ -9,6 +7,9 @@ describe 'controller dsl' do
9
7
  double(application: double(routes: double(url_for: 'http://foo/bar')))
10
8
  end
11
9
 
10
+ #
11
+ # Controller
12
+ #
12
13
  let :controller do
13
14
  Module.new do
14
15
  class << self
@@ -19,7 +20,6 @@ describe 'controller dsl' do
19
20
  alias to_s name
20
21
  end
21
22
 
22
-
23
23
  def foo
24
24
  end
25
25
  end
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  describe 'representer dsl' do
4
2
  let :docs do
5
3
  Betterdocs::ResultRepresenterCollector.new
data/spec/spec_helper.rb CHANGED
@@ -11,4 +11,3 @@ RSpec.configure do |c|
11
11
  Betterdocs::Global.configure
12
12
  end
13
13
  end
14
-
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: betterdocs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.1
4
+ version: 0.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - betterplace Developers
@@ -15,14 +15,14 @@ dependencies:
15
15
  requirements:
16
16
  - - ">="
17
17
  - !ruby/object:Gem::Version
18
- version: 2.17.0
18
+ version: 2.27.2
19
19
  type: :development
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
23
  - - ">="
24
24
  - !ruby/object:Gem::Version
25
- version: 2.17.0
25
+ version: 2.27.2
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: rake
28
28
  requirement: !ruby/object:Gem::Requirement
@@ -93,6 +93,26 @@ dependencies:
93
93
  - - ">="
94
94
  - !ruby/object:Gem::Version
95
95
  version: '0'
96
+ - !ruby/object:Gem::Dependency
97
+ name: json
98
+ requirement: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: '3'
103
+ - - "<"
104
+ - !ruby/object:Gem::Version
105
+ version: '4'
106
+ type: :runtime
107
+ prerelease: false
108
+ version_requirements: !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ version: '3'
113
+ - - "<"
114
+ - !ruby/object:Gem::Version
115
+ version: '4'
96
116
  - !ruby/object:Gem::Dependency
97
117
  name: tins
98
118
  requirement: !ruby/object:Gem::Requirement
@@ -234,6 +254,7 @@ extra_rdoc_files:
234
254
  files:
235
255
  - ".all_images.yml"
236
256
  - ".codeclimate.yml"
257
+ - ".github/workflows/static.yml"
237
258
  - ".gitignore"
238
259
  - ".rspec"
239
260
  - ".semaphore/semaphore.yml"
@@ -297,6 +318,7 @@ files:
297
318
  - spec/betterdocs/dsl/result/property_spec.rb
298
319
  - spec/betterdocs/generator/markdown_spec.rb
299
320
  - spec/betterdocs/global_spec.rb
321
+ - spec/betterdocs/json_params_representer_collector_spec.rb
300
322
  - spec/betterdocs/json_params_representer_spec.rb
301
323
  - spec/betterdocs/result_representer_spec.rb
302
324
  - spec/betterdocs/sanitizer_spec.rb
@@ -325,7 +347,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
325
347
  - !ruby/object:Gem::Version
326
348
  version: '0'
327
349
  requirements: []
328
- rubygems_version: 4.0.3
350
+ rubygems_version: 3.6.9
329
351
  specification_version: 4
330
352
  summary: Betterplace API documentation library
331
353
  test_files:
@@ -338,6 +360,7 @@ test_files:
338
360
  - spec/betterdocs/dsl/result/property_spec.rb
339
361
  - spec/betterdocs/generator/markdown_spec.rb
340
362
  - spec/betterdocs/global_spec.rb
363
+ - spec/betterdocs/json_params_representer_collector_spec.rb
341
364
  - spec/betterdocs/json_params_representer_spec.rb
342
365
  - spec/betterdocs/result_representer_spec.rb
343
366
  - spec/betterdocs/sanitizer_spec.rb