swagcov 0.9.0 → 0.10.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 +4 -4
- data/CHANGELOG.md +23 -0
- data/README.md +22 -7
- data/exe/swagcov +27 -0
- data/lib/swagcov/dotfile.rb +2 -2
- data/lib/swagcov/options.rb +37 -0
- data/lib/swagcov/runner.rb +18 -0
- data/lib/swagcov/version.rb +1 -1
- data/lib/swagcov.rb +2 -0
- data/lib/tasks/swagcov.rake +2 -1
- metadata +8 -6
- data/lib/tasks/swagcov/generate_todo.rake +0 -8
- data/lib/tasks/swagcov/install.rake +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8f7e8120c6da2d859ae0712f523ee0586e9e800c842594ef89c7fdaed3a28ee0
|
4
|
+
data.tar.gz: c884efd95e1dc61fba493ba731633087baf546612a00a83489f3d4abc7c38cff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d000402186ba36251cbdc689374979e863dce7b23f154837eba4e177bc484de337bf4928cc8d547bd71d20b7db323ab08cc378590871b2502c72a2398b8749e6
|
7
|
+
data.tar.gz: 74144d434fd8ba835564b3fc92a9a63b318b74c438390213a9cd62cfba0705666464d3363d3d732eff05b46ddacb9105547352310ffeb7e166e5a5834efccba3
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,29 @@
|
|
2
2
|
## main (unreleased)
|
3
3
|
-
|
4
4
|
|
5
|
+
## 0.10.0 (2025-05-08)
|
6
|
+
### Enhancement
|
7
|
+
- Added executable for streamlined command line usage ([#120](https://github.com/smridge/swagcov/pull/120))
|
8
|
+
- The below options are now available:
|
9
|
+
```
|
10
|
+
swagcov
|
11
|
+
swagcov --init
|
12
|
+
swagcov --todo
|
13
|
+
swagcov --help
|
14
|
+
```
|
15
|
+
- **Note**: This is experimental as it may not work for all use cases. Use `rake swagcov` as a fallback
|
16
|
+
- Added command line options to the existing `rake swagcov` task ([#121](https://github.com/smridge/swagcov/pull/121), [#122](https://github.com/smridge/swagcov/pull/122), [#123](https://github.com/smridge/swagcov/pull/123))
|
17
|
+
- The below options are now available:
|
18
|
+
```
|
19
|
+
rake swagcov
|
20
|
+
rake swagcov -- --init
|
21
|
+
rake swagcov -- --todo
|
22
|
+
rake swagcov -- --help
|
23
|
+
```
|
24
|
+
- **Note**: This refactor involved `BREAKING CHANGES`:
|
25
|
+
- `rake swagcov:generate_todo` is now `rake swagcov -- --todo`
|
26
|
+
- `rake swagcov:install` is now `rake swagcov -- --init`
|
27
|
+
|
5
28
|
## 0.9.0 (2025-05-07)
|
6
29
|
### Enhancement
|
7
30
|
- Add support for `.json` OpenAPI file types ([#112](https://github.com/smridge/swagcov/pull/112), [#113](https://github.com/smridge/swagcov/pull/113))
|
data/README.md
CHANGED
@@ -9,17 +9,32 @@
|
|
9
9
|

|
10
10
|
[](https://coveralls.io/github/smridge/swagcov?branch=main)
|
11
11
|
|
12
|
-
|
12
|
+
OpenAPI documentation coverage report for Rails Routes.
|
13
13
|
|
14
14
|
## Usages
|
15
15
|
- See overview of different endpoints covered, missing and what you choose to ignore.
|
16
|
-
- Add pass/fail to your build pipeline when missing
|
16
|
+
- Add pass/fail to your build pipeline when missing documentation coverage.
|
17
17
|
|
18
|
-
|
19
|
-
|
|
20
|
-
|
|
21
|
-
| `rake swagcov
|
22
|
-
|
18
|
+
**Check OpenAPI documentation coverage for Rails Route endpoints**
|
19
|
+
| `executable ` | `rake task ` | `rails console ` |
|
20
|
+
| :--- | :--- | :--- |
|
21
|
+
| `swagcov` | `rake swagcov` | `Swagcov::Command::ReportCoverage.new.run` |
|
22
|
+
|
23
|
+
**Generate required `.swagcov.yml` config file**
|
24
|
+
| `executable ` | `rake task ` | `rails console ` |
|
25
|
+
| :--- | :--- | :--- |
|
26
|
+
| `swagcov --init` | `rake swagcov -- --init` | `Swagcov::Command::GenerateDotfile.new.run` |
|
27
|
+
|
28
|
+
|
29
|
+
**Generate optional `.swagcov_todo.yml` config file**
|
30
|
+
| `executable ` | `rake task ` | `rails console ` |
|
31
|
+
| :--- | :--- | :--- |
|
32
|
+
| `swagcov --todo` | `rake swagcov -- --todo` | `Swagcov::Command::GenerateTodoFile.new.run` |
|
33
|
+
|
34
|
+
**See command line usage options**
|
35
|
+
| `executable ` | `rake task ` | `rails console ` |
|
36
|
+
| :--- | :--- | :--- |
|
37
|
+
| `swagcov --help` | `rake swagcov -- --help` | n/a |
|
23
38
|
|
24
39
|
## Ruby and Rails Version Support
|
25
40
|
Versioning support from a test coverage perspective, see [tests.yml](/.github/workflows/tests.yml) for detail
|
data/exe/swagcov
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
# Experimental executable
|
5
|
+
#
|
6
|
+
# Booting rails approach should work for most applications
|
7
|
+
# Rake task option as an alternative should always work as expected
|
8
|
+
|
9
|
+
# Load logger before rails
|
10
|
+
# Fix for booting rails 6.0-7.0 apps (uninitialized constant ActiveSupport::LoggerThreadSafeLevel::Logger)
|
11
|
+
require "logger"
|
12
|
+
|
13
|
+
require "swagcov"
|
14
|
+
|
15
|
+
RAILS_APP_PATH = File.expand_path("config/application", Dir.pwd)
|
16
|
+
|
17
|
+
def boot_rails_application!
|
18
|
+
require RAILS_APP_PATH
|
19
|
+
Rails.application.initialize!
|
20
|
+
rescue LoadError, NoMethodError
|
21
|
+
warn "Unable to load Rails application, try running `rake swagcov` instead"
|
22
|
+
exit Swagcov::STATUS_ERROR
|
23
|
+
end
|
24
|
+
|
25
|
+
boot_rails_application!
|
26
|
+
|
27
|
+
Swagcov::Runner.new(args: ARGV).run
|
data/lib/swagcov/dotfile.rb
CHANGED
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
module Swagcov
|
4
4
|
class Dotfile
|
5
|
-
DEFAULT_CONFIG_FILE_NAME = ".swagcov.yml"
|
6
|
-
TODO_CONFIG_FILE_NAME = ".swagcov_todo.yml"
|
5
|
+
DEFAULT_CONFIG_FILE_NAME = ::ENV.fetch("SWAGCOV_DOTFILE", ".swagcov.yml")
|
6
|
+
TODO_CONFIG_FILE_NAME = ::ENV.fetch("SWAGCOV_TODOFILE", ".swagcov_todo.yml")
|
7
7
|
|
8
8
|
def initialize basename: DEFAULT_CONFIG_FILE_NAME, todo_basename: TODO_CONFIG_FILE_NAME, skip_todo: false
|
9
9
|
@dotfile = load_yaml(basename, required: true)
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "optparse"
|
4
|
+
|
5
|
+
module Swagcov
|
6
|
+
class Options
|
7
|
+
def initialize args: ::ARGV
|
8
|
+
@args = args
|
9
|
+
end
|
10
|
+
|
11
|
+
def define
|
12
|
+
options = {}
|
13
|
+
|
14
|
+
::OptionParser.new do |opts|
|
15
|
+
opts.banner = <<~MESSAGE
|
16
|
+
Usage:
|
17
|
+
* as executable: swagcov [options]
|
18
|
+
* as rake task: rake swagcov -- [options]
|
19
|
+
MESSAGE
|
20
|
+
|
21
|
+
opts.on("-i", "--init", "Generate required .swagcov.yml config file") do |opt|
|
22
|
+
options[:init] = opt
|
23
|
+
end
|
24
|
+
|
25
|
+
opts.on("-t", "--todo", "Generate optional .swagcov_todo.yml config file") do |opt|
|
26
|
+
options[:todo] = opt
|
27
|
+
end
|
28
|
+
end.parse!(@args)
|
29
|
+
|
30
|
+
options
|
31
|
+
rescue ::OptionParser::InvalidOption => e
|
32
|
+
warn e.message
|
33
|
+
warn "For usage information, use --help"
|
34
|
+
exit ::Swagcov::STATUS_ERROR
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Swagcov
|
4
|
+
class Runner
|
5
|
+
attr_reader :options
|
6
|
+
|
7
|
+
def initialize args: ::ARGV
|
8
|
+
@args = args
|
9
|
+
@options = ::Swagcov::Options.new(args: @args).define
|
10
|
+
end
|
11
|
+
|
12
|
+
def run
|
13
|
+
exit ::Swagcov::Command::GenerateDotfile.new.run if options[:init]
|
14
|
+
exit ::Swagcov::Command::GenerateTodoFile.new.run if options[:todo]
|
15
|
+
exit ::Swagcov::Command::ReportCoverage.new.run
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/swagcov/version.rb
CHANGED
data/lib/swagcov.rb
CHANGED
data/lib/tasks/swagcov.rake
CHANGED
@@ -2,5 +2,6 @@
|
|
2
2
|
|
3
3
|
desc "Check OpenAPI documentation coverage for Rails Route endpoints"
|
4
4
|
task swagcov: :environment do
|
5
|
-
|
5
|
+
args = ARGV.drop(2) # Remove "swagcov" and "--" to ignore standard rake arguments
|
6
|
+
Swagcov::Runner.new(args: args).run
|
6
7
|
end
|
metadata
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: swagcov
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sarah Ridge
|
8
|
-
bindir:
|
8
|
+
bindir: exe
|
9
9
|
cert_chain: []
|
10
10
|
date: 1980-01-02 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
@@ -25,13 +25,15 @@ dependencies:
|
|
25
25
|
version: '4.2'
|
26
26
|
email:
|
27
27
|
- sarahmarie@hey.com
|
28
|
-
executables:
|
28
|
+
executables:
|
29
|
+
- swagcov
|
29
30
|
extensions: []
|
30
31
|
extra_rdoc_files: []
|
31
32
|
files:
|
32
33
|
- CHANGELOG.md
|
33
34
|
- LICENSE
|
34
35
|
- README.md
|
36
|
+
- exe/swagcov
|
35
37
|
- lib/swagcov.rb
|
36
38
|
- lib/swagcov/command/generate_dotfile.rb
|
37
39
|
- lib/swagcov/command/generate_todo_file.rb
|
@@ -42,11 +44,11 @@ files:
|
|
42
44
|
- lib/swagcov/errors.rb
|
43
45
|
- lib/swagcov/formatter/console.rb
|
44
46
|
- lib/swagcov/openapi_files.rb
|
47
|
+
- lib/swagcov/options.rb
|
45
48
|
- lib/swagcov/railtie.rb
|
49
|
+
- lib/swagcov/runner.rb
|
46
50
|
- lib/swagcov/version.rb
|
47
51
|
- lib/tasks/swagcov.rake
|
48
|
-
- lib/tasks/swagcov/generate_todo.rake
|
49
|
-
- lib/tasks/swagcov/install.rake
|
50
52
|
homepage: https://github.com/smridge/swagcov
|
51
53
|
licenses:
|
52
54
|
- MIT
|
@@ -72,5 +74,5 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
72
74
|
requirements: []
|
73
75
|
rubygems_version: 3.6.8
|
74
76
|
specification_version: 4
|
75
|
-
summary: OpenAPI documentation coverage for Rails
|
77
|
+
summary: OpenAPI documentation coverage report for Rails Route endpoints
|
76
78
|
test_files: []
|