dox 2.3.0 → 2.4.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: 6a1fcae5e0c58ef6689eaede57da79f082f2207d6da123f5251d994deafbca75
4
- data.tar.gz: 9a76f7f7e8be9312d3b3e509d1acec8d9fd39aa6e4004e3a1f9f2b2475005c61
3
+ metadata.gz: 28307d7bc11d4b35d5951f89c855b98af58877cb956a8f638a8541b9358d239d
4
+ data.tar.gz: 62e8c8228e9390adc964fce294ea2c83017a1da64de73d959d30588e22010317
5
5
  SHA512:
6
- metadata.gz: 9713ae85d917e7fac673c5e3d78bf2ba3a9c04d943373b98c13c47b67dde4bf53fe5e1eec49117f919a22286120b9ffdcb47eed4bb749ff44661a039a326285d
7
- data.tar.gz: 18c023ed7556dd63095d7473d858ea577a38e75a507830359a41ef4303ac29f0690e40a3f4aa1ab63dd3d5b5321adc58262b3ac67c1a70e16d20cf84c029fd6c
6
+ metadata.gz: 05cc87faaf0602cb9f01bc3cf72ad7d4a98c3db5a331bad7380746f515eeea67f5143763f31107cb3d5aa44a884a62206f669138c0901f01090dcd4930a3199e
7
+ data.tar.gz: 85bce8dbc8b87d9244db98d449c01e7b26fce507bcdbf1eafaa454c6f554a8562bb68d5e1d949bb28f7b3dc5ac62dfc1f50b246f1619e09a36cf8d1d99aa8929
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## v2.4.0 (2024-11-21)
4
+
5
+ ### Enhancements
6
+
7
+ - Raise error in case a Resource references an MD file under `#desc` that doesn't exist
8
+
9
+
3
10
  ## v2.3.0 (2024-02-20)
4
11
 
5
12
  ### Enhancements
@@ -16,6 +16,7 @@ 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 desc #{@desc} is missing!") if desc_file_path.nil?
19
20
  end
20
21
 
21
22
  def config
@@ -26,6 +27,14 @@ module Dox
26
27
  apidoc: true
27
28
  }
28
29
  end
30
+
31
+ private
32
+
33
+ def desc_file_path
34
+ return true if @desc.nil? || !@desc.end_with?('.md')
35
+
36
+ Util::File.file_path(@desc).presence
37
+ end
29
38
  end
30
39
  end
31
40
  end
@@ -20,14 +20,9 @@ module Dox
20
20
  end
21
21
 
22
22
  def read_file(path, config_root_path: Dox.config.descriptions_location)
23
- return '' unless config_root_path
23
+ full_path = Util::File.file_path(path, config_root_path: config_root_path)
24
24
 
25
- config_root_path.each do |root_path|
26
- file_path = File.join(root_path, path)
27
- next unless File.exist?(file_path)
28
-
29
- return File.read(file_path)
30
- end
25
+ full_path.nil? ? nil : File.read(full_path)
31
26
  end
32
27
 
33
28
  def formatted_body(body_str, content_type)
@@ -0,0 +1,18 @@
1
+ module Dox
2
+ module Util
3
+ module File
4
+ def self.file_path(path, config_root_path: Dox.config.descriptions_location)
5
+ return '' unless config_root_path
6
+
7
+ config_root_path.each do |root_path|
8
+ full_path = ::File.join(root_path, path)
9
+ next unless ::File.exist?(full_path)
10
+
11
+ return full_path
12
+ end
13
+
14
+ nil
15
+ end
16
+ end
17
+ end
18
+ end
data/lib/dox/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Dox
2
- VERSION = '2.3.0'.freeze
2
+ VERSION = '2.4.0'.freeze
3
3
  end
data/lib/dox.rb CHANGED
@@ -32,6 +32,7 @@ require 'dox/printers/example_response_printer'
32
32
  require 'dox/printers/resource_group_printer'
33
33
  require 'dox/printers/resource_printer'
34
34
  require 'dox/util/http'
35
+ require 'dox/util/file'
35
36
  require 'dox/version'
36
37
 
37
38
  module Dox
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dox
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
4
+ version: 2.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Melita Kokot
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2024-02-20 00:00:00.000000000 Z
12
+ date: 2024-11-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -234,6 +234,7 @@ files:
234
234
  - lib/dox/printers/example_response_printer.rb
235
235
  - lib/dox/printers/resource_group_printer.rb
236
236
  - lib/dox/printers/resource_printer.rb
237
+ - lib/dox/util/file.rb
237
238
  - lib/dox/util/http.rb
238
239
  - lib/dox/version.rb
239
240
  homepage: https://github.com/infinum/dox