dragnet 5.2.1

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.
Files changed (86) hide show
  1. checksums.yaml +7 -0
  2. data/.github/workflows/release.yml +45 -0
  3. data/.github/workflows/ruby-linters.yml +41 -0
  4. data/.github/workflows/ruby-tests.yml +38 -0
  5. data/.github/workflows/sphinx-doc.yml +79 -0
  6. data/.gitignore +13 -0
  7. data/.reek.yml +15 -0
  8. data/.rspec +3 -0
  9. data/.rubocop.yml +14 -0
  10. data/.ruby-version +1 -0
  11. data/.travis.yml +6 -0
  12. data/CHANGELOG.md +178 -0
  13. data/Gemfile +18 -0
  14. data/README.md +119 -0
  15. data/Rakefile +8 -0
  16. data/bin/console +14 -0
  17. data/bin/setup +8 -0
  18. data/default.reek +7 -0
  19. data/dragnet.gemspec +39 -0
  20. data/exe/dragnet +9 -0
  21. data/lib/dragnet/base_repository.rb +69 -0
  22. data/lib/dragnet/cli/base.rb +72 -0
  23. data/lib/dragnet/cli/logger.rb +72 -0
  24. data/lib/dragnet/cli/master.rb +173 -0
  25. data/lib/dragnet/cli.rb +8 -0
  26. data/lib/dragnet/errors/error.rb +8 -0
  27. data/lib/dragnet/errors/file_not_found_error.rb +11 -0
  28. data/lib/dragnet/errors/incompatible_repository_error.rb +10 -0
  29. data/lib/dragnet/errors/missing_timestamp_attribute_error.rb +11 -0
  30. data/lib/dragnet/errors/no_mtr_files_found_error.rb +11 -0
  31. data/lib/dragnet/errors/not_a_repository_error.rb +11 -0
  32. data/lib/dragnet/errors/repo_path_not_found_error.rb +10 -0
  33. data/lib/dragnet/errors/unable_to_write_report_error.rb +11 -0
  34. data/lib/dragnet/errors/unknown_export_format_error.rb +11 -0
  35. data/lib/dragnet/errors/validation_error.rb +11 -0
  36. data/lib/dragnet/errors/yaml_format_error.rb +9 -0
  37. data/lib/dragnet/errors.rb +9 -0
  38. data/lib/dragnet/explorer.rb +103 -0
  39. data/lib/dragnet/exporter.rb +130 -0
  40. data/lib/dragnet/exporters/exporter.rb +29 -0
  41. data/lib/dragnet/exporters/html_exporter.rb +158 -0
  42. data/lib/dragnet/exporters/id_generator.rb +35 -0
  43. data/lib/dragnet/exporters/json_exporter.rb +34 -0
  44. data/lib/dragnet/exporters/serializers/repo_serializer.rb +40 -0
  45. data/lib/dragnet/exporters/serializers/test_record_serializer.rb +101 -0
  46. data/lib/dragnet/exporters/serializers/verification_result_serializer.rb +34 -0
  47. data/lib/dragnet/exporters/serializers.rb +12 -0
  48. data/lib/dragnet/exporters/templates/template.html.erb +518 -0
  49. data/lib/dragnet/exporters.rb +13 -0
  50. data/lib/dragnet/helpers/repository_helper.rb +27 -0
  51. data/lib/dragnet/multi_repository.rb +48 -0
  52. data/lib/dragnet/repo.rb +31 -0
  53. data/lib/dragnet/repository.rb +77 -0
  54. data/lib/dragnet/test_record.rb +91 -0
  55. data/lib/dragnet/validator.rb +79 -0
  56. data/lib/dragnet/validators/data_validator.rb +75 -0
  57. data/lib/dragnet/validators/entities/repo_validator.rb +31 -0
  58. data/lib/dragnet/validators/entities/test_record_validator.rb +93 -0
  59. data/lib/dragnet/validators/entities.rb +12 -0
  60. data/lib/dragnet/validators/fields/description_validator.rb +24 -0
  61. data/lib/dragnet/validators/fields/field_validator.rb +69 -0
  62. data/lib/dragnet/validators/fields/files_validator.rb +29 -0
  63. data/lib/dragnet/validators/fields/id_validator.rb +36 -0
  64. data/lib/dragnet/validators/fields/meta_data_field_validator.rb +36 -0
  65. data/lib/dragnet/validators/fields/path_validator.rb +22 -0
  66. data/lib/dragnet/validators/fields/repos_validator.rb +62 -0
  67. data/lib/dragnet/validators/fields/result_validator.rb +33 -0
  68. data/lib/dragnet/validators/fields/sha1_validator.rb +42 -0
  69. data/lib/dragnet/validators/fields.rb +17 -0
  70. data/lib/dragnet/validators/files_validator.rb +85 -0
  71. data/lib/dragnet/validators/repos_validator.rb +74 -0
  72. data/lib/dragnet/validators/validator.rb +20 -0
  73. data/lib/dragnet/validators.rb +12 -0
  74. data/lib/dragnet/verification_result.rb +125 -0
  75. data/lib/dragnet/verifier.rb +64 -0
  76. data/lib/dragnet/verifiers/changes_verifier.rb +70 -0
  77. data/lib/dragnet/verifiers/files_verifier.rb +51 -0
  78. data/lib/dragnet/verifiers/repos_verifier.rb +92 -0
  79. data/lib/dragnet/verifiers/repository_verifier.rb +27 -0
  80. data/lib/dragnet/verifiers/result_verifier.rb +32 -0
  81. data/lib/dragnet/verifiers/test_record_verifier.rb +85 -0
  82. data/lib/dragnet/verifiers/verifier.rb +37 -0
  83. data/lib/dragnet/verifiers.rb +8 -0
  84. data/lib/dragnet/version.rb +5 -0
  85. data/lib/dragnet.rb +18 -0
  86. metadata +190 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 7177866129e2b2cb8c97959e4f7e5a0e941b0340ebf1393e7a20686f622dc959
4
+ data.tar.gz: 44e3f7af2a4addcc979a13a9347b12570aa58d592b7f85c2abfb4a84472ad399
5
+ SHA512:
6
+ metadata.gz: e133e064b292f6f3dca7dfd72d952ea5f711d218d7d8b9112b3013e38d76332860f63c5e88111ecc22768f0fb24ed69504f329d0e5e7c818e1286a7ab09c2368
7
+ data.tar.gz: eb08afc58a6ac940f559a8fd28771644d2e28d6b3be3e373c2b1a1831c1de076a176c924a1dacf153d564591807337c74c949179ebd5b5797886c3a9dfd68312
@@ -0,0 +1,45 @@
1
+ name: Release and Deploy
2
+
3
+ on:
4
+ push:
5
+ branches: [ "master" ]
6
+ paths:
7
+ - lib/dragnet/version.rb
8
+
9
+ jobs:
10
+ build:
11
+ name: Build & Deploy
12
+ runs-on: ubuntu-latest
13
+ permissions:
14
+ contents: write # Needed to create the tag and the release
15
+ id-token: write # Needed to push to rubygems.org as a trusted publisher
16
+ environment: release
17
+
18
+ steps:
19
+ - uses: actions/checkout@v4
20
+ - name: Set up Ruby 2.7
21
+ uses: ruby/setup-ruby@55283cc23133118229fd3f97f9336ee23a179fcf # v1.146.0
22
+ with:
23
+ ruby-version: 2.7.7
24
+ - name: Build
25
+ run: |
26
+ bundler install
27
+ rake clobber
28
+ rake build
29
+ - name: Get Version
30
+ run: |
31
+ echo "GEM_VERSION=$(bundler exec ruby -e 'require "dragnet/version"; print Dragnet::VERSION')" | tee -a $GITHUB_ENV
32
+ - name: Create Release
33
+ env:
34
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Github Actions
35
+ TAG_NAME: ${{ env.GEM_VERSION }}
36
+ NOTES: "[Changelog](${{ github.server_url }}/${{ github.repository }}/blob/${{ env.GEM_VERSION }}/CHANGELOG.md)"
37
+ TITLE: Release ${{ env.GEM_VERSION }}
38
+ TARGET: ${{ github.ref_name }}
39
+ run: |
40
+ gh release create $TAG_NAME --notes "$NOTES" --title "$TITLE" --target $TARGET pkg/dragnet-*.gem
41
+ - name: Configure trusted publishing credentials
42
+ uses: rubygems/configure-rubygems-credentials@v1.0.0
43
+ - name: Deploy
44
+ run: |
45
+ gem push pkg/dragnet-*.gem
@@ -0,0 +1,41 @@
1
+ # This workflow runs Rubocop on the Pull Requests to make sure no linter warnings slip by.
2
+
3
+ name: Ruby Linters
4
+
5
+ on:
6
+ pull_request:
7
+ branches: [ "master" ]
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ jobs:
13
+ lint:
14
+
15
+ runs-on: ubuntu-latest
16
+
17
+ env:
18
+ BUNDLE_ONLY: linting
19
+
20
+ steps:
21
+ - uses: actions/checkout@v4
22
+ - name: Set up Ruby
23
+ uses: ruby/setup-ruby@v1
24
+ with:
25
+ ruby-version: '2.7'
26
+ - name: Install Gems
27
+ run: |
28
+ bundler install
29
+ - name: Run Rubocop
30
+ continue-on-error: true
31
+ uses: reviewdog/action-rubocop@v2.19.1
32
+ with:
33
+ skip_install: true
34
+ rubocop_version: gemfile
35
+ rubocop_extensions: rubocop-rspec:gemfile
36
+ use_bundler: true
37
+ - name: reek
38
+ continue-on-error: true
39
+ uses: reviewdog/action-reek@v1
40
+ with:
41
+ reek_version: gemfile
@@ -0,0 +1,38 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: Ruby
9
+
10
+ on:
11
+ push:
12
+ branches: [ "master" ]
13
+ pull_request:
14
+ branches: [ "master" ]
15
+
16
+ permissions:
17
+ contents: read
18
+
19
+ jobs:
20
+ test:
21
+
22
+ runs-on: ubuntu-latest
23
+ strategy:
24
+ matrix:
25
+ ruby-version: ['2.7']
26
+
27
+ steps:
28
+ - uses: actions/checkout@v4
29
+ - name: Set up Ruby
30
+ # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
31
+ # change this to (see https://github.com/ruby/setup-ruby#versioning):
32
+ # uses: ruby/setup-ruby@v1
33
+ uses: ruby/setup-ruby@55283cc23133118229fd3f97f9336ee23a179fcf # v1.146.0
34
+ with:
35
+ ruby-version: ${{ matrix.ruby-version }}
36
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
37
+ - name: Run tests
38
+ run: bundle exec rspec --format documentation
@@ -0,0 +1,79 @@
1
+ # This workflow will generate the Sphinx documentation
2
+
3
+ name: Sphinx Documentation
4
+
5
+ on:
6
+ push:
7
+ branches: [ "master" ]
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ jobs:
13
+ build:
14
+
15
+ runs-on: ubuntu-latest
16
+
17
+ env:
18
+ COVERAGE: true
19
+
20
+ steps:
21
+ - uses: actions/checkout@v4
22
+ - name: Set up Ruby
23
+ # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
24
+ # change this to (see https://github.com/ruby/setup-ruby#versioning):
25
+ # uses: ruby/setup-ruby@v1
26
+ uses: ruby/setup-ruby@55283cc23133118229fd3f97f9336ee23a179fcf # v1.146.0
27
+ with:
28
+ ruby-version: 2.7.7
29
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
30
+ - name: Test Results and Coverage
31
+ run:
32
+ bundler exec rspec --format html -o documentation/build/html/test_results/index.html
33
+ - name: Move Coverage Report
34
+ run:
35
+ mv coverage documentation/build/html/coverage
36
+ - name: Static Analysis Report
37
+ run:
38
+ bundler exec rubocop . --format html -o documentation/build/html/static_code_analysis/index.html || true
39
+ - name: Generate YARD documentation
40
+ run: |
41
+ bundler exec yard doc . --exclude vendor/ -o documentation/build/html/yard
42
+ - name: Install pandoc
43
+ run: |
44
+ sudo apt-get update
45
+ sudo apt-get -y install pandoc
46
+ - name: Convert README
47
+ run: |
48
+ pandoc CHANGELOG.md --from markdown --to rst -s -o documentation/source/introduction/changelog.rst
49
+ - name: Set up Python 3.10
50
+ uses: actions/setup-python@v3
51
+ with:
52
+ python-version: "3.10"
53
+ - name: Install dependencies
54
+ working-directory: ./documentation
55
+ run: |
56
+ python -m pip install --upgrade pip
57
+ pip install -r requirements.txt
58
+ - name: Generate Documentation
59
+ working-directory: ./documentation
60
+ run: |
61
+ make html
62
+ - name: Upload static files as artifact
63
+ uses: actions/upload-pages-artifact@v3
64
+ with:
65
+ path: documentation/build/html/
66
+
67
+ deploy:
68
+ permissions:
69
+ contents: read
70
+ pages: write
71
+ id-token: write
72
+ runs-on: ubuntu-latest
73
+ needs: build
74
+ environment:
75
+ name: github-pages
76
+ url: ${{steps.deployment.outputs.page_url}}
77
+ steps:
78
+ - name: Deploy to GitHub Pages
79
+ uses: actions/deploy-pages@v4
data/.gitignore ADDED
@@ -0,0 +1,13 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
12
+
13
+ /Gemfile.lock
data/.reek.yml ADDED
@@ -0,0 +1,15 @@
1
+ ### Generic smell configuration
2
+
3
+ detectors:
4
+ TooManyInstanceVariables:
5
+ max_instance_variables: 10
6
+ TooManyStatements:
7
+ max_statements: 10
8
+ DuplicateMethodCall:
9
+ max_calls: 3
10
+ NestedIterators:
11
+ max_allowed_nesting: 2
12
+ UncommunicativeVariableName:
13
+ accept: [_, e]
14
+ LongParameterList:
15
+ max_params: 5
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,14 @@
1
+ AllCops:
2
+ Exclude:
3
+ - vendor/**/*
4
+ - spec/spec_helper.rb
5
+ Metrics/BlockLength:
6
+ Exclude:
7
+ - spec/**/*
8
+ Metrics/LineLength:
9
+ Max: 120
10
+ Metrics/MethodLength:
11
+ Max: 15
12
+ Style/FrozenStringLiteralComment:
13
+ Exclude:
14
+ - bin/console
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.7.7
data/.travis.yml ADDED
@@ -0,0 +1,6 @@
1
+ ---
2
+ language: ruby
3
+ cache: bundler
4
+ rvm:
5
+ - 2.6.3
6
+ before_install: gem install bundler -v 2.1.4
data/CHANGELOG.md ADDED
@@ -0,0 +1,178 @@
1
+ # Changelog
2
+ All notable changes to this project will be documented in this file.
3
+
4
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
+
7
+ Please mark backwards incompatible changes with an exclamation mark at the start.
8
+
9
+ ## [Unreleased]
10
+
11
+ ## [5.2.1] - 2024-11-13
12
+
13
+ ### Fixed
14
+ - Made the date/time format used for the `started_at` and `finished_at`
15
+ attributes in the exported JSON files stable.
16
+
17
+ ## [5.2.0] - 2024-04-16
18
+
19
+ ### Added
20
+ - The JSON file produced when the `-e` CLI switch is given now includes:
21
+ - The `started_at`, `finished_at` and `runtime` attributes under the
22
+ `verification_result` structure.
23
+ - A copy of the `started_at` and `finished_at` attributes directly in each of
24
+ the exported objects (This is being added temporarily for
25
+ backwards-compatibility reasons and will be removed later).
26
+
27
+ ## [5.1.2] - 2023-12-11
28
+
29
+ ### Fixed
30
+ - Fixed the rendering of array-type Test Record IDs in the HTML report. They are
31
+ no longer directly rendered with the extra characters added by Ruby's default
32
+ `#to_s` method.
33
+ - Fixed a `NoMethodError` that appeared after the release of ActiveSupport 7.1.
34
+
35
+ ## [5.1.1] - 2023-07-14
36
+
37
+ ### Fixed
38
+ - Fixed an issue that caused the validation to fail when the listed files or
39
+ glob patterns had a `/` at the beginning.
40
+
41
+ ## [5.1.0] - 2023-07-13
42
+
43
+ ### Added
44
+ - The `Explorer` class will now log all the found MTR files.
45
+
46
+ ## [5.0.1] - 2023-06-05
47
+
48
+ ### Fixed
49
+ - Fixed a bug where the validated and transformed meta-data did not get assigned
50
+ to the TestRecord. This, in turn, caused issues when rendering the HTML report
51
+ since it assumes that these attributes will be arrays.
52
+
53
+ ## [5.0.0] - 2023-05-26
54
+
55
+ ### Changed
56
+ - ! Updated `activesupport` from `~> 6` to `~> 7`
57
+ - ! Set the minimum Ruby version for the project to `2.7.0`
58
+
59
+ ## [4.0.0] - 2023-05-24
60
+
61
+ ### Changed
62
+ - The "Tester name" attribute will only be visible in the HTML report when the
63
+ MTR has a value in the `name` field.
64
+ - The `name` attribute of the MTRs will now be validated, only strings and
65
+ arrays of strings are allowed now.
66
+
67
+ ### Added
68
+ - Added the `test_method` and `tc_derivation_method` fields to the JSON and
69
+ HTML exports.
70
+ - Added the `MetaDataFieldValidator` class.
71
+ - Added the `test_method` and `tc_derivation_method` attributes to the
72
+ `TestRecord` class.
73
+ - Added validation for the `test_method` and `tc_derivation_method` attributes
74
+ of the MTRs, they can only have strings or arrays of strings.
75
+
76
+ ## [3.0.0] - 2023-04-05
77
+
78
+ ### Added
79
+ - Added the `Exporters::IDGenerator` class.
80
+ - Added the `DescriptionValidator` class.
81
+
82
+ ### Changed
83
+ - Changed the `JSONExporter` class. It now makes use of the `IDGenerator` class
84
+ to attach a unique ID to each of the exported MTRs.
85
+ - Added validation for the `descriptionn` field of the MTRs. Only Strings are
86
+ allowed now.
87
+
88
+ ## [2.3.0] - 2023-03-31
89
+
90
+ ### Added
91
+ - Added a `rescue` to the `software_branches` method in the `HTMLExporter` class
92
+ to keep it from crashing when it cannot read the branches from one of the
93
+ repositories.
94
+
95
+ ## [2.2.0] - 2023-03-08
96
+
97
+ ### Changed
98
+ - Moved the `repo_base` and `relative_to_repo` methods from the `HTMLExporter`
99
+ class to the `RepositoryHelper` module.
100
+ - Moved the `initialize` method from the `HTMLExporter` class down to the parent
101
+ `Exporter` class.
102
+ - Changed the `Exporter` class to allow it to export results to JSON format.
103
+
104
+ ## [2.1.2] - 2023-01-12
105
+
106
+ ### Fixed
107
+ - Fixed a bug that caused the verification to pass in multi-repo set-ups even
108
+ when there were changes in the listed files when `.` was given as a path to
109
+ the `check` command.
110
+
111
+ ## [2.1.1] - 2022-12-22
112
+
113
+ ### Fixed
114
+ - Fixed an issue with how the file names were being displayed in the HTML report
115
+ when the repository's path was the current working directory: (`.`).
116
+
117
+ ## [2.1.0] - 2022-12-19
118
+
119
+ ### Added
120
+ - Added the `--multi-repo` command line switch. This switch tells Dragnet that
121
+ it is running in a multi-repo environment and will prevent it from assuming
122
+ that the given path is a Git repository.
123
+ - Dragnet can now recognize and validate MTR files that include the `repos`
124
+ attribute (to reference files from multiple repositories).
125
+ - Added the `branches_with` and `branches_with_head` methods to the `Repository`
126
+ class.
127
+
128
+ ## [2.0.0] - 2022-09-13
129
+
130
+ ### Changed
131
+ - Updated `activesupport` to version 6.x
132
+ - Updated `jay_api` to version 15.x
133
+ - Changed the minimum Ruby version requirement for the gem to 2.5.0
134
+
135
+ ## [1.0.0] - 2021-07-02
136
+
137
+ ### Changed
138
+ - Two new entity objects were introduced `Dragnet::TestRecord` and
139
+ `Dragnet::VerificationResult` these will be used instead of the previously
140
+ used Hashes. This allows the logic of validation and value evaluation to be
141
+ centralized.
142
+ - The validation code for the Test Records was moved from
143
+ `Dragnet::Validators::DataValidator` to the
144
+ `Dragnet::Validators::Entities::TestRecordValidator` class and to a series of
145
+ field validation classes inside the `Dragnet::Validators::Fields` module.
146
+
147
+ ### Added
148
+ - Introduced the `Dragnet::Exporter` class which handles exporting the results
149
+ of the verification process to different formats (for the moment only HTML is
150
+ available, via `Dragnet::Exporters::HTMLExporter`)
151
+ - Changed the CLI to receive the `--export` option. (Which can be given
152
+ multiple times).
153
+ - Added the `Repository` class. A thin wrapper around the Git class. It just
154
+ houses some utilitarian methods.
155
+
156
+ ## [0.1.1] - 2021-06-10
157
+
158
+ ### Removed
159
+ - Removed a stray "require 'pry'" from a file.
160
+
161
+ ### Added
162
+ - Added "require 'colorize'" for validator and verifier classes.
163
+
164
+ ## [0.1.0] - 2021-05-27
165
+
166
+ ### Added
167
+ - Basic structure of the gem
168
+ - Added the basic classes for the Gem's CLI
169
+ - Added the `Explorer` class. The class searches for Manual Test Record files
170
+ on a given path with a set of glob patterns.
171
+ - Added the `check` command to the CLI.
172
+ - Implemented the `Validator` class.
173
+ - Added `jay_api` to the development dependencies in order to be able to use
174
+ the `TestDataCollector` class.
175
+ - Adds configuration for the `TestDataCollector` class.
176
+ - Enables the collection of Test Data for releases.
177
+ - Added the `Verifier` class. The class verifies the actual test records and
178
+ checks if there have been any changes since the commit specified in the MTR.
data/Gemfile ADDED
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ # Specify your gem's dependencies in dragnet.gemspec
6
+ gemspec
7
+
8
+ gem 'pry', '~>0'
9
+ gem 'rake', '~> 12.0'
10
+ gem 'rspec', '~> 3.0'
11
+ gem 'simplecov', '~> 0.17.0'
12
+ gem 'yard', '~> 0'
13
+
14
+ group :linting do
15
+ gem 'reek', '~> 6'
16
+ gem 'rubocop', '~> 1'
17
+ gem 'rubocop-rspec', '~> 3'
18
+ end
data/README.md ADDED
@@ -0,0 +1,119 @@
1
+ # Dragnet
2
+
3
+ A gem to verify, validate and analyze MTR (Manual Test Record) files.
4
+
5
+ Provides a command line tool to perform different types of validations
6
+ on MTR files. These files are YAML files that contain information about
7
+ the performed test and the revision (commit) for which the test was
8
+ performed.
9
+
10
+ ## Why and how?
11
+
12
+ When testing software you strive to automate as much as you can. However not
13
+ everything can be tested with automated tests. Sometimes there is no way to
14
+ automate the test, in other cases the effort required to automate the test
15
+ vastly exceeds the benefits, or the automated test has a very narrow scope.
16
+
17
+ In these cases manual tests are a good alternative. But, how do you know when
18
+ you need to execute manual tests again? Do you execute them for every release?
19
+ That is certainly possible but probably not very efficient. This is where
20
+ Dragnet can help.
21
+
22
+ This is how it works:
23
+
24
+ 1. You create a Manual Test Record (MTR). In it you describe what needs to be
25
+ tested and how.
26
+ 2. You list the source files that are involved in the feature the MTR refers to.
27
+ (You can list individual files or use glob patterns).
28
+ 3. You state the SHA1 of the revision you used to perform your test last time.
29
+
30
+ *Whenever there are changes to these files Dragnet will detect them and*
31
+ *remind you that the manual test needs to be performed again.*
32
+
33
+ 4. You perform the manual test again and update the SHA1 in the MTR.
34
+
35
+ > 💡 Dragnet finishes with specific exit codes allowing you to integrate it in
36
+ > your CI pipelines.
37
+
38
+ ## Dragnet needs very little to work
39
+
40
+ Dragnet only needs Ruby and Git to work. Git is probably already part of your
41
+ toolchain and Ruby is a very flexible language. You can install it easily in
42
+ any platform or use one of the official Docker images.
43
+
44
+ ## Requirements
45
+
46
+ * Ruby >= 2.7.0 (MRI)
47
+ * Bundler >= 2.4.0
48
+ * Git >= 2.0.0
49
+
50
+ ## Setup
51
+
52
+ Clone the repository and install the dependencies by running:
53
+
54
+ ```shell
55
+ bundle install
56
+ ```
57
+
58
+ ## Running Tests
59
+
60
+ You can run the tests just by executing RSpec.
61
+
62
+ ```shell
63
+ bundle exec rspec
64
+ ```
65
+
66
+ To generate a Coverage report:
67
+
68
+ ```shell
69
+ export COVERAGE=true
70
+ rspec
71
+ ```
72
+
73
+ *The coverage report will be written to the `/coverage` path*
74
+
75
+ ## Generating Documentation
76
+
77
+ ```shell
78
+ bundle exec yard
79
+ ```
80
+
81
+ *The documentation will be generated in the `/doc` path*
82
+
83
+ ## Contributing
84
+
85
+ * This project uses [Semantic Versioning](https://semver.org/)
86
+ * This project uses a `CHANGELOG.md` file to keep track of the changes.
87
+
88
+ 1. Add your feature.
89
+ 2. While editing your code keep an eye out for Rubocop and Reek suggestions
90
+ try to keep both linters happy. 😉
91
+ 3. Write unit and integration *(desirably but not required)* tests for it.
92
+ 4. Run the tests with the coverage report generation enabled (Check the *Running
93
+ Tests section)*.
94
+ 5. Make sure your Unit Test coverage is at least 90%
95
+ 6. Run the `yard` command to generate documentation and make sure your
96
+ documentation coverage is 100% (everything should be documented)
97
+ 7. Add your features to the `CHANGELOG.md` file under the *Unreleased* section.
98
+ (Check the `CHANGELOG.md`) file for info on how to properly add the changes
99
+ there.
100
+ 8. Push your changes for code review
101
+
102
+ ### Releases
103
+
104
+ After your changes have been reviewed, approved and merged to master you need to
105
+ create a Release Pull Request
106
+
107
+ 1. Decide which type of version increase is the right one for the changes listed
108
+ in the *Unreleased* section of the `CHANGELOG.md` file. (Not only your
109
+ changes but all the changes listed there). Use the criteria outlined in the
110
+ [Semantic Versioning](https://semver.org/) documentation.
111
+ 2. Increase the version accordingly in the `lib/dragnet/version.rb` file.
112
+ 3. Create a new section in the `CHANGELOG.md` file for the version and move
113
+ the changes on the *Unreleased* section there.
114
+ 4. Create a new Pull Request for the release. Make sure to follow the following
115
+ convention for the commit message.
116
+
117
+ ```
118
+ [RELEASE] Version x.y.z
119
+ ```
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task default: :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require 'dragnet'
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require 'pry'
14
+ Pry.start
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/default.reek ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ TooManyStatements:
3
+ max_statements: 15
4
+ UncommunicativeVariableName:
5
+ accept: [_, e]
6
+ DuplicateMethodCall:
7
+ max_calls: 3
data/dragnet.gemspec ADDED
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'lib/dragnet/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'dragnet'
7
+ spec.version = Dragnet::VERSION
8
+ spec.authors = ['ESR Labs GmbH']
9
+ spec.email = ['info@esrlabs.com']
10
+
11
+ spec.summary = 'A gem to verify, validate and analyse MTR (Manual Test Record) files.'
12
+ spec.description = 'Provides a command line tool to perform different types of validations '\
13
+ 'on MTR files. These files are YAML files that contain information about '\
14
+ 'the performed test and the revision (commit) for which the test was '\
15
+ 'performed.'
16
+ spec.homepage = 'https://github.com/esrlabs/dragnet'
17
+ spec.license = 'MIT'
18
+ spec.required_ruby_version = Gem::Requirement.new('>= 2.7.0')
19
+
20
+ spec.metadata['allowed_push_host'] = 'https://rubygems.org'
21
+
22
+ spec.metadata['homepage_uri'] = spec.homepage
23
+ spec.metadata['source_code_uri'] = spec.homepage
24
+ spec.metadata['changelog_uri'] = 'https://github.com/esrlabs/dragnet/blob/master/CHANGELOG.md'
25
+
26
+ spec.add_runtime_dependency 'activesupport', '~> 7'
27
+ spec.add_runtime_dependency 'colorize', '~> 0.8'
28
+ spec.add_runtime_dependency 'git', '~> 1.8'
29
+ spec.add_runtime_dependency 'thor', '~> 1.1'
30
+
31
+ # Specify which files should be added to the gem when it is released.
32
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
33
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
34
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(documentation|req|spec)/}) }
35
+ end
36
+ spec.bindir = 'exe'
37
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
38
+ spec.require_paths = ['lib']
39
+ end
data/exe/dragnet ADDED
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ $LOAD_PATH.unshift File.join(__dir__, '..', 'lib')
5
+
6
+ require 'bundler/setup'
7
+ require 'dragnet/cli/master'
8
+
9
+ Dragnet::CLI::Master.start(ARGV)