rpdoc 0.1.12 → 0.1.13

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: 8bd4a2fdf6339f7ab5a963d52ad2ccc3950e7edcca3ffbd7882be39e995d1014
4
- data.tar.gz: 228c44ebef79a9852e08a736935c9334cb4cd1e8decca079ff5b38c18fa70cee
3
+ metadata.gz: e98e37b15d40a4b7598356183e181e1ee734b155cbc32871ef58484ad0d686c5
4
+ data.tar.gz: 2cbe2c73a33ac5020b3803892227bb7a3302328a6b20ce9117b331c3df180efe
5
5
  SHA512:
6
- metadata.gz: e8480e75031c7dadda942348f6ec22799ac217ea78202aea5c53131ff67298e83d25d7cb5b4430eb3c6b870e2c4362650023c0883efe8b152eb673fd2ed2ea4d
7
- data.tar.gz: 792babfa02d6b6a54b52f42124b3e519bad2ee2c9a63b197073dfa075ede8a1e50523d4e9334af1b5776d5ba64ed97e737878b960449f31415c7873d7506f2db
6
+ metadata.gz: 189f8019f4e991a5751ffc4ce591db7b4d6d13eaf3084a13a329af990f1611fff6f8512b66dbdbe8effeb6cb69d1e8a883d3a3ce1e1d84aaa54764db4d0d42b0
7
+ data.tar.gz: 4dd0cc776f8c175cd2a239d4fe2f72f2bb3e3466b6073aec96f3bcc37f740c1a03db9e503f3a9230a3f490fb249bbf7af390015bfc77a37ef69a6abd2d602dba
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## [0.1.13] - 2022-10-03
2
+ - Clean empty folders by default
3
+
1
4
  ## [0.1.12] - 2022-09-06
2
5
  - Handle encoding error
3
6
 
data/Gemfile.lock CHANGED
@@ -1,26 +1,26 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rpdoc (0.1.11)
4
+ rpdoc (0.1.13)
5
5
  json_requester (~> 1.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- actionpack (6.1.4.1)
11
- actionview (= 6.1.4.1)
12
- activesupport (= 6.1.4.1)
10
+ actionpack (6.1.7)
11
+ actionview (= 6.1.7)
12
+ activesupport (= 6.1.7)
13
13
  rack (~> 2.0, >= 2.0.9)
14
14
  rack-test (>= 0.6.3)
15
15
  rails-dom-testing (~> 2.0)
16
16
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
17
- actionview (6.1.4.1)
18
- activesupport (= 6.1.4.1)
17
+ actionview (6.1.7)
18
+ activesupport (= 6.1.7)
19
19
  builder (~> 3.1)
20
20
  erubi (~> 1.4)
21
21
  rails-dom-testing (~> 2.0)
22
22
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
23
- activesupport (6.1.4.1)
23
+ activesupport (6.1.7)
24
24
  concurrent-ruby (~> 1.0, >= 1.0.2)
25
25
  i18n (>= 1.6, < 2)
26
26
  minitest (>= 5.1)
@@ -29,81 +29,83 @@ GEM
29
29
  ast (2.4.2)
30
30
  builder (3.2.4)
31
31
  coderay (1.1.3)
32
- concurrent-ruby (1.1.9)
32
+ concurrent-ruby (1.1.10)
33
33
  crass (1.0.6)
34
- diff-lcs (1.4.4)
35
- erubi (1.10.0)
36
- faraday (2.3.0)
37
- faraday-net_http (~> 2.0)
34
+ diff-lcs (1.5.0)
35
+ erubi (1.11.0)
36
+ faraday (2.5.2)
37
+ faraday-net_http (>= 2.0, < 3.1)
38
38
  ruby2_keywords (>= 0.0.4)
39
- faraday-net_http (2.0.3)
40
- i18n (1.8.10)
39
+ faraday-net_http (3.0.0)
40
+ i18n (1.12.0)
41
41
  concurrent-ruby (~> 1.0)
42
- json_requester (1.0.7)
42
+ json (2.6.2)
43
+ json_requester (1.0.8)
43
44
  faraday (>= 1.0.0)
44
- loofah (2.12.0)
45
+ loofah (2.19.0)
45
46
  crass (~> 1.0.2)
46
47
  nokogiri (>= 1.5.9)
47
48
  method_source (1.0.0)
48
- minitest (5.14.4)
49
- nokogiri (1.12.5-x86_64-darwin)
49
+ minitest (5.16.3)
50
+ nokogiri (1.13.8-x86_64-darwin)
50
51
  racc (~> 1.4)
51
- parallel (1.21.0)
52
- parser (3.0.2.0)
52
+ parallel (1.22.1)
53
+ parser (3.1.2.1)
53
54
  ast (~> 2.4.1)
54
55
  pry (0.14.1)
55
56
  coderay (~> 1.1)
56
57
  method_source (~> 1.0)
57
58
  racc (1.6.0)
58
- rack (2.2.3)
59
- rack-test (1.1.0)
60
- rack (>= 1.0, < 3)
59
+ rack (2.2.4)
60
+ rack-test (2.0.2)
61
+ rack (>= 1.3)
61
62
  rails-dom-testing (2.0.3)
62
63
  activesupport (>= 4.2.0)
63
64
  nokogiri (>= 1.6)
64
- rails-html-sanitizer (1.4.2)
65
+ rails-html-sanitizer (1.4.3)
65
66
  loofah (~> 2.3)
66
- railties (6.1.4.1)
67
- actionpack (= 6.1.4.1)
68
- activesupport (= 6.1.4.1)
67
+ railties (6.1.7)
68
+ actionpack (= 6.1.7)
69
+ activesupport (= 6.1.7)
69
70
  method_source
70
- rake (>= 0.13)
71
+ rake (>= 12.2)
71
72
  thor (~> 1.0)
72
- rainbow (3.0.0)
73
+ rainbow (3.1.1)
73
74
  rake (13.0.6)
74
- regexp_parser (2.1.1)
75
+ regexp_parser (2.6.0)
75
76
  rexml (3.2.5)
76
- rspec (3.10.0)
77
- rspec-core (~> 3.10.0)
78
- rspec-expectations (~> 3.10.0)
79
- rspec-mocks (~> 3.10.0)
80
- rspec-core (3.10.1)
81
- rspec-support (~> 3.10.0)
82
- rspec-expectations (3.10.1)
77
+ rspec (3.11.0)
78
+ rspec-core (~> 3.11.0)
79
+ rspec-expectations (~> 3.11.0)
80
+ rspec-mocks (~> 3.11.0)
81
+ rspec-core (3.11.0)
82
+ rspec-support (~> 3.11.0)
83
+ rspec-expectations (3.11.1)
83
84
  diff-lcs (>= 1.2.0, < 2.0)
84
- rspec-support (~> 3.10.0)
85
- rspec-mocks (3.10.2)
85
+ rspec-support (~> 3.11.0)
86
+ rspec-mocks (3.11.1)
86
87
  diff-lcs (>= 1.2.0, < 2.0)
87
- rspec-support (~> 3.10.0)
88
- rspec-support (3.10.2)
89
- rubocop (1.22.3)
88
+ rspec-support (~> 3.11.0)
89
+ rspec-support (3.11.1)
90
+ rubocop (1.36.0)
91
+ json (~> 2.3)
90
92
  parallel (~> 1.10)
91
- parser (>= 3.0.0.0)
93
+ parser (>= 3.1.2.1)
92
94
  rainbow (>= 2.2.2, < 4.0)
93
95
  regexp_parser (>= 1.8, < 3.0)
94
- rexml
95
- rubocop-ast (>= 1.12.0, < 2.0)
96
+ rexml (>= 3.2.5, < 4.0)
97
+ rubocop-ast (>= 1.20.1, < 2.0)
96
98
  ruby-progressbar (~> 1.7)
97
99
  unicode-display_width (>= 1.4.0, < 3.0)
98
- rubocop-ast (1.12.0)
99
- parser (>= 3.0.1.1)
100
+ rubocop-ast (1.21.0)
101
+ parser (>= 3.1.1.0)
100
102
  ruby-progressbar (1.11.0)
101
103
  ruby2_keywords (0.0.5)
102
- thor (1.1.0)
103
- tzinfo (2.0.4)
104
+ thor (1.2.1)
105
+ tzinfo (2.0.5)
104
106
  concurrent-ruby (~> 1.0)
105
- unicode-display_width (2.1.0)
106
- zeitwerk (2.5.1)
107
+ unicode-display_width (2.3.0)
108
+ zeitwerk (2.6.1)
107
109
 
108
110
  PLATFORMS
109
111
  x86_64-darwin-19
data/README.md CHANGED
@@ -72,6 +72,10 @@ Rpdoc.configure do |config|
72
72
  # (Optional) Auto push collection to Postman server or not.
73
73
  config.rpdoc_auto_push = false
74
74
 
75
+ # (Optional) Clean empty folders. You can specify folder names which will be ignored when cleaning.
76
+ config.rpdoc_clean_empty_folders = true
77
+ config.rpdoc_clean_empty_folders_except = []
78
+
75
79
  # (Optional) Auto push strategy, including :push_and_create and :push_and_update
76
80
  config.rpdoc_auto_push_strategy = :push_and_create
77
81
  end
data/VERSION.md CHANGED
@@ -1 +1 @@
1
- 0.1.12
1
+ 0.1.13
@@ -35,6 +35,10 @@ Rpdoc.configure do |config|
35
35
  # (Optional) Filename to store RSpec collection json data.
36
36
  # config.rpdoc_collection_filename = 'collection.json'
37
37
 
38
+ # (Optional) Clean empty folders. You can specify folder names which will be ignored when cleaning.
39
+ # config.rpdoc_clean_empty_folders = true
40
+ # config.rpdoc_clean_empty_folders_except = []
41
+
38
42
  # (Optional) Auto push collection to Postman server or not.
39
43
  # config.rpdoc_auto_push = false
40
44
 
@@ -19,6 +19,8 @@ module Rpdoc
19
19
  :rpdoc_request_filename,
20
20
  :rpdoc_description_filename,
21
21
  :rpdoc_collection_filename,
22
+ :rpdoc_clean_empty_folders,
23
+ :rpdoc_clean_empty_folders_except,
22
24
  :rpdoc_auto_push,
23
25
  :rpdoc_auto_push_strategy
24
26
 
@@ -41,6 +43,10 @@ module Rpdoc
41
43
  @rpdoc_request_filename = 'request.json'
42
44
  @rpdoc_description_filename = 'description.md'
43
45
  @rpdoc_collection_filename = 'collection.json'
46
+
47
+ @rpdoc_clean_empty_folders = true
48
+ @rpdoc_clean_empty_folders_except = []
49
+
44
50
  @rpdoc_auto_push = false
45
51
  @rpdoc_auto_push_strategy = :push_and_create # or :push_and_update
46
52
  end
@@ -10,6 +10,7 @@ module Rpdoc
10
10
  @requester = JsonRequester.new(@configuration.postman_host)
11
11
 
12
12
  @data = generated_collection_data
13
+ clean_empty_folders_from(@data[:collection][:item])
13
14
  end
14
15
 
15
16
  def push_and_create
@@ -29,6 +30,7 @@ module Rpdoc
29
30
  remote_collection_data = remote_collection_data['status'] == 200 ? remote_collection_data.deep_symbolize_keys.slice(:collection) : nil
30
31
 
31
32
  merged_by(remote_collection_data)
33
+ clean_empty_folders_from(remote_collection_data[:collection][:item])
32
34
  @requester.http_send(:put, path, remote_collection_data, headers)
33
35
  end
34
36
 
@@ -94,7 +96,7 @@ module Rpdoc
94
96
  if item.has_key?(:item)
95
97
  clean_generated_responses_from(item[:item])
96
98
  elsif item.has_key?(:response)
97
- item[:response] = item[:response].reject do |response|
99
+ item[:response].reject! do |response|
98
100
  response.dig(:header)&.pluck(:key)&.include?('RSpec-Location')
99
101
  end
100
102
  end
@@ -130,5 +132,15 @@ module Rpdoc
130
132
  end
131
133
  end
132
134
  end
135
+
136
+ def clean_empty_folders_from(collection_items)
137
+ return unless @configuration.rpdoc_clean_empty_folders
138
+ collection_items.reject! do |item|
139
+ next false if item.has_key?(:request)
140
+ next false if @configuration.rpdoc_clean_empty_folders_except.include?(item[:name])
141
+ clean_empty_folders_from(item[:item]) if item[:item].present?
142
+ item[:item].nil? || item[:item].empty?
143
+ end
144
+ end
133
145
  end
134
146
  end
@@ -45,7 +45,7 @@ module Rpdoc
45
45
  originalRequest: original_request_data,
46
46
  status: @rspec_response.status.to_s,
47
47
  code: @rspec_response.code.to_i,
48
- _postman_previewlanguage: "json",
48
+ _postman_previewlanguage: 'json',
49
49
  header: headers,
50
50
  }
51
51
  if @rspec_response.headers['Content-Type'].include?('application/json')
data/lib/rpdoc/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Rpdoc
4
- VERSION = "0.1.12"
4
+ VERSION = "0.1.13"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rpdoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.12
4
+ version: 0.1.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - yuntai
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-09-07 00:00:00.000000000 Z
11
+ date: 2022-10-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json_requester