defmastership 1.0.17 → 1.0.19
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/.gitignore +1 -0
- data/.gitlab-ci.yml +37 -11
- data/Gemfile +71 -1
- data/Guardfile +44 -0
- data/Rakefile +16 -61
- data/bin/defmastership +9 -6
- data/config/cucumber.yml +3 -0
- data/config/mutant.yml +27 -3
- data/config/reek.yml +129 -105
- data/config/rubocop.yml +72 -28
- data/defmastership.gemspec +5 -13
- data/features/changeref.feature +0 -8
- data/features/definition_checksum.feature +30 -10
- data/features/definition_version.feature +168 -10
- data/features/export.feature +64 -17
- data/features/modify.feature +1 -5
- data/features/rename_included_files.feature +27 -4
- data/features/step_definitions/git_steps.rb +19 -0
- data/lib/defmastership/batch_modifier.rb +17 -12
- data/lib/defmastership/change_ref_modifier.rb +88 -6
- data/lib/defmastership/comment_filter.rb +1 -1
- data/lib/defmastership/constants.rb +10 -7
- data/lib/defmastership/csv_formatter.rb +16 -12
- data/lib/defmastership/csv_formatter_body.rb +18 -15
- data/lib/defmastership/csv_formatter_header.rb +1 -1
- data/lib/defmastership/definition.rb +59 -20
- data/lib/defmastership/document.rb +101 -74
- data/lib/defmastership/matching_line.rb +17 -0
- data/lib/defmastership/modifier.rb +42 -0
- data/lib/defmastership/modifier_factory.rb +12 -0
- data/lib/defmastership/parsing_state.rb +15 -9
- data/lib/defmastership/rename_included_files_modifier.rb +172 -5
- data/lib/defmastership/set_join_hack.rb +11 -0
- data/lib/defmastership/update_def_checksum_modifier.rb +8 -13
- data/lib/defmastership/update_def_modifier.rb +49 -0
- data/lib/defmastership/update_def_version_modifier.rb +81 -15
- data/lib/defmastership/version.rb +1 -1
- data/lib/defmastership.rb +1 -6
- data/spec/spec_helper.rb +3 -1
- data/spec/unit/def_mastership/batch_modifier_spec.rb +40 -36
- data/spec/unit/def_mastership/change_ref_modifier_spec.rb +196 -51
- data/spec/unit/def_mastership/csv_formatter_body_spec.rb +60 -31
- data/spec/unit/def_mastership/csv_formatter_header_spec.rb +1 -1
- data/spec/unit/def_mastership/csv_formatter_spec.rb +79 -87
- data/spec/unit/def_mastership/definition_parser_spec.rb +1 -1
- data/spec/unit/def_mastership/definition_spec.rb +16 -6
- data/spec/unit/def_mastership/document_spec.rb +81 -38
- data/spec/unit/def_mastership/matching_line_spec.rb +37 -0
- data/spec/unit/def_mastership/modifier_factory_spec.rb +38 -0
- data/spec/unit/def_mastership/modifier_spec.rb +85 -0
- data/spec/unit/def_mastership/parsing_state_spec.rb +1 -1
- data/spec/unit/def_mastership/rename_included_files_modifier_spec.rb +219 -47
- data/spec/unit/def_mastership/string_spec.rb +1 -1
- data/spec/unit/def_mastership/update_def_checksum_modifier_spec.rb +82 -50
- data/spec/unit/def_mastership/update_def_modifier_spec.rb +121 -0
- data/spec/unit/def_mastership/update_def_version_modifier_spec.rb +327 -56
- data/tasks/code_quality.rake +74 -0
- data/tasks/console.rake +8 -0
- data/tasks/package.task +9 -0
- data/tasks/test.rake +30 -0
- metadata +33 -145
- data/.rubocop.yml +0 -76
- data/config/devtools.yml +0 -2
- data/config/flay.yml +0 -3
- data/config/flog.yml +0 -2
- data/config/yardstick.yml +0 -2
- data/cucumber.yml +0 -2
- data/lib/defmastership/change_ref_line_modifier.rb +0 -85
- data/lib/defmastership/line_modifier_base.rb +0 -29
- data/lib/defmastership/modifier_base.rb +0 -36
- data/lib/defmastership/rename_included_files_line_modifier.rb +0 -126
- data/lib/defmastership/update_def_checksum_line_modifier.rb +0 -38
- data/lib/defmastership/update_def_version_line_modifier.rb +0 -58
- data/spec/unit/def_mastership/change_ref_line_modifier_spec.rb +0 -250
- data/spec/unit/def_mastership/rename_included_files_line_modifier_spec.rb +0 -207
- data/spec/unit/def_mastership/update_def_checksum_line_modifier_spec.rb +0 -82
- data/spec/unit/def_mastership/update_def_version_line_modifier_spec.rb +0 -131
- /data/{.rspec → config/rspec} +0 -0
    
        data/config/rubocop.yml
    CHANGED
    
    | @@ -1,44 +1,88 @@ | |
| 1 | 
            -
             | 
| 1 | 
            +
            # The behavior of RuboCop can be controlled via the .rubocop.yml
         | 
| 2 | 
            +
            # configuration file. It makes it possible to enable/disable
         | 
| 3 | 
            +
            # certain cops (checks) and to alter their behavior if they accept
         | 
| 4 | 
            +
            # any parameters. The file can be placed either in your home
         | 
| 5 | 
            +
            # directory or in some project directory.
         | 
| 6 | 
            +
            #
         | 
| 7 | 
            +
            # RuboCop will start looking for the configuration file in the directory
         | 
| 8 | 
            +
            # where the inspected file is and continue its way up to the root directory.
         | 
| 9 | 
            +
            #
         | 
| 10 | 
            +
            # See https://github.com/rubocop-hq/rubocop/blob/master/manual/configuration.md
         | 
| 2 11 |  | 
| 3 12 | 
             
            require:
         | 
| 13 | 
            +
              - rubocop-performance
         | 
| 4 14 | 
             
              - rubocop-rspec
         | 
| 15 | 
            +
              - rubocop-rake
         | 
| 5 16 |  | 
| 6 17 | 
             
            AllCops:
         | 
| 7 | 
            -
              TargetRubyVersion: 2. | 
| 18 | 
            +
              TargetRubyVersion: 2.7
         | 
| 19 | 
            +
              EnabledByDefault: true
         | 
| 20 | 
            +
              DisplayCopNames: true
         | 
| 8 21 |  | 
| 9 | 
            -
             | 
| 22 | 
            +
            Style/Copyright:
         | 
| 23 | 
            +
              Enabled: true
         | 
| 24 | 
            +
              Notice: 'Copyright (\(c\) )?202[0-9] Jerome Arbez-Gindre'
         | 
| 25 | 
            +
              AutocorrectNotice: '# Copyright (c) 2023 Jerome Arbez-Gindre'
         | 
| 26 | 
            +
             | 
| 27 | 
            +
            Lint/ConstantResolution: # Not available ins rubocop 0.81
         | 
| 28 | 
            +
              Enabled: false
         | 
| 29 | 
            +
             | 
| 30 | 
            +
            Style/DocumentationMethod:
         | 
| 31 | 
            +
              Enabled: false
         | 
| 32 | 
            +
             | 
| 33 | 
            +
            Style/StringHashKeys :
         | 
| 34 | 
            +
              Enabled: true
         | 
| 35 | 
            +
              Exclude:
         | 
| 36 | 
            +
                - '*.gemspec'
         | 
| 37 | 
            +
                - 'spec/unit/def_mastership/batch_modifier_spec.rb'
         | 
| 38 | 
            +
                - 'spec/unit/def_mastership/update_def_checksum_modifier_spec.rb'
         | 
| 39 | 
            +
                - 'spec/unit/def_mastership/update_def_modifier_spec.rb'
         | 
| 40 | 
            +
                - 'spec/unit/def_mastership/update_def_version_modifier_spec.rb'
         | 
| 41 | 
            +
             | 
| 42 | 
            +
            Style/MissingElse:
         | 
| 43 | 
            +
              EnforcedStyle: case
         | 
| 44 | 
            +
             | 
| 45 | 
            +
            Metrics/ModuleLength :
         | 
| 10 46 | 
             
              Exclude:
         | 
| 11 | 
            -
             | 
| 12 | 
            -
             | 
| 13 | 
            -
             | 
| 47 | 
            +
                - 'spec/**/*'
         | 
| 48 | 
            +
             | 
| 49 | 
            +
            Metrics/BlockLength :
         | 
| 50 | 
            +
              Exclude:
         | 
| 51 | 
            +
                - 'spec/**/*'
         | 
| 14 52 | 
             
                - '*.gemspec'
         | 
| 15 53 |  | 
| 16 | 
            -
             | 
| 17 | 
            -
             | 
| 18 | 
            -
             | 
| 54 | 
            +
            Security/Eval :
         | 
| 55 | 
            +
              Exclude:
         | 
| 56 | 
            +
                - 'Rakefile'
         | 
| 57 | 
            +
             | 
| 58 | 
            +
            Style/ConstantVisibility :
         | 
| 59 | 
            +
              Exclude:
         | 
| 60 | 
            +
                 # there is one unique explicit constant visibility for all
         | 
| 61 | 
            +
                 # constants
         | 
| 62 | 
            +
                - 'lib/defmastership/constants.rb'
         | 
| 63 | 
            +
             | 
| 64 | 
            +
            # rubocop-rspec options
         | 
| 65 | 
            +
            RSpec/MessageExpectation :
         | 
| 66 | 
            +
              Enabled: true
         | 
| 67 | 
            +
             | 
| 68 | 
            +
            RSpec/SpecFilePathFormat :
         | 
| 69 | 
            +
              Enabled: true
         | 
| 19 70 |  | 
| 20 | 
            -
             | 
| 21 | 
            -
             | 
| 22 | 
            -
              Max: 3
         | 
| 71 | 
            +
            RSpec/SpecFilePathSuffix :
         | 
| 72 | 
            +
              Enabled: true
         | 
| 23 73 |  | 
| 24 | 
            -
             | 
| 25 | 
            -
             | 
| 26 | 
            -
              PreferredMethods:
         | 
| 27 | 
            -
                collect:  'map'
         | 
| 28 | 
            -
                inject:   'reduce'
         | 
| 29 | 
            -
                find:     'detect'
         | 
| 30 | 
            -
                find_all: 'sélect'
         | 
| 74 | 
            +
            RSpec/NestedGroups:
         | 
| 75 | 
            +
              Max: 4
         | 
| 31 76 |  | 
| 32 | 
            -
             | 
| 33 | 
            -
             | 
| 34 | 
            -
              EnforcedStyle: kind_of?
         | 
| 77 | 
            +
            Layout/RedundantLineBreak:
         | 
| 78 | 
            +
              Enabled: false
         | 
| 35 79 |  | 
| 36 | 
            -
             | 
| 80 | 
            +
            Style/DisableCopsWithinSourceCodeDirective:
         | 
| 81 | 
            +
              Enabled: true
         | 
| 37 82 | 
             
              Exclude:
         | 
| 38 | 
            -
                -  | 
| 83 | 
            +
                - 'Gemfile'
         | 
| 84 | 
            +
                - 'tasks/code_quality.rake'
         | 
| 39 85 |  | 
| 40 | 
            -
             | 
| 41 | 
            -
               | 
| 86 | 
            +
            Layout/EndOfLine:
         | 
| 87 | 
            +
              EnforcedStyle: lf
         | 
| 42 88 |  | 
| 43 | 
            -
            MessageSpies:
         | 
| 44 | 
            -
              EnforcedStyle: receive
         | 
    
        data/defmastership.gemspec
    CHANGED
    
    | @@ -33,17 +33,9 @@ Gem::Specification.new do |spec| | |
| 33 33 | 
             
              spec.rdoc_options << '--title defmastership' << '--main README.rdoc' << '-ri'
         | 
| 34 34 | 
             
              spec.bindir = 'bin'
         | 
| 35 35 | 
             
              spec.executables << 'defmastership'
         | 
| 36 | 
            -
              spec. | 
| 37 | 
            -
              spec. | 
| 38 | 
            -
              spec. | 
| 39 | 
            -
              spec. | 
| 40 | 
            -
              spec. | 
| 41 | 
            -
              spec.add_development_dependency('rubocop', '1.50')
         | 
| 42 | 
            -
              spec.add_development_dependency('rubocop-performance', '~> 1.17')
         | 
| 43 | 
            -
              spec.add_development_dependency('rubocop-rake', '~> 0.6')
         | 
| 44 | 
            -
              spec.add_development_dependency('rubocop-rspec', '~> 2.22')
         | 
| 45 | 
            -
              spec.add_development_dependency('simplecov', '~> 0')
         | 
| 46 | 
            -
              spec.add_runtime_dependency('aasm', '~> 5')
         | 
| 47 | 
            -
              spec.add_runtime_dependency('asciidoctor', '~> 2')
         | 
| 48 | 
            -
              spec.add_runtime_dependency('gli', '~> 2')
         | 
| 36 | 
            +
              spec.add_dependency('aasm', '~> 5')
         | 
| 37 | 
            +
              spec.add_dependency('asciidoctor', '~> 2')
         | 
| 38 | 
            +
              spec.add_dependency('csv', '~> 3')
         | 
| 39 | 
            +
              spec.add_dependency('git', '~> 1')
         | 
| 40 | 
            +
              spec.add_dependency('gli', '~> 2')
         | 
| 49 41 | 
             
            end
         | 
    
        data/features/changeref.feature
    CHANGED
    
    | @@ -20,7 +20,6 @@ Feature: The changeref command | |
| 20 20 | 
             
                """
         | 
| 21 21 | 
             
                When I successfully run `defmastership modify --modifications toto thedoc.adoc`
         | 
| 22 22 | 
             
                Then the stdout should not contain anything
         | 
| 23 | 
            -
                And the stderr should not contain anything
         | 
| 24 23 | 
             
                And the file "modifications.yml" should contain:
         | 
| 25 24 | 
             
                """
         | 
| 26 25 | 
             
                ---
         | 
| @@ -53,7 +52,6 @@ Feature: The changeref command | |
| 53 52 | 
             
                """
         | 
| 54 53 | 
             
                When I successfully run `defmastership modify --modifications toto thedoc.adoc`
         | 
| 55 54 | 
             
                Then the stdout should not contain anything
         | 
| 56 | 
            -
                And the stderr should not contain anything
         | 
| 57 55 | 
             
                And the file "modifications.yml" should contain:
         | 
| 58 56 | 
             
                """
         | 
| 59 57 | 
             
                ---
         | 
| @@ -87,7 +85,6 @@ Feature: The changeref command | |
| 87 85 | 
             
                """
         | 
| 88 86 | 
             
                When I successfully run `defmastership modify --modifications toto thedoc.adoc`
         | 
| 89 87 | 
             
                Then the stdout should not contain anything
         | 
| 90 | 
            -
                And the stderr should not contain anything
         | 
| 91 88 | 
             
                And the file "modifications.yml" should contain:
         | 
| 92 89 | 
             
                """
         | 
| 93 90 | 
             
                ---
         | 
| @@ -122,7 +119,6 @@ Feature: The changeref command | |
| 122 119 | 
             
                """
         | 
| 123 120 | 
             
                When I successfully run `defmastership modify --modifications tata_or_titi thedoc.adoc`
         | 
| 124 121 | 
             
                Then the stdout should not contain anything
         | 
| 125 | 
            -
                And the stderr should not contain anything
         | 
| 126 122 | 
             
                And the file "modifications.yml" should contain:
         | 
| 127 123 | 
             
                """
         | 
| 128 124 | 
             
                ---
         | 
| @@ -160,7 +156,6 @@ Feature: The changeref command | |
| 160 156 | 
             
                """
         | 
| 161 157 | 
             
                When I successfully run `defmastership modify --modifications toto thedoc.adoc thedoc2.adoc`
         | 
| 162 158 | 
             
                Then the stdout should not contain anything
         | 
| 163 | 
            -
                And the stderr should not contain anything
         | 
| 164 159 | 
             
                And the file "modifications.yml" should contain:
         | 
| 165 160 | 
             
                """
         | 
| 166 161 | 
             
                ---
         | 
| @@ -200,7 +195,6 @@ Feature: The changeref command | |
| 200 195 | 
             
                """
         | 
| 201 196 | 
             
                When I successfully run `defmastership modify --modifications toto thedoc.adoc`
         | 
| 202 197 | 
             
                Then the stdout should not contain anything
         | 
| 203 | 
            -
                And the stderr should not contain anything
         | 
| 204 198 | 
             
                And the file "thedoc.adoc" should contain:
         | 
| 205 199 | 
             
                """
         | 
| 206 200 | 
             
                [define, requirement, TOTO-0123]
         | 
| @@ -232,7 +226,6 @@ Feature: The changeref command | |
| 232 226 | 
             
                """
         | 
| 233 227 | 
             
                When I successfully run `defmastership modify --modifications toto thedoc.adoc thedoc2.adoc`
         | 
| 234 228 | 
             
                Then the stdout should not contain anything
         | 
| 235 | 
            -
                And the stderr should not contain anything
         | 
| 236 229 | 
             
                And the file "thedoc.adoc" should contain:
         | 
| 237 230 | 
             
                """
         | 
| 238 231 | 
             
                [define, requirement, TOTO-0123]
         | 
| @@ -263,7 +256,6 @@ Feature: The changeref command | |
| 263 256 | 
             
                """
         | 
| 264 257 | 
             
                When I successfully run `defmastership modify --modifications toto thedoc.adoc`
         | 
| 265 258 | 
             
                Then the stdout should not contain anything
         | 
| 266 | 
            -
                And the stderr should not contain anything
         | 
| 267 259 | 
             
                And the file "modifications.yml" should contain:
         | 
| 268 260 | 
             
                """
         | 
| 269 261 | 
             
                ---
         | 
| @@ -82,7 +82,6 @@ Feature: definition checksum | |
| 82 82 | 
             
                Second line.",~b86dcbde
         | 
| 83 83 | 
             
                """
         | 
| 84 84 | 
             
                And the stdout should not contain anything
         | 
| 85 | 
            -
                And the stderr should not contain anything
         | 
| 86 85 |  | 
| 87 86 | 
             
              Scenario: Change one modifier
         | 
| 88 87 | 
             
                Given a file named "modifications.yml" with:
         | 
| @@ -102,7 +101,6 @@ Feature: definition checksum | |
| 102 101 | 
             
                """
         | 
| 103 102 | 
             
                When I successfully run `defmastership modify --modifications update_requirement_checksum thedoc.adoc`
         | 
| 104 103 | 
             
                Then the stdout should not contain anything
         | 
| 105 | 
            -
                And the stderr should not contain anything
         | 
| 106 104 | 
             
                And the file "thedoc.adoc" should contain:
         | 
| 107 105 | 
             
                """
         | 
| 108 106 | 
             
                [define, requirement, TOTO-TEMP-XXX1(~244eed18)]
         | 
| @@ -129,7 +127,6 @@ Feature: definition checksum | |
| 129 127 | 
             
                """
         | 
| 130 128 | 
             
                When I successfully run `defmastership modify --modifications update_requirement_checksum thedoc.adoc`
         | 
| 131 129 | 
             
                Then the stdout should not contain anything
         | 
| 132 | 
            -
                And the stderr should not contain anything
         | 
| 133 130 | 
             
                And the file "thedoc.adoc" should contain:
         | 
| 134 131 | 
             
                """
         | 
| 135 132 | 
             
                [define, requirement, TOTO-TEMP-XXX1(~244eed18)]
         | 
| @@ -159,7 +156,6 @@ Feature: definition checksum | |
| 159 156 | 
             
                Second line.",~b86dcbde
         | 
| 160 157 | 
             
                """
         | 
| 161 158 | 
             
                And the stdout should not contain anything
         | 
| 162 | 
            -
                And the stderr should not contain anything
         | 
| 163 159 |  | 
| 164 160 | 
             
              Scenario: Checksum is calculated on included file in ref modification
         | 
| 165 161 | 
             
                Given a file named "modifications.yml" with:
         | 
| @@ -191,7 +187,6 @@ Feature: definition checksum | |
| 191 187 | 
             
                --
         | 
| 192 188 | 
             
                """
         | 
| 193 189 | 
             
                And the stdout should not contain anything
         | 
| 194 | 
            -
                And the stderr should not contain anything
         | 
| 195 190 |  | 
| 196 191 | 
             
              Scenario: Checksum take into account variables in CSV export
         | 
| 197 192 | 
             
                Given a file named "thedoc.adoc" with:
         | 
| @@ -211,9 +206,8 @@ Feature: definition checksum | |
| 211 206 | 
             
                Second line.",~b86dcbde
         | 
| 212 207 | 
             
                """
         | 
| 213 208 | 
             
                And the stdout should not contain anything
         | 
| 214 | 
            -
                And the stderr should not contain anything
         | 
| 215 209 |  | 
| 216 | 
            -
              Scenario: Checksum  | 
| 210 | 
            +
              Scenario: Checksum takes into account variables in ref modification
         | 
| 217 211 | 
             
                Given a file named "modifications.yml" with:
         | 
| 218 212 | 
             
                """
         | 
| 219 213 | 
             
                ---
         | 
| @@ -241,7 +235,35 @@ Feature: definition checksum | |
| 241 235 | 
             
                --
         | 
| 242 236 | 
             
                """
         | 
| 243 237 | 
             
                And the stdout should not contain anything
         | 
| 244 | 
            -
             | 
| 238 | 
            +
             | 
| 239 | 
            +
              Scenario: Checksum does not take into account bad variables definition
         | 
| 240 | 
            +
                Given a file named "modifications.yml" with:
         | 
| 241 | 
            +
                """
         | 
| 242 | 
            +
                ---
         | 
| 243 | 
            +
                :update_requirement_checksum:
         | 
| 244 | 
            +
                  :type: update_def_checksum
         | 
| 245 | 
            +
                  :config:
         | 
| 246 | 
            +
                    :def_type: requirement
         | 
| 247 | 
            +
                """
         | 
| 248 | 
            +
                And a file named "thedoc.adoc" with:
         | 
| 249 | 
            +
                """
         | 
| 250 | 
            +
                :variable:multiline
         | 
| 251 | 
            +
                [define, requirement, TOTO-0001]
         | 
| 252 | 
            +
                --
         | 
| 253 | 
            +
                Exemple of {variable} requirement.
         | 
| 254 | 
            +
                Second line.
         | 
| 255 | 
            +
                --
         | 
| 256 | 
            +
                """
         | 
| 257 | 
            +
                When I successfully run `defmastership modify --modifications update_requirement_checksum thedoc.adoc`
         | 
| 258 | 
            +
                Then the file "thedoc.adoc" should contain:
         | 
| 259 | 
            +
                """
         | 
| 260 | 
            +
                [define, requirement, TOTO-0001(~2e7dd73e)]
         | 
| 261 | 
            +
                --
         | 
| 262 | 
            +
                Exemple of {variable} requirement.
         | 
| 263 | 
            +
                Second line.
         | 
| 264 | 
            +
                --
         | 
| 265 | 
            +
                """
         | 
| 266 | 
            +
                And the stdout should not contain anything
         | 
| 245 267 |  | 
| 246 268 | 
             
              Scenario: Checksum keep explicit version in ref modification
         | 
| 247 269 | 
             
                Given a file named "modifications.yml" with:
         | 
| @@ -261,7 +283,6 @@ Feature: definition checksum | |
| 261 283 | 
             
                """
         | 
| 262 284 | 
             
                When I successfully run `defmastership modify --modifications update_requirement_checksum thedoc.adoc`
         | 
| 263 285 | 
             
                Then the stdout should not contain anything
         | 
| 264 | 
            -
                And the stderr should not contain anything
         | 
| 265 286 | 
             
                And the file "thedoc.adoc" should contain:
         | 
| 266 287 | 
             
                """
         | 
| 267 288 | 
             
                [define, requirement, TOTO-TEMP-XXX1(toto~244eed18)]
         | 
| @@ -288,7 +309,6 @@ Feature: definition checksum | |
| 288 309 | 
             
                """
         | 
| 289 310 | 
             
                When I successfully run `defmastership modify --modifications update_requirement_checksum thedoc.adoc`
         | 
| 290 311 | 
             
                Then the stdout should not contain anything
         | 
| 291 | 
            -
                And the stderr should not contain anything
         | 
| 292 312 | 
             
                And the file "thedoc.adoc" should contain:
         | 
| 293 313 | 
             
                """
         | 
| 294 314 | 
             
                [define, requirement, TOTO-TEMP-XXX1(toto~244eed18)]
         | 
| @@ -1,9 +1,9 @@ | |
| 1 | 
            -
            Feature: definitions version | 
| 2 | 
            -
              As a Responsible of definitions for a given document | 
| 1 | 
            +
            Feature: definitions version
         | 
| 2 | 
            +
              As a Responsible of definitions for a given document
         | 
| 3 3 | 
             
              In order to detect handle versions definitions
         | 
| 4 4 | 
             
              I want defmastership to export explicit versions in definitions
         | 
| 5 5 |  | 
| 6 | 
            -
              Scenario: Extract one definition with explicit version to CSV | 
| 6 | 
            +
              Scenario: Extract one definition with explicit version to CSV
         | 
| 7 7 | 
             
                Given a file named "thedoc.adoc" with:
         | 
| 8 8 | 
             
                """
         | 
| 9 9 | 
             
                [define, requirement, TOTO-0001(pouet)]
         | 
| @@ -20,9 +20,8 @@ Feature: definitions version | |
| 20 20 | 
             
                Second line.",~b86dcbde,pouet
         | 
| 21 21 | 
             
                """
         | 
| 22 22 | 
             
                And the stdout should not contain anything
         | 
| 23 | 
            -
                And the stderr should not contain anything
         | 
| 24 23 |  | 
| 25 | 
            -
              Scenario: Set initial explicit version when definition has changed | 
| 24 | 
            +
              Scenario: Set initial explicit version when definition has changed
         | 
| 26 25 | 
             
                Given a file named "ref_doc.adoc" with:
         | 
| 27 26 | 
             
                """
         | 
| 28 27 | 
             
                [define, requirement, TOTO-0001]
         | 
| @@ -49,7 +48,170 @@ Feature: definitions version | |
| 49 48 | 
             
                """
         | 
| 50 49 | 
             
                When I successfully run `defmastership modify --modifications update_requirement_version thedoc.adoc`
         | 
| 51 50 | 
             
                And the stdout should not contain anything
         | 
| 52 | 
            -
                 | 
| 51 | 
            +
                Then the file "thedoc.adoc" should contain:
         | 
| 52 | 
            +
                """
         | 
| 53 | 
            +
                [define, requirement, TOTO-0001(a)]
         | 
| 54 | 
            +
                --
         | 
| 55 | 
            +
                modified text.
         | 
| 56 | 
            +
                --
         | 
| 57 | 
            +
                """
         | 
| 58 | 
            +
             | 
| 59 | 
            +
              Scenario: Set initial explicit version when definition has changed with multiple ref_files
         | 
| 60 | 
            +
                Given a file named "ref_doc1.adoc" with:
         | 
| 61 | 
            +
                """
         | 
| 62 | 
            +
                [define, requirement, TOTO-0001]
         | 
| 63 | 
            +
                --
         | 
| 64 | 
            +
                initial text 1.
         | 
| 65 | 
            +
                --
         | 
| 66 | 
            +
                """
         | 
| 67 | 
            +
                Given a file named "ref_doc2.adoc" with:
         | 
| 68 | 
            +
                """
         | 
| 69 | 
            +
                [define, requirement, TOTO-0002(z)]
         | 
| 70 | 
            +
                --
         | 
| 71 | 
            +
                initial text 2.
         | 
| 72 | 
            +
                --
         | 
| 73 | 
            +
                """
         | 
| 74 | 
            +
                Given a file named "thedoc.adoc" with:
         | 
| 75 | 
            +
                """
         | 
| 76 | 
            +
                [define, requirement, TOTO-0001(whatever)]
         | 
| 77 | 
            +
                --
         | 
| 78 | 
            +
                modified text.
         | 
| 79 | 
            +
                --
         | 
| 80 | 
            +
             | 
| 81 | 
            +
                [define, requirement, TOTO-0002(whatever)]
         | 
| 82 | 
            +
                --
         | 
| 83 | 
            +
                modified text again.
         | 
| 84 | 
            +
                --
         | 
| 85 | 
            +
                """
         | 
| 86 | 
            +
                And a file named "modifications.yml" with:
         | 
| 87 | 
            +
                """
         | 
| 88 | 
            +
                ---
         | 
| 89 | 
            +
                :update_requirement_version:
         | 
| 90 | 
            +
                  :type: update_def_version
         | 
| 91 | 
            +
                  :config:
         | 
| 92 | 
            +
                    :def_type: requirement
         | 
| 93 | 
            +
                    :first_version: a
         | 
| 94 | 
            +
                    :ref_document: ['./ref_doc1.adoc', './ref_doc2.adoc']
         | 
| 95 | 
            +
                """
         | 
| 96 | 
            +
                When I successfully run `defmastership modify --modifications update_requirement_version thedoc.adoc`
         | 
| 97 | 
            +
                And the stdout should not contain anything
         | 
| 98 | 
            +
                Then the file "thedoc.adoc" should contain:
         | 
| 99 | 
            +
                """
         | 
| 100 | 
            +
                [define, requirement, TOTO-0001(a)]
         | 
| 101 | 
            +
                --
         | 
| 102 | 
            +
                modified text.
         | 
| 103 | 
            +
                --
         | 
| 104 | 
            +
             | 
| 105 | 
            +
                [define, requirement, TOTO-0002(aa)]
         | 
| 106 | 
            +
                --
         | 
| 107 | 
            +
                modified text again.
         | 
| 108 | 
            +
                --
         | 
| 109 | 
            +
                """
         | 
| 110 | 
            +
             | 
| 111 | 
            +
              Scenario: Update explicit version based on git tag
         | 
| 112 | 
            +
                Given I initialize a git repo
         | 
| 113 | 
            +
                And a file named "thedoc.adoc" with:
         | 
| 114 | 
            +
                """
         | 
| 115 | 
            +
                [define, requirement, TOTO-0001]
         | 
| 116 | 
            +
                --
         | 
| 117 | 
            +
                initial text.
         | 
| 118 | 
            +
                --
         | 
| 119 | 
            +
                """
         | 
| 120 | 
            +
                And I add and commit the "thedoc.adoc" file
         | 
| 121 | 
            +
                And I set the "THE_TAG" tag
         | 
| 122 | 
            +
                And a file named "thedoc.adoc" with:
         | 
| 123 | 
            +
                """
         | 
| 124 | 
            +
                [define, requirement, TOTO-0001(whatever)]
         | 
| 125 | 
            +
                --
         | 
| 126 | 
            +
                modified text.
         | 
| 127 | 
            +
                --
         | 
| 128 | 
            +
                """
         | 
| 129 | 
            +
                And a file named "modifications.yml" with:
         | 
| 130 | 
            +
                """
         | 
| 131 | 
            +
                ---
         | 
| 132 | 
            +
                :update_requirement_version:
         | 
| 133 | 
            +
                  :type: update_def_version
         | 
| 134 | 
            +
                  :config:
         | 
| 135 | 
            +
                    :def_type: requirement
         | 
| 136 | 
            +
                    :first_version: a
         | 
| 137 | 
            +
                    :ref_tag: 'THE_TAG'
         | 
| 138 | 
            +
                """
         | 
| 139 | 
            +
                When I successfully run `defmastership modify --modifications update_requirement_version thedoc.adoc`
         | 
| 140 | 
            +
                And the stdout should not contain anything
         | 
| 141 | 
            +
                Then the file "thedoc.adoc" should contain:
         | 
| 142 | 
            +
                """
         | 
| 143 | 
            +
                [define, requirement, TOTO-0001(a)]
         | 
| 144 | 
            +
                --
         | 
| 145 | 
            +
                modified text.
         | 
| 146 | 
            +
                --
         | 
| 147 | 
            +
                """
         | 
| 148 | 
            +
             | 
| 149 | 
            +
              Scenario: Update explicit version based on git tag on a different git repo
         | 
| 150 | 
            +
                And a file named "defmastership-example.adoc" with:
         | 
| 151 | 
            +
                """
         | 
| 152 | 
            +
                [define, whatever, WHATEVER-0001]
         | 
| 153 | 
            +
                Simplest ever definition. !modified!
         | 
| 154 | 
            +
                With a single paragraph.
         | 
| 155 | 
            +
                """
         | 
| 156 | 
            +
                And a file named "modifications.yml" with:
         | 
| 157 | 
            +
                """
         | 
| 158 | 
            +
                ---
         | 
| 159 | 
            +
                :update_requirement_version:
         | 
| 160 | 
            +
                  :type: update_def_version
         | 
| 161 | 
            +
                  :config:
         | 
| 162 | 
            +
                    :def_type: whatever
         | 
| 163 | 
            +
                    :first_version: a
         | 
| 164 | 
            +
                    :ref_tag: 'TEST_UPDATE_VERSION'
         | 
| 165 | 
            +
                    :ref_repo: 'https://gitlab.com/defmastership/defmastership-example.git'
         | 
| 166 | 
            +
                """
         | 
| 167 | 
            +
                When I successfully run `defmastership modify --modifications update_requirement_version defmastership-example.adoc`
         | 
| 168 | 
            +
                And the stdout should not contain anything
         | 
| 169 | 
            +
                Then the file "defmastership-example.adoc" should contain:
         | 
| 170 | 
            +
                """
         | 
| 171 | 
            +
                [define, whatever, WHATEVER-0001(a)]
         | 
| 172 | 
            +
                Simplest ever definition. !modified!
         | 
| 173 | 
            +
                With a single paragraph.
         | 
| 174 | 
            +
                """
         | 
| 175 | 
            +
             | 
| 176 | 
            +
              Scenario: Update explicit version based on git tag and different filename
         | 
| 177 | 
            +
                Given I initialize a git repo
         | 
| 178 | 
            +
                And a file named "ref_doc.adoc" with:
         | 
| 179 | 
            +
                """
         | 
| 180 | 
            +
                [define, requirement, TOTO-0001]
         | 
| 181 | 
            +
                --
         | 
| 182 | 
            +
                initial text.
         | 
| 183 | 
            +
                --
         | 
| 184 | 
            +
                """
         | 
| 185 | 
            +
                And I add and commit the "ref_doc.adoc" file
         | 
| 186 | 
            +
                And I set the "THE_TAG" tag
         | 
| 187 | 
            +
                And I remove the file "ref_doc.adoc"
         | 
| 188 | 
            +
                And a file named "thedoc.adoc" with:
         | 
| 189 | 
            +
                """
         | 
| 190 | 
            +
                [define, requirement, TOTO-0001(whatever)]
         | 
| 191 | 
            +
                --
         | 
| 192 | 
            +
                modified text.
         | 
| 193 | 
            +
                --
         | 
| 194 | 
            +
                """
         | 
| 195 | 
            +
                And a file named "ref_doc.adoc" with:
         | 
| 196 | 
            +
                """
         | 
| 197 | 
            +
                [define, requirement, TOTO-0001(whatever)]
         | 
| 198 | 
            +
                --
         | 
| 199 | 
            +
                modified text.
         | 
| 200 | 
            +
                --
         | 
| 201 | 
            +
                """
         | 
| 202 | 
            +
                And a file named "modifications.yml" with:
         | 
| 203 | 
            +
                """
         | 
| 204 | 
            +
                ---
         | 
| 205 | 
            +
                :update_requirement_version:
         | 
| 206 | 
            +
                  :type: update_def_version
         | 
| 207 | 
            +
                  :config:
         | 
| 208 | 
            +
                    :def_type: requirement
         | 
| 209 | 
            +
                    :first_version: a
         | 
| 210 | 
            +
                    :ref_document: ./ref_doc.adoc
         | 
| 211 | 
            +
                    :ref_tag: 'THE_TAG'
         | 
| 212 | 
            +
                """
         | 
| 213 | 
            +
                When I successfully run `defmastership modify --modifications update_requirement_version thedoc.adoc`
         | 
| 214 | 
            +
                And the stdout should not contain anything
         | 
| 53 215 | 
             
                Then the file "thedoc.adoc" should contain:
         | 
| 54 216 | 
             
                """
         | 
| 55 217 | 
             
                [define, requirement, TOTO-0001(a)]
         | 
| @@ -85,7 +247,6 @@ Feature: definitions version | |
| 85 247 | 
             
                """
         | 
| 86 248 | 
             
                When I successfully run `defmastership modify --modifications update_requirement_version thedoc.adoc`
         | 
| 87 249 | 
             
                And the stdout should not contain anything
         | 
| 88 | 
            -
                And the stderr should not contain anything
         | 
| 89 250 | 
             
                Then the file "thedoc.adoc" should contain:
         | 
| 90 251 | 
             
                """
         | 
| 91 252 | 
             
                [define, requirement, TOTO-0001]
         | 
| @@ -121,7 +282,6 @@ Feature: definitions version | |
| 121 282 | 
             
                """
         | 
| 122 283 | 
             
                When I successfully run `defmastership modify --modifications update_requirement_version thedoc.adoc`
         | 
| 123 284 | 
             
                And the stdout should not contain anything
         | 
| 124 | 
            -
                And the stderr should not contain anything
         | 
| 125 285 | 
             
                Then the file "thedoc.adoc" should contain:
         | 
| 126 286 | 
             
                """
         | 
| 127 287 | 
             
                [define, requirement, TOTO-0001(4)]
         | 
| @@ -157,7 +317,6 @@ Feature: definitions version | |
| 157 317 | 
             
                """
         | 
| 158 318 | 
             
                When I successfully run `defmastership modify --modifications update_requirement_version thedoc.adoc`
         | 
| 159 319 | 
             
                And the stdout should not contain anything
         | 
| 160 | 
            -
                And the stderr should not contain anything
         | 
| 161 320 | 
             
                Then the file "thedoc.adoc" should contain:
         | 
| 162 321 | 
             
                """
         | 
| 163 322 | 
             
                [define, requirement, TOTO-0001]
         | 
| @@ -193,7 +352,6 @@ Feature: definitions version | |
| 193 352 | 
             
                """
         | 
| 194 353 | 
             
                When I successfully run `defmastership modify --modifications update_requirement_version thedoc.adoc`
         | 
| 195 354 | 
             
                And the stdout should not contain anything
         | 
| 196 | 
            -
                And the stderr should not contain anything
         | 
| 197 355 | 
             
                Then the file "thedoc.adoc" should contain:
         | 
| 198 356 | 
             
                """
         | 
| 199 357 | 
             
                [define, requirement, TOTO-0001(a~abcd1234)]
         |