dox 2.0.0.beta3 → 2.0.0

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: 19d606ce8e741ff8f4844e0a0f2bff86cda870356417fb20254dad8030865f21
4
- data.tar.gz: 3d57f29f50c860c4d5781e5990b398e984461d8b8239b3b82885d5df89fc8414
3
+ metadata.gz: c4cb190cdb908fc6f132913d43624c470ab3f495f8875fdf9b8fb311f7d9dc15
4
+ data.tar.gz: cd95ecb21307695857b2164834703c1cc2fcee8f2675721054fdde257f6b4fbf
5
5
  SHA512:
6
- metadata.gz: 3c520ed0ca05c9b2eab780ef3feef96a937277912ad97e460ded62cd4dfa2c455675a937ccb299b8776140b6f38657aacc67c3430e6c3e0004f7e2af53a20da3
7
- data.tar.gz: 7b288f580fa957a06764cc9d0df09c6fb6d914d43743b4fe58ee0666f614e96ad34cdf9a0f90069d5805fa7360e124f922d658d7c485811e5c9a3afe01ca7d3c
6
+ metadata.gz: 3c6f7b2b5497fca67e55b06fa037b0c677c4d6ec552fc117674f25b46bbb30aed430bf3290e951a2fa66b32a8280629953f341f8a3c62e76308be4145855ac0d
7
+ data.tar.gz: e8204b56a371f816da95cd240f52f04d30f6d46346111fb35ea393337c07ebdd9a3abe04190e52014613ec411efcaafcd31d2aeb094759a7b8fcf4e551b0708e
data/CHANGES.md CHANGED
@@ -9,13 +9,14 @@ Change:
9
9
  - BREAKING CHANGE Base structure is now defined in .json format
10
10
  - BREAKING CHANGE Output is written to a .json file
11
11
  - BREAKING CHANGE Html is rendered with Redoc instead of Aglio
12
- - Renamed Dox.config.desc_folder_path -> Dox.config.descriptions_location
13
- - Depricated Dox.config.header_file_path
12
+ - Renamed `Dox.config.desc_folder_path` -> `Dox.config.descriptions_location`
13
+ - Depricated `Dox.config.header_file_path`
14
+ - Removed `endpoint` method from document resource block
14
15
 
15
16
  New:
16
- - Added Dox.config.title
17
- - Added Dox.config.header_description
18
- - Added Dox.config.version
17
+ - Added `Dox.config.title`
18
+ - Added `Dox.config.header_description`
19
+ - Added `Dox.config.version`
19
20
 
20
21
  ## Version 1.2.0
21
22
 
data/README.md CHANGED
@@ -83,7 +83,6 @@ module Docs
83
83
  # define common resource data for each action
84
84
  document :api do
85
85
  resource 'Bids' do
86
- endpoint '/bids'
87
86
  group 'Bids'
88
87
  desc 'bids.md'
89
88
  end
@@ -181,7 +180,6 @@ You can omit defining the resource group, if you don't have any description for
181
180
  #### Resource
182
181
  Resource contains actions and is defined with:
183
182
  - **name** (required)
184
- - **endpoint** (required)
185
183
  - **group** (required; to associate it with the related group)
186
184
  - desc (optional; inline string or relative filepath)
187
185
 
@@ -189,7 +187,6 @@ Example:
189
187
  ``` ruby
190
188
  document :bids do
191
189
  resource 'Bids' do
192
- endpoint '/bids'
193
190
  group 'Bids'
194
191
  desc 'bids/bids.md'
195
192
  end
@@ -205,7 +202,6 @@ document :bids_common do
205
202
  end
206
203
 
207
204
  resource 'Bids' do
208
- endpoint '/bids'
209
205
  group 'Bids'
210
206
  desc 'bids/bids.md'
211
207
  end
data/dox.gemspec CHANGED
@@ -32,7 +32,7 @@ Gem::Specification.new do |spec|
32
32
  spec.add_development_dependency 'pry-rails'
33
33
  spec.add_development_dependency 'pry-stack_explorer'
34
34
  spec.add_runtime_dependency 'rails', '>= 4.0'
35
- spec.add_development_dependency 'rake', '~> 10.0'
35
+ spec.add_development_dependency 'rake'
36
36
  spec.add_development_dependency 'rspec', '~> 3.0'
37
37
  spec.add_development_dependency 'rubocop'
38
38
  spec.add_development_dependency 'simplecov'
data/lib/dox/config.rb CHANGED
@@ -8,6 +8,7 @@ module Dox
8
8
  attr_accessor :api_version
9
9
  attr_accessor :title
10
10
  attr_accessor :header_description
11
+ attr_accessor :groups_order
11
12
  attr_reader :descriptions_location
12
13
 
13
14
  def descriptions_location=(folder_path)
@@ -16,7 +16,6 @@ module Dox
16
16
 
17
17
  raise(Dox::Errors::InvalidResourceError, 'Resource name is required!') if @name.blank?
18
18
  raise(Dox::Errors::InvalidResourceError, 'Resource group is required!') if @group.blank?
19
- raise(Dox::Errors::InvalidResourceError, 'Resource endpoint is required!') if @endpoint.blank?
20
19
  end
21
20
 
22
21
  def config
@@ -24,7 +23,6 @@ module Dox
24
23
  resource_name: @name.presence,
25
24
  resource_desc: @desc.presence,
26
25
  resource_group_name: @group.presence,
27
- resource_endpoint: @endpoint.presence,
28
26
  apidoc: true
29
27
  }
30
28
  end
@@ -1,14 +1,13 @@
1
1
  module Dox
2
2
  module Entities
3
3
  class Resource
4
- attr_reader :name, :desc, :endpoint, :group
4
+ attr_reader :name, :desc, :group
5
5
  attr_accessor :actions
6
6
 
7
7
  def initialize(details)
8
8
  @name = details[:resource_name]
9
9
  @group = details[:resource_group_name]
10
10
  @desc = details[:resource_desc]
11
- @endpoint = details[:resource_endpoint]
12
11
  @actions = {}
13
12
  end
14
13
  end
@@ -15,6 +15,8 @@ module Dox
15
15
  group_printer.print(resource_group)
16
16
  end
17
17
 
18
+ order_groups
19
+
18
20
  @output.puts(JSON.pretty_generate(spec))
19
21
  end
20
22
 
@@ -42,6 +44,14 @@ module Dox
42
44
  def group_printer
43
45
  @group_printer ||= ResourceGroupPrinter.new(spec)
44
46
  end
47
+
48
+ def order_groups
49
+ return if (Dox.config.groups_order || []).empty?
50
+
51
+ spec['x-tagGroups'] = spec['x-tagGroups'].sort_by do |tag|
52
+ Dox.config.groups_order.index(tag[:name]) || 100
53
+ end
54
+ end
45
55
  end
46
56
  end
47
57
  end
data/lib/dox/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Dox
2
- VERSION = '2.0.0.beta3'.freeze
2
+ VERSION = '2.0.0'
3
3
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dox
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.beta3
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Melita Kokot
8
8
  - Vedran Hrnčić
9
- autorequire:
9
+ autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2020-11-12 00:00:00.000000000 Z
12
+ date: 2021-02-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -113,16 +113,16 @@ dependencies:
113
113
  name: rake
114
114
  requirement: !ruby/object:Gem::Requirement
115
115
  requirements:
116
- - - "~>"
116
+ - - ">="
117
117
  - !ruby/object:Gem::Version
118
- version: '10.0'
118
+ version: '0'
119
119
  type: :development
120
120
  prerelease: false
121
121
  version_requirements: !ruby/object:Gem::Requirement
122
122
  requirements:
123
- - - "~>"
123
+ - - ">="
124
124
  - !ruby/object:Gem::Version
125
- version: '10.0'
125
+ version: '0'
126
126
  - !ruby/object:Gem::Dependency
127
127
  name: rspec
128
128
  requirement: !ruby/object:Gem::Requirement
@@ -179,7 +179,7 @@ dependencies:
179
179
  - - ">="
180
180
  - !ruby/object:Gem::Version
181
181
  version: '0'
182
- description:
182
+ description:
183
183
  email:
184
184
  - melita.kokot@gmail.com
185
185
  - vrabac266@gmail.com
@@ -241,7 +241,7 @@ licenses:
241
241
  - MIT
242
242
  metadata:
243
243
  allowed_push_host: https://rubygems.org
244
- post_install_message:
244
+ post_install_message:
245
245
  rdoc_options: []
246
246
  require_paths:
247
247
  - lib
@@ -252,13 +252,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
252
252
  version: 2.0.0
253
253
  required_rubygems_version: !ruby/object:Gem::Requirement
254
254
  requirements:
255
- - - ">"
255
+ - - ">="
256
256
  - !ruby/object:Gem::Version
257
- version: 1.3.1
257
+ version: '0'
258
258
  requirements: []
259
- rubyforge_project:
260
- rubygems_version: 2.7.6.2
261
- signing_key:
259
+ rubygems_version: 3.0.3
260
+ signing_key:
262
261
  specification_version: 4
263
262
  summary: Generates API documentation for rspec in OpenAPI format.
264
263
  test_files: []