autodoc 0.7.6 → 0.8.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: 47721414a1cf3631034dbe786a133d21922de3a4ca0689dd5d37112c9267d638
4
- data.tar.gz: 6b398807f034927b9c8ec8749f028c0da00a254afb6a91e09fdd03f9a188602d
3
+ metadata.gz: 50536334ac5d6f900f9fced708be9ad367e3fe1eddaa00bac5293da40e431e54
4
+ data.tar.gz: 13466a0fcf42bc05cb62f58db8f25da29cad54b4542b8f119fcd16834e326532
5
5
  SHA512:
6
- metadata.gz: 9602be06ef5819e7edc380dd0ae990ec844cc0e38e4244144ca336de0522f213acffce64cf3df75eab269cce3a4a03bd276352fbfe518e2e9257194fa1ec6074
7
- data.tar.gz: 45030c275296700cd24e69ac95c0ade9f7bbb6e37a4cb23f9056d9037eb97e87f38a302f29164317381bf2da383f968246198890de8a50547fcfa4a158d76cf9
6
+ metadata.gz: 1d06e79f180dee1d1f52618b867b575a689efbc8f01b950f3dbdbeee5dabb3ada471f0a1d61faf26b4853d8777be2f874592b7a1792a7125ec1e6a32866dba2b
7
+ data.tar.gz: 281b298e0ae036992b5b36718c2f9bf71bbe3ca47de3edb744c67cc8c1d33856630a041dd7165faf3094ab9e49abd159c6bf0ebd9d899b49395460a379be63ae
@@ -0,0 +1,28 @@
1
+ name: test
2
+
3
+ on:
4
+ pull_request:
5
+ push:
6
+ branches:
7
+ - master
8
+
9
+ jobs:
10
+ build:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ matrix:
14
+ ruby:
15
+ - 2.7.2
16
+ steps:
17
+ - uses: actions/checkout@v2
18
+ - name: Set up Ruby
19
+ uses: ruby/setup-ruby@v1
20
+ with:
21
+ ruby-version: ${{ matrix.ruby }}
22
+ bundler-cache: true
23
+ - name: rails db:setup
24
+ run: |
25
+ cd spec/dummy
26
+ RAILS_ENV=test bundle exec rails db:setup
27
+ - name: Run the default task
28
+ run: bundle exec rake
data/CHANGELOG.md CHANGED
@@ -7,13 +7,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## Unreleased
9
9
 
10
- ## 0.7.6
10
+ ## 0.8.0 - 2022-12-23
11
+
12
+ ### Fixed
13
+
14
+ - Change the order of documents to match the order of tests.
15
+
16
+ ## 0.7.7 - 2022-05-17
17
+
18
+ ### Fixed
19
+
20
+ - Prefer `#media_type` to `#content_type` (for Rails 7's change).
21
+ - Fix `ERB.new` arguments style.
22
+
23
+ ## 0.7.6 - 2021-04-22
11
24
 
12
25
  ### Fixed
13
26
 
14
27
  - Replace `URI.unescape` with `URI.decode_www_form_component` for Ruby 3 support.
15
28
 
16
- ## 0.7.5
29
+ ## 0.7.5 - 2021-02-16
17
30
 
18
31
  ### Fixed
19
32
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- autodoc (0.7.5)
4
+ autodoc (0.7.7)
5
5
  actionpack
6
6
  activesupport (>= 3.0.0)
7
7
  rspec
@@ -51,40 +51,41 @@ GEM
51
51
  minitest (~> 5.1)
52
52
  tzinfo (~> 1.1)
53
53
  arel (9.0.0)
54
- builder (3.2.3)
55
- coderay (1.1.1)
56
- concurrent-ruby (1.1.4)
57
- crass (1.0.5)
58
- diff-lcs (1.3)
59
- erubi (1.8.0)
60
- globalid (0.4.1)
61
- activesupport (>= 4.2.0)
62
- i18n (1.3.0)
54
+ builder (3.2.4)
55
+ coderay (1.1.3)
56
+ concurrent-ruby (1.1.10)
57
+ crass (1.0.6)
58
+ diff-lcs (1.5.0)
59
+ erubi (1.10.0)
60
+ globalid (1.0.0)
61
+ activesupport (>= 5.0)
62
+ i18n (1.10.0)
63
63
  concurrent-ruby (~> 1.0)
64
- loofah (2.3.1)
64
+ loofah (2.19.1)
65
65
  crass (~> 1.0.2)
66
66
  nokogiri (>= 1.5.9)
67
67
  mail (2.7.1)
68
68
  mini_mime (>= 0.1.1)
69
69
  marcel (0.3.3)
70
70
  mimemagic (~> 0.3.2)
71
- method_source (0.8.2)
72
- mimemagic (0.3.3)
73
- mini_mime (1.0.1)
74
- mini_portile2 (2.5.0)
75
- minitest (5.11.3)
76
- nio4r (2.3.1)
77
- nokogiri (1.11.1)
78
- mini_portile2 (~> 2.5.0)
71
+ method_source (1.0.0)
72
+ mimemagic (0.3.10)
73
+ nokogiri (~> 1)
74
+ rake
75
+ mini_mime (1.1.2)
76
+ mini_portile2 (2.8.0)
77
+ minitest (5.15.0)
78
+ nio4r (2.5.8)
79
+ nokogiri (1.13.10)
80
+ mini_portile2 (~> 2.8.0)
79
81
  racc (~> 1.4)
80
- pry (0.10.4)
81
- coderay (~> 1.1.0)
82
- method_source (~> 0.8.1)
83
- slop (~> 3.4)
84
- pry-rails (0.3.6)
82
+ pry (0.14.1)
83
+ coderay (~> 1.1)
84
+ method_source (~> 1.0)
85
+ pry-rails (0.3.9)
85
86
  pry (>= 0.10.4)
86
- racc (1.5.2)
87
- rack (2.2.3)
87
+ racc (1.6.1)
88
+ rack (2.2.3.1)
88
89
  rack-test (1.1.0)
89
90
  rack (>= 1.0, < 3)
90
91
  rails (5.2.2)
@@ -103,56 +104,55 @@ GEM
103
104
  rails-dom-testing (2.0.3)
104
105
  activesupport (>= 4.2.0)
105
106
  nokogiri (>= 1.6)
106
- rails-html-sanitizer (1.0.4)
107
- loofah (~> 2.2, >= 2.2.2)
107
+ rails-html-sanitizer (1.4.4)
108
+ loofah (~> 2.19, >= 2.19.1)
108
109
  railties (5.2.2)
109
110
  actionpack (= 5.2.2)
110
111
  activesupport (= 5.2.2)
111
112
  method_source
112
113
  rake (>= 0.8.7)
113
114
  thor (>= 0.19.0, < 2.0)
114
- rake (13.0.1)
115
+ rake (13.0.6)
115
116
  redcarpet (3.5.1)
116
- responders (2.4.0)
117
- actionpack (>= 4.2.0, < 5.3)
118
- railties (>= 4.2.0, < 5.3)
119
- rspec (3.6.0)
120
- rspec-core (~> 3.6.0)
121
- rspec-expectations (~> 3.6.0)
122
- rspec-mocks (~> 3.6.0)
123
- rspec-core (3.6.0)
124
- rspec-support (~> 3.6.0)
125
- rspec-expectations (3.6.0)
117
+ responders (3.0.1)
118
+ actionpack (>= 5.0)
119
+ railties (>= 5.0)
120
+ rspec (3.11.0)
121
+ rspec-core (~> 3.11.0)
122
+ rspec-expectations (~> 3.11.0)
123
+ rspec-mocks (~> 3.11.0)
124
+ rspec-core (3.11.0)
125
+ rspec-support (~> 3.11.0)
126
+ rspec-expectations (3.11.0)
126
127
  diff-lcs (>= 1.2.0, < 2.0)
127
- rspec-support (~> 3.6.0)
128
- rspec-mocks (3.6.0)
128
+ rspec-support (~> 3.11.0)
129
+ rspec-mocks (3.11.1)
129
130
  diff-lcs (>= 1.2.0, < 2.0)
130
- rspec-support (~> 3.6.0)
131
- rspec-rails (3.6.1)
132
- actionpack (>= 3.0)
133
- activesupport (>= 3.0)
134
- railties (>= 3.0)
135
- rspec-core (~> 3.6.0)
136
- rspec-expectations (~> 3.6.0)
137
- rspec-mocks (~> 3.6.0)
138
- rspec-support (~> 3.6.0)
139
- rspec-support (3.6.0)
140
- slop (3.6.0)
141
- sprockets (3.7.2)
131
+ rspec-support (~> 3.11.0)
132
+ rspec-rails (5.1.1)
133
+ actionpack (>= 5.2)
134
+ activesupport (>= 5.2)
135
+ railties (>= 5.2)
136
+ rspec-core (~> 3.10)
137
+ rspec-expectations (~> 3.10)
138
+ rspec-mocks (~> 3.10)
139
+ rspec-support (~> 3.10)
140
+ rspec-support (3.11.0)
141
+ sprockets (4.0.3)
142
142
  concurrent-ruby (~> 1.0)
143
143
  rack (> 1, < 3)
144
- sprockets-rails (3.2.1)
145
- actionpack (>= 4.0)
146
- activesupport (>= 4.0)
144
+ sprockets-rails (3.4.2)
145
+ actionpack (>= 5.2)
146
+ activesupport (>= 5.2)
147
147
  sprockets (>= 3.0.0)
148
148
  sqlite3 (1.3.13)
149
- thor (0.20.3)
149
+ thor (1.2.1)
150
150
  thread_safe (0.3.6)
151
- tzinfo (1.2.5)
151
+ tzinfo (1.2.10)
152
152
  thread_safe (~> 0.1)
153
- weak_parameters (0.4.2)
153
+ weak_parameters (0.5.0)
154
154
  rails (>= 4.0.0)
155
- websocket-driver (0.7.0)
155
+ websocket-driver (0.7.5)
156
156
  websocket-extensions (>= 0.1.0)
157
157
  websocket-extensions (0.1.5)
158
158
 
@@ -169,7 +169,7 @@ DEPENDENCIES
169
169
  redcarpet
170
170
  responders
171
171
  rspec-rails
172
- sqlite3
172
+ sqlite3 (~> 1.3.13)
173
173
  weak_parameters
174
174
 
175
175
  BUNDLED WITH
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Autodoc
2
2
 
3
- [![CircleCI](https://circleci.com/gh/r7kamura/autodoc.svg?style=svg)](https://circleci.com/gh/r7kamura/autodoc)
3
+ [![test](https://github.com/r7kamura/autodoc/actions/workflows/test.yml/badge.svg)](https://github.com/r7kamura/autodoc/actions/workflows/test.yml)
4
4
  [![Gem Version](https://badge.fury.io/rb/autodoc.svg)](https://rubygems.org/gems/autodoc)
5
5
 
6
6
  Generate documentation from your rack application & request-spec.
@@ -17,7 +17,7 @@ gem "redcarpet", group: :test
17
17
  ```
18
18
 
19
19
  ## Usage
20
- Run rspec with AUTODOC=1 to generate documents for your request-specs tagged with `:autodoc`.
20
+ Run rspec with AUTODOC=1 to generate documents for your request-specs tagged with `:autodoc`.
21
21
  example: Autodoc generates [doc/recipes.md](https://github.com/r7kamura/autodoc/blob/master/spec/dummy/doc/recipes.md) and [doc/toc.md](https://github.com/r7kamura/autodoc/blob/master/spec/dummy/doc/toc.md) from [spec/requests/recipes_spec.rb](https://github.com/r7kamura/autodoc/blob/master/spec/requests/recipes_spec.rb).
22
22
 
23
23
  ```sh
data/Rakefile CHANGED
@@ -1 +1,8 @@
1
- require "bundler/gem_tasks"
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task default: %i[spec]
data/autodoc.gemspec CHANGED
@@ -23,5 +23,5 @@ Gem::Specification.new do |spec|
23
23
  spec.add_development_dependency "bundler", "~> 1.3"
24
24
  spec.add_development_dependency "rails", "5.2.2"
25
25
  spec.add_development_dependency "rake"
26
- spec.add_development_dependency "sqlite3"
26
+ spec.add_development_dependency "sqlite3", "~> 1.3.13"
27
27
  end
@@ -20,6 +20,10 @@ module Autodoc
20
20
  @example = example
21
21
  end
22
22
 
23
+ def line_number
24
+ @context.inspect[/:([\d]+)\)>$/, 1].to_i
25
+ end
26
+
23
27
  def pathname
24
28
  @pathname ||= begin
25
29
  Autodoc.configuration.pathname + document_path_from_example.call(example)
@@ -27,7 +31,7 @@ module Autodoc
27
31
  end
28
32
 
29
33
  def render
30
- ERB.new(Autodoc.configuration.template, nil, "-").result(binding)
34
+ ERB.new(Autodoc.configuration.template, trim_mode: "-").result(binding)
31
35
  end
32
36
 
33
37
  def title
@@ -119,7 +123,7 @@ module Autodoc
119
123
  else
120
124
  @request_body = begin
121
125
  case
122
- when request.try(:content_type) == "multipart/form-data"
126
+ when request.try(:media_type) == "multipart/form-data"
123
127
  "multipart/form-data"
124
128
  when request.headers["Content-Type"].try(:include?, "application/json")
125
129
  request_body_parsed_as_json
@@ -23,7 +23,7 @@ module Autodoc
23
23
  def write_documents
24
24
  @table.each do |pathname, documents|
25
25
  pathname.parent.mkpath
26
- pathname.open("w") {|file| file << documents.map(&:render).join("\n").rstrip + "\n" }
26
+ pathname.open("w") {|file| file << documents.sort_by(&:line_number).map(&:render).join("\n").rstrip + "\n" }
27
27
  end
28
28
  end
29
29
 
@@ -33,7 +33,7 @@ module Autodoc
33
33
  end
34
34
 
35
35
  def render_toc
36
- ERB.new(Autodoc.configuration.toc_template, nil, "-").result(binding)
36
+ ERB.new(Autodoc.configuration.toc_template, trim_mode: "-").result(binding)
37
37
  end
38
38
 
39
39
  def write_toc_html
@@ -42,7 +42,7 @@ module Autodoc
42
42
  end
43
43
 
44
44
  def render_toc_html
45
- ERB.new(Autodoc.configuration.toc_html_template, nil, "-").result(binding)
45
+ ERB.new(Autodoc.configuration.toc_html_template, trim_mode: "-").result(binding)
46
46
  end
47
47
 
48
48
  def toc_path
@@ -1,3 +1,3 @@
1
1
  module Autodoc
2
- VERSION = "0.7.6"
2
+ VERSION = "0.8.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autodoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.6
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryo Nakamura
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-04-21 00:00:00.000000000 Z
11
+ date: 2022-12-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -98,24 +98,24 @@ dependencies:
98
98
  name: sqlite3
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ">="
101
+ - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '0'
103
+ version: 1.3.13
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ">="
108
+ - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '0'
111
- description:
110
+ version: 1.3.13
111
+ description:
112
112
  email:
113
113
  - r7kamura@gmail.com
114
114
  executables: []
115
115
  extensions: []
116
116
  extra_rdoc_files: []
117
117
  files:
118
- - ".circleci/config.yml"
118
+ - ".github/workflows/test.yml"
119
119
  - ".gitignore"
120
120
  - CHANGELOG.md
121
121
  - Gemfile
@@ -186,7 +186,7 @@ homepage: https://github.com/r7kamura/autodoc
186
186
  licenses:
187
187
  - MIT
188
188
  metadata: {}
189
- post_install_message:
189
+ post_install_message:
190
190
  rdoc_options: []
191
191
  require_paths:
192
192
  - lib
@@ -201,8 +201,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
201
201
  - !ruby/object:Gem::Version
202
202
  version: '0'
203
203
  requirements: []
204
- rubygems_version: 3.1.4
205
- signing_key:
204
+ rubygems_version: 3.3.7
205
+ signing_key:
206
206
  specification_version: 4
207
207
  summary: Auto-generate JSON API documents from your request-specs.
208
208
  test_files:
data/.circleci/config.yml DELETED
@@ -1,29 +0,0 @@
1
- jobs:
2
- rspec:
3
- docker:
4
- - image: ruby:2.5.3
5
- steps:
6
- - checkout
7
- - restore_cache:
8
- keys:
9
- - v1-dependencies-{{ checksum "Gemfile.lock" }}
10
- - v1-dependencies-
11
- - run:
12
- command: bundle install --jobs=4 --retry=3 --path vendor/bundle
13
- name: bundle install
14
- - save_cache:
15
- key: v1-dependencies-{{ checksum "Gemfile.lock" }}
16
- paths:
17
- - ./vendor/bundle
18
- - run:
19
- command: cd spec/dummy && RAILS_ENV=test bundle exec rails db:setup
20
- name: rails db:setup
21
- - run:
22
- command: bundle exec rspec
23
- name: rspec
24
- version: 2
25
- workflows:
26
- version: 2
27
- test:
28
- jobs:
29
- - rspec