rpdoc 0.1.1 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 72d3497d62e6af176d18871c5cc1e375cfe8582fb7f450880b0ef84b90f5d302
4
- data.tar.gz: db8a565df0f83ff24dd6d0a2f3f226dac63c17ddd20646f65d5b1dba80341a1a
3
+ metadata.gz: 92d9f7ee29c14d29e2ff89e295a3366c04cd36d1446cb03d6e5c42ec3a5847de
4
+ data.tar.gz: 5fa8e4abf8883bfa3889cdebf52c9095879d4334b83135ab635c4e23a8297c87
5
5
  SHA512:
6
- metadata.gz: 288aae7de390ecf88baa08a546d7c78d03460f2e80470a98bb26e762f6e9e2a0d8165e07f811b340cda006771a54272c78332804292a9c365145b5dad25320fc
7
- data.tar.gz: 4589ba86931cbc983b7a3dea03a4d7bf74c5285b940fb7ab249352f59d559a1172f4733b44c5fbfd37c1fcc6aa53f7ca8e4d873bed0bc8a58c9078f1e22c4a95
6
+ metadata.gz: f171a6883f585f0576c9a8522fdc392e2a17f859b7d43b62e473f4c09196c86291b2dfb80c421ec8635348f26ac649da0abb5d578b5229b8e4fe407d137113ee
7
+ data.tar.gz: 763c279f4da96585db0960eddc5181a88b14afb3d01867913018e4319c065ac812a7e85b848c186459b68dff4b2f77d230356bf7a03df2eec043b3eeb09425ac
data/.gitlab-ci.yml ADDED
@@ -0,0 +1,27 @@
1
+ stages:
2
+ - rspec
3
+ - publish
4
+
5
+ rspec:
6
+ stage: rspec
7
+ image: ruby:3.0.2
8
+ script:
9
+ - bundle install
10
+ - RPDOC_ENABLE=false rspec spec -fd
11
+ only:
12
+ - master
13
+
14
+ to_gem:
15
+ stage: publish
16
+ image: ruby:3.0.2
17
+ script:
18
+ - mkdir -p ~/.gem
19
+ - touch ~/.gem/credentials
20
+ - chmod 0600 ~/.gem/credentials
21
+ - 'printf -- "---\n:rubygems_api_key: $GEM_HOST_API_KEY\n" > ~/.gem/credentials'
22
+ - RELEASE_VERSION=$(cat VERSION.md)
23
+ - GEM_NAME=rpdoc-$RELEASE_VERSION.gem
24
+ - gem build rpdoc.gemspec
25
+ - gem push $GEM_NAME
26
+ only:
27
+ - master
data/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
- ## [Unreleased]
1
+ ## [0.1.4, 0.1.5] - 2021-12-22
2
+ - Fix rspec parsing bugs
2
3
 
3
- ## [0.1.0] - 2021-10-30
4
+ ## [0.1.3] - 2021-11-09
5
+ - Add require 'rspec/rails' if RSpec::Rails exists
6
+
7
+ ## [0.1.2] - 2021-11-04
8
+ - Add gem description
9
+ - Remove unecessary gem dependency
10
+ - Fix configuration and collection bugs
4
11
 
12
+ ## [0.1.1] - 2021-11-01
13
+ - Add configuration options
14
+
15
+ ## [0.1.0] - 2021-10-30
5
16
  - Initial release
data/Gemfile.lock CHANGED
@@ -1,31 +1,12 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rpdoc (0.1.0)
4
+ rpdoc (0.1.2)
5
5
  json_requester (~> 1.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- actioncable (6.1.4.1)
11
- actionpack (= 6.1.4.1)
12
- activesupport (= 6.1.4.1)
13
- nio4r (~> 2.0)
14
- websocket-driver (>= 0.6.1)
15
- actionmailbox (6.1.4.1)
16
- actionpack (= 6.1.4.1)
17
- activejob (= 6.1.4.1)
18
- activerecord (= 6.1.4.1)
19
- activestorage (= 6.1.4.1)
20
- activesupport (= 6.1.4.1)
21
- mail (>= 2.7.1)
22
- actionmailer (6.1.4.1)
23
- actionpack (= 6.1.4.1)
24
- actionview (= 6.1.4.1)
25
- activejob (= 6.1.4.1)
26
- activesupport (= 6.1.4.1)
27
- mail (~> 2.5, >= 2.5.4)
28
- rails-dom-testing (~> 2.0)
29
10
  actionpack (6.1.4.1)
30
11
  actionview (= 6.1.4.1)
31
12
  activesupport (= 6.1.4.1)
@@ -33,33 +14,12 @@ GEM
33
14
  rack-test (>= 0.6.3)
34
15
  rails-dom-testing (~> 2.0)
35
16
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
36
- actiontext (6.1.4.1)
37
- actionpack (= 6.1.4.1)
38
- activerecord (= 6.1.4.1)
39
- activestorage (= 6.1.4.1)
40
- activesupport (= 6.1.4.1)
41
- nokogiri (>= 1.8.5)
42
17
  actionview (6.1.4.1)
43
18
  activesupport (= 6.1.4.1)
44
19
  builder (~> 3.1)
45
20
  erubi (~> 1.4)
46
21
  rails-dom-testing (~> 2.0)
47
22
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
48
- activejob (6.1.4.1)
49
- activesupport (= 6.1.4.1)
50
- globalid (>= 0.3.6)
51
- activemodel (6.1.4.1)
52
- activesupport (= 6.1.4.1)
53
- activerecord (6.1.4.1)
54
- activemodel (= 6.1.4.1)
55
- activesupport (= 6.1.4.1)
56
- activestorage (6.1.4.1)
57
- actionpack (= 6.1.4.1)
58
- activejob (= 6.1.4.1)
59
- activerecord (= 6.1.4.1)
60
- activesupport (= 6.1.4.1)
61
- marcel (~> 1.0.0)
62
- mini_mime (>= 1.1.0)
63
23
  activesupport (6.1.4.1)
64
24
  concurrent-ruby (~> 1.0, >= 1.0.2)
65
25
  i18n (>= 1.6, < 2)
@@ -92,8 +52,6 @@ GEM
92
52
  faraday-net_http_persistent (1.2.0)
93
53
  faraday-patron (1.0.0)
94
54
  faraday-rack (1.0.0)
95
- globalid (0.5.2)
96
- activesupport (>= 5.0)
97
55
  i18n (1.8.10)
98
56
  concurrent-ruby (~> 1.0)
99
57
  json_requester (1.0.3)
@@ -101,14 +59,9 @@ GEM
101
59
  loofah (2.12.0)
102
60
  crass (~> 1.0.2)
103
61
  nokogiri (>= 1.5.9)
104
- mail (2.7.1)
105
- mini_mime (>= 0.1.1)
106
- marcel (1.0.2)
107
62
  method_source (1.0.0)
108
- mini_mime (1.1.2)
109
63
  minitest (5.14.4)
110
64
  multipart-post (2.1.1)
111
- nio4r (2.5.8)
112
65
  nokogiri (1.12.5-x86_64-darwin)
113
66
  racc (~> 1.4)
114
67
  parallel (1.21.0)
@@ -121,21 +74,6 @@ GEM
121
74
  rack (2.2.3)
122
75
  rack-test (1.1.0)
123
76
  rack (>= 1.0, < 3)
124
- rails (6.1.4.1)
125
- actioncable (= 6.1.4.1)
126
- actionmailbox (= 6.1.4.1)
127
- actionmailer (= 6.1.4.1)
128
- actionpack (= 6.1.4.1)
129
- actiontext (= 6.1.4.1)
130
- actionview (= 6.1.4.1)
131
- activejob (= 6.1.4.1)
132
- activemodel (= 6.1.4.1)
133
- activerecord (= 6.1.4.1)
134
- activestorage (= 6.1.4.1)
135
- activesupport (= 6.1.4.1)
136
- bundler (>= 1.15.0)
137
- railties (= 6.1.4.1)
138
- sprockets-rails (>= 2.0.0)
139
77
  rails-dom-testing (2.0.3)
140
78
  activesupport (>= 4.2.0)
141
79
  nokogiri (>= 1.6)
@@ -177,28 +115,18 @@ GEM
177
115
  parser (>= 3.0.1.1)
178
116
  ruby-progressbar (1.11.0)
179
117
  ruby2_keywords (0.0.5)
180
- sprockets (4.0.2)
181
- concurrent-ruby (~> 1.0)
182
- rack (> 1, < 3)
183
- sprockets-rails (3.2.2)
184
- actionpack (>= 4.0)
185
- activesupport (>= 4.0)
186
- sprockets (>= 3.0.0)
187
118
  thor (1.1.0)
188
119
  tzinfo (2.0.4)
189
120
  concurrent-ruby (~> 1.0)
190
121
  unicode-display_width (2.1.0)
191
- websocket-driver (0.7.5)
192
- websocket-extensions (>= 0.1.0)
193
- websocket-extensions (0.1.5)
194
122
  zeitwerk (2.5.1)
195
123
 
196
124
  PLATFORMS
197
125
  x86_64-darwin-19
198
126
 
199
127
  DEPENDENCIES
200
- pry
201
- rails (>= 5.0)
128
+ pry (~> 0.14.1)
129
+ railties (~> 6.1.4)
202
130
  rpdoc!
203
131
  rspec (~> 3.0)
204
132
  rubocop (~> 1.0)
data/README.md CHANGED
@@ -1 +1,133 @@
1
1
  # Rpdoc
2
+
3
+ `Rpdoc` is a simple `Postman` API documentation tool, which transforms RSpec examples to Postman collection (with json files in Postman data format stored locally).
4
+
5
+ ### Benefits
6
+ - Save time for generating Postman examples manually.
7
+ - Improve maintainability of your API documentation (easy to create/update and put it into version control with CI/CD).
8
+
9
+
10
+ ## Installation
11
+
12
+ Add `rpdoc` to your application's `Gemfile`:
13
+
14
+ ```ruby
15
+ gem 'rpdoc', '~> 0.1.2'
16
+ ```
17
+
18
+ And then install the gem:
19
+
20
+ ```bash
21
+ $ bundle install
22
+ ```
23
+
24
+ ## Configuration
25
+
26
+ `Rpdoc` should be configured manually if you want to automatically push your collection to the Postman server.
27
+
28
+ You can also run the following command to generate the configuration file for your **Rails** application.
29
+
30
+ ```bash
31
+ $ rails g rpdoc:install
32
+ ```
33
+
34
+ Rpdoc can be configured by the following options.
35
+
36
+ ```ruby
37
+ Rpdoc.configure do |config|
38
+
39
+ # (Optional) You can disable rpdoc generation process manually.
40
+ config.rpdoc_enable = true
41
+
42
+ # (Optional) Apikey for your Postman account, used if want to push collection to the Postman server.
43
+ config.postman_apikey = 'postman_apikey'
44
+
45
+ # (Optional) Workspace that your collection will be pushed to. Default your account's personal workspace.
46
+ config.collection_workspace = 'collection_workspace'
47
+
48
+ # (Optional) Your existing collection uid. Will update it when using :push_and_update push strategy.
49
+ config.collection_uid = 'collection_uid'
50
+
51
+ # (Optional) Collection name.
52
+ config.collection_name = 'Rpdoc'
53
+
54
+ # (Optional) Your Rails server API host.
55
+ config.rspec_server_host = '{{server_host}}'
56
+
57
+ # (Optional) Since Rspec generates many noisy headers, you can filter them.
58
+ config.rspec_request_allow_headers = ['User-Agent', 'Content-Type', 'Authorization']
59
+
60
+ # (Optional) Folder that Rpdoc use for json data generation and save.
61
+ config.rpdoc_root = 'rpdoc'
62
+
63
+ # (Optional) Filename to store RSpec request json data.
64
+ config.rpdoc_request_filename = 'request.json'
65
+
66
+ # (Optional) Filename to store Postman description markdown data.
67
+ config.rpdoc_description_filename = 'description.md'
68
+
69
+ # (Optional) Filename to store RSpec collection json data.
70
+ config.rpdoc_collection_filename = 'collection.json'
71
+
72
+ # (Optional) Auto push collection to Postman server or not.
73
+ config.rpdoc_auto_push = false
74
+
75
+ # (Optional) Auto push strategy, including :push_and_create and :push_and_update
76
+ config.rpdoc_auto_push_strategy = :push_and_create
77
+ end
78
+ ```
79
+
80
+ ## Usage
81
+
82
+ `Rpdoc` only supports RSpec examples with [request](https://relishapp.com/rspec/rspec-rails/docs/request-specs/request-spec) type.
83
+
84
+ 1. Include [shared_context](https://relishapp.com/rspec/rspec-core/docs/example-groups/shared-context) in your spec to make `Rpdoc` identify which examples to transform.
85
+ ```ruby
86
+ RSpec.describe 'POST /api/v1/books', type: :request do
87
+ include_context 'rpdoc'
88
+ ...
89
+ end
90
+ ```
91
+ 2. Customiz your example [metdata](https://relishapp.com/rspec/rspec-core/docs/metadata/user-defined-metadata) to generate collection data in your preferenced format.
92
+ ```ruby
93
+ it 'should return 200' do |example|
94
+ # Request identifier.
95
+ # Default is `controller.action_name`
96
+ example.metadata[:rpdoc_action_key] = 'create'
97
+
98
+ # Request name shown in Postman collection.
99
+ # Default is `controller.action_name`
100
+ example.metadata[:rpdoc_action_name] = 'Create a book.'
101
+
102
+ # Example identifier.
103
+ # Default is `controller.action_name`
104
+ example.metadata[:rpdoc_example_key] = "create_200"
105
+
106
+ # Example name shown in Postman colleciotn.
107
+ # Default is `example.metadata[:description]`
108
+ example.metadata[:rpdoc_example_name] = "Create a book success."
109
+
110
+ # Example location shown in Postman collection.
111
+ # Default is `controller.controller_path.split('/')`
112
+ example.metadata[:rpdoc_example_folders] = ['v1', 'books']
113
+
114
+ # Skip this example if you have already included shared context in the spec.
115
+ # Default is `false`.
116
+ example.metadata[:rpdoc_skip] = false
117
+ end
118
+ ```
119
+ 3. Run your specs, generate data in Postman format, and push your collection to the Postman server.
120
+ ```bash
121
+ $ rspec
122
+ ```
123
+
124
+ If you want to disable `Rpdoc` generation process manually, you can either set `rpdoc_enable = false` in configuration or just pass environment variable to rspec.
125
+ ```bash
126
+ $ RPDOC_ENABLE=false rspec
127
+ ```
128
+
129
+ 4. You can write description for your Postman collection by creating markdown files (named `description.md`) and putting each of them in corresponding location under `rpdoc` folder.
130
+
131
+ ## License
132
+
133
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/VERSION.md ADDED
@@ -0,0 +1 @@
1
+ 0.1.5
@@ -5,10 +5,10 @@ Rpdoc.configure do |config|
5
5
  # (Optional) You can disable rpdoc generation process manually.
6
6
  # config.rpdoc_enable = true
7
7
 
8
- # (Optional) Apikey for your Postman account, used if need to push.
8
+ # (Optional) Apikey for your Postman account, used if want to push collection to the Postman server.
9
9
  # config.postman_apikey = 'postman_apikey'
10
10
 
11
- # (Optional) Workspace that your collection will be push to. Default your account's personal workspace.
11
+ # (Optional) Workspace that your collection will be pushed to. Default your account's personal workspace.
12
12
  # config.collection_workspace = 'collection_workspace'
13
13
 
14
14
  # (Optional) Your existing collection uid. Will update it when using :push_and_update push strategy.
@@ -4,7 +4,7 @@ module Rpdoc
4
4
  class Configuration
5
5
  attr_reader \
6
6
  :postman_host,
7
- :postman_collection_endpoint,
7
+ :postman_collection_path,
8
8
  :collection_schema
9
9
 
10
10
  attr_accessor \
@@ -23,10 +23,10 @@ module Rpdoc
23
23
  :rpdoc_auto_push_strategy
24
24
 
25
25
  def initialize
26
- @rpdoc_enable = true
26
+ @rpdoc_enable = ENV['RPDOC_ENABLE'] != 'false'
27
27
 
28
28
  @postman_host = 'https://api.getpostman.com'
29
- @postman_collection_endpoint = "#{@postman_host}/collections"
29
+ @postman_collection_path = "/collections"
30
30
  @postman_apikey = nil
31
31
 
32
32
  @collection_workspace = nil
@@ -46,7 +46,10 @@ module Rpdoc
46
46
  end
47
47
 
48
48
  def valid?
49
- @rpdoc_enable && @rpdoc_auto_push ? !@postman_apikey.nil? : true
49
+ return true unless @rpdoc_enable && @rpdoc_auto_push
50
+ return false if @postman_apikey.nil?
51
+ return false if @rpdoc_auto_push_strategy == :push_and_update && @collection_uid.nil?
52
+ true
50
53
  end
51
54
  end
52
55
  end
data/lib/rpdoc/helper.rb CHANGED
@@ -1,20 +1,23 @@
1
1
  # frozen_string_literal: true
2
+ require 'rspec/rails' if defined?(RSpec::Rails)
2
3
 
3
4
  RSpec.configure do |config|
4
5
  config.before(:suite) do
6
+ root = Rpdoc.configuration.rpdoc_root
5
7
  if Rpdoc.configuration.rpdoc_enable
6
8
  raise StandardError.new('Configuration Invalid') unless Rpdoc.configuration.valid?
7
- Dir.glob("#{Rpdoc.configuration.rpdoc_root}/**/*.json") do |filename|
9
+ FileUtils.mkdir_p(root) unless File.exists?(root)
10
+ Dir.glob("#{root}/**/*.json") do |filename|
8
11
  File.delete(filename)
9
12
  end
10
13
  end
11
14
  end
12
15
 
13
16
  config.after(:suite) do
14
- if Rpdoc.configuration.rpdoc_enable && Rpdoc.configuration.rpdoc_auto_push
17
+ if Rpdoc.configuration.rpdoc_enable
15
18
  postman_collection = Rpdoc::PostmanCollection.new
16
19
  postman_collection.save
17
- postman_collection.send(Rpdoc.configuration.rpdoc_auto_push_strategy)
20
+ postman_collection.send(Rpdoc.configuration.rpdoc_auto_push_strategy) if Rpdoc.configuration.rpdoc_auto_push
18
21
  end
19
22
  end
20
23
  end
@@ -1,17 +1,19 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'json_requester'
4
+
3
5
  module Rpdoc
4
6
  class PostmanCollection
5
7
 
6
8
  def initialize
7
9
  @configuration = Rpdoc.configuration
8
- @requester = JsonRequester.new(Settings.kdan_service.data_center)
10
+ @requester = JsonRequester.new(@configuration.postman_host)
9
11
 
10
12
  @data = generated_collection_data
11
13
  end
12
14
 
13
15
  def push_and_create
14
- path = "#{@configuration.postman_collection_endpoint}?workspace=#{@configuration.collection_workspace}"
16
+ path = "#{@configuration.postman_collection_path}?workspace=#{@configuration.collection_workspace}"
15
17
  headers = {
16
18
  'X-Api-Key': @configuration.postman_apikey
17
19
  }
@@ -19,7 +21,7 @@ module Rpdoc
19
21
  end
20
22
 
21
23
  def push_and_update
22
- path = "#{@configuration.postman_collection_endpoint}/#{@configuration.collection_uid}"
24
+ path = "#{@configuration.postman_collection_path}/#{@configuration.collection_uid}"
23
25
  headers = {
24
26
  'X-Api-Key': @configuration.postman_apikey
25
27
  }
@@ -38,10 +40,6 @@ module Rpdoc
38
40
 
39
41
  private
40
42
 
41
- def collection_data
42
- @collection_data ||= @original_collection.present? ? @original_collection.deeper_merge(collection_from_rspec, merge_hash_arrays: true) : collection_from_rspec
43
- end
44
-
45
43
  def generated_collection_data
46
44
  {
47
45
  collection: {
@@ -86,7 +84,9 @@ module Rpdoc
86
84
 
87
85
  def merged_by(other_collection_data)
88
86
  clean_generated_responses_from(other_collection_data[:collection][:item])
89
- insert_generated_responses_into(other_collection_data[:collection][:item])
87
+
88
+ other_collection_data[:collection][:info][:description] = @data[:collection][:info][:description]
89
+ insert_generated_responses_into(other_collection_data[:collection][:item], from_collection_items: @data[:collection][:item])
90
90
  end
91
91
 
92
92
  def clean_generated_responses_from(collection_items)
@@ -101,23 +101,25 @@ module Rpdoc
101
101
  end
102
102
  end
103
103
 
104
- def insert_generated_responses_into(collection_items, from_collection_items: nil)
105
- from_collection_items ||= @data[:collection][:item]
106
-
104
+ def insert_generated_responses_into(collection_items, from_collection_items: [])
107
105
  if collection_items.empty?
108
106
  collection_items = from_collection_items.deep_dup
109
107
  else
108
+ # transform collection_items into hash, using item[:name] as key
110
109
  item_hash = {}
111
110
  collection_items.each do |item|
112
111
  item_hash[item[:name]] = item
113
112
  end
114
113
 
114
+ # insert generated responses and replace description into corresponding items based on item[:name]
115
115
  from_collection_items.each do |from_item|
116
116
  from_item_name = from_item[:name]
117
117
  if item_hash.has_key?(from_item_name)
118
118
  if from_item.has_key?(:item) && item_hash[from_item_name].has_key?(:item)
119
+ item_hash[from_item_name][:description] = from_item[:description]
119
120
  insert_generated_responses_into(item_hash[from_item_name][:item], from_collection_items: from_item[:item])
120
121
  elsif from_item.has_key?(:response) && item_hash[from_item_name].has_key?(:response)
122
+ item_hash[from_item_name][:request][:description] = from_item[:request][:description]
121
123
  item_hash[from_item_name][:response] += from_item[:response].deep_dup
122
124
  else
123
125
  collection_items << from_item.deep_dup
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'cgi'
4
+
3
5
  module Rpdoc
4
6
  class PostmanResponse
5
7
  attr_reader :data
@@ -38,15 +40,20 @@ module Rpdoc
38
40
  def response_data
39
41
  headers = @rspec_response.header.map { |key, value| {key: key, value: value} }
40
42
  headers << rspec_location_header
41
- {
43
+ data = {
42
44
  name: @rspec_example.metadata[:rpdoc_example_name],
43
45
  originalRequest: original_request_data,
44
46
  status: @rspec_response.status.to_s,
45
47
  code: @rspec_response.code.to_i,
46
48
  _postman_previewlanguage: "json",
47
49
  header: headers,
48
- body: JSON.pretty_generate(JSON.parse(@rspec_response.body))
49
50
  }
51
+ if @rspec_response.headers['Content-Type'].include?('application/json')
52
+ data[:body] = JSON.pretty_generate(JSON.parse(@rspec_response.body)) rescue nil
53
+ else
54
+ data[:body] = @rspec_response.body
55
+ end
56
+ data
50
57
  end
51
58
 
52
59
  def rspec_location_header
@@ -65,6 +72,14 @@ module Rpdoc
65
72
  value: @rspec_request.headers[header]
66
73
  }
67
74
  end.compact
75
+ query_string = @rspec_request.query_string.split('&').map do |string|
76
+ key, value = string.split('=')
77
+ {
78
+ key: key,
79
+ value: CGI.unescape(value),
80
+ text: 'text'
81
+ }
82
+ end
68
83
  @original_request_data = {
69
84
  method: @rspec_request.method,
70
85
  header: filter_headers,
@@ -72,7 +87,7 @@ module Rpdoc
72
87
  raw: "#{@configuration.rspec_server_host}#{@rspec_request.path}",
73
88
  host: [@configuration.rspec_server_host],
74
89
  path: @rspec_request.path.split('/'),
75
- variable: [],
90
+ query: query_string
76
91
  },
77
92
  body: nil
78
93
  }
@@ -0,0 +1,8 @@
1
+ namespace :rpdoc do
2
+ desc 'push collection to the Postman server'
3
+ task :push => :environment do
4
+ postman_collection = Rpdoc::PostmanCollection.new
5
+ postman_collection.save
6
+ postman_collection.send(Rpdoc.configuration.rpdoc_auto_push_strategy) if Rpdoc.configuration.rpdoc_auto_push
7
+ end
8
+ end
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.1"
4
+ VERSION = "0.1.5"
5
5
  end
data/rpdoc.gemspec CHANGED
@@ -8,18 +8,12 @@ Gem::Specification.new do |spec|
8
8
  spec.authors = ["yuntai"]
9
9
  spec.email = ["yuntai.yang@kdanmobile.com"]
10
10
 
11
- spec.summary = "A gem to transform RSpec examples to Postman collection"
12
- spec.description = "With RSpec examples, it will generate Postman collection and push to the Postman server."
13
- spec.homepage = "https://www.kdanmobile.com"
11
+ spec.summary = "RSpec to Postman Documentation Tool"
12
+ spec.description = "Rpdoc is a simple Postman API documentation tool, which transforms RSpec examples to Postman collection."
13
+ spec.homepage = "https://github.com/kdan-mobile-software-ltd/rpdoc"
14
14
  spec.license = "MIT"
15
15
  spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
16
16
 
17
- # spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
18
-
19
- spec.metadata["homepage_uri"] = spec.homepage
20
- spec.metadata["source_code_uri"] = "https://www.kdanmobile.com"
21
- spec.metadata["changelog_uri"] = "https://www.kdanmobile.com"
22
-
23
17
  # Specify which files should be added to the gem when it is released.
24
18
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
25
19
  spec.files = Dir.chdir(File.expand_path(__dir__)) do
@@ -29,15 +23,10 @@ Gem::Specification.new do |spec|
29
23
  spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
30
24
  spec.require_paths = ["lib"]
31
25
 
32
- # Uncomment to register a new dependency of your gem
33
- # spec.add_dependency "example-gem", "~> 1.0"
34
26
  spec.add_dependency 'json_requester', '~> 1.0'
35
27
 
36
- spec.add_development_dependency 'rails', '>= 5.0'
28
+ spec.add_development_dependency 'railties', '~> 6.1.4'
37
29
  spec.add_development_dependency 'rspec', '~> 3.0'
38
- spec.add_development_dependency 'pry'
30
+ spec.add_development_dependency 'pry', '~> 0.14.1'
39
31
  spec.add_development_dependency 'rubocop', '~> 1.0'
40
-
41
- # For more information and examples about making a new gem, checkout our
42
- # guide at: https://bundler.io/guides/creating_gem.html
43
32
  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.1
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - yuntai
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-11-01 00:00:00.000000000 Z
11
+ date: 2021-12-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json_requester
@@ -25,19 +25,19 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: rails
28
+ name: railties
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '5.0'
33
+ version: 6.1.4
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '5.0'
40
+ version: 6.1.4
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -56,16 +56,16 @@ dependencies:
56
56
  name: pry
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: 0.14.1
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '0'
68
+ version: 0.14.1
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rubocop
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -80,8 +80,8 @@ dependencies:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '1.0'
83
- description: With RSpec examples, it will generate Postman collection and push to
84
- the Postman server.
83
+ description: Rpdoc is a simple Postman API documentation tool, which transforms RSpec
84
+ examples to Postman collection.
85
85
  email:
86
86
  - yuntai.yang@kdanmobile.com
87
87
  executables: []
@@ -89,6 +89,7 @@ extensions: []
89
89
  extra_rdoc_files: []
90
90
  files:
91
91
  - ".gitignore"
92
+ - ".gitlab-ci.yml"
92
93
  - ".rubocop.yml"
93
94
  - CHANGELOG.md
94
95
  - Gemfile
@@ -96,6 +97,7 @@ files:
96
97
  - LICENSE.txt
97
98
  - README.md
98
99
  - Rakefile
100
+ - VERSION.md
99
101
  - bin/console
100
102
  - bin/setup
101
103
  - lib/generators/rpdoc/install_generator.rb
@@ -105,16 +107,14 @@ files:
105
107
  - lib/rpdoc/helper.rb
106
108
  - lib/rpdoc/postman_collection.rb
107
109
  - lib/rpdoc/postman_response.rb
110
+ - lib/rpdoc/rpdoc.rake
108
111
  - lib/rpdoc/version.rb
109
112
  - rpdoc.gemspec
110
- homepage: https://www.kdanmobile.com
113
+ homepage: https://github.com/kdan-mobile-software-ltd/rpdoc
111
114
  licenses:
112
115
  - MIT
113
- metadata:
114
- homepage_uri: https://www.kdanmobile.com
115
- source_code_uri: https://www.kdanmobile.com
116
- changelog_uri: https://www.kdanmobile.com
117
- post_install_message:
116
+ metadata: {}
117
+ post_install_message:
118
118
  rdoc_options: []
119
119
  require_paths:
120
120
  - lib
@@ -129,8 +129,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
129
129
  - !ruby/object:Gem::Version
130
130
  version: '0'
131
131
  requirements: []
132
- rubygems_version: 3.2.15
133
- signing_key:
132
+ rubygems_version: 3.2.22
133
+ signing_key:
134
134
  specification_version: 4
135
- summary: A gem to transform RSpec examples to Postman collection
135
+ summary: RSpec to Postman Documentation Tool
136
136
  test_files: []