bmp 0.8.4 → 0.9.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/.bmp.yml +1 -1
 - data/.editorconfig +7 -0
 - data/Gemfile.lock +1 -1
 - data/README.md +1 -1
 - data/TODO.md +19 -22
 - data/lib/bump/application.rb +125 -50
 - data/lib/bump/domain.rb +6 -6
 - data/lib/bump/domain/bump_info.rb +99 -0
 - data/lib/bump/domain/bump_info_repository.rb +44 -0
 - data/lib/bump/domain/{file_rewrite_rule.rb → file_update_rule.rb} +24 -7
 - data/lib/bump/domain/file_update_rule_factory.rb +28 -0
 - data/lib/bump/domain/{version.rb → version_number.rb} +1 -1
 - data/lib/bump/domain/{version_factory.rb → version_number_factory.rb} +2 -2
 - data/lib/bump/version.rb +1 -1
 - data/spec/bump/domain/{file_rewrite_rule_factory_spec.rb → bump_info_repository_spec.rb} +1 -1
 - data/spec/bump/domain/{version_descriptor_spec.rb → bump_info_spec.rb} +1 -1
 - data/spec/bump/domain/file_update_rule_factory_spec.rb +7 -0
 - data/spec/bump/domain/{file_rewrite_rule_spec.rb → file_update_rule_spec.rb} +14 -8
 - data/spec/bump/domain/{version_factory_spec.rb → version_number_factory_spec.rb} +3 -3
 - data/spec/bump/domain/{version_spec.rb → version_number_spec.rb} +12 -12
 - metadata +20 -19
 - data/lib/bump/domain/file_rewrite_rule_factory.rb +0 -22
 - data/lib/bump/domain/version_descriptor.rb +0 -65
 - data/lib/bump/domain/version_descriptor_repository.rb +0 -23
 - data/spec/bump/domain/version_descriptor_repository_spec.rb +0 -7
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 2d7d2b2d54797a4e61461a9ed3b3d9af91a47bad
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 790a8704c176bd2df4e1365f901bd5a1679b15cc
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 3608a6d5a8051969b2417f6d97261a8727e17e61f7d60743aa776bc160a5199606602d9297f284166ba338cbbb2ce3ff0ce3f698644f5f8d35072f7dfc99ac7d
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 652aefef8e380f595378a73545f2bebf009bfa645d38c049d0434f55b21fff4c624c7aede59d9f8c4d03a62de1fef35af2212ad47ebb259ff032f84adeffb926
         
     | 
    
        data/.bmp.yml
    CHANGED
    
    
    
        data/.editorconfig
    ADDED
    
    
    
        data/Gemfile.lock
    CHANGED
    
    
    
        data/README.md
    CHANGED
    
    
    
        data/TODO.md
    CHANGED
    
    | 
         @@ -1,33 +1,30 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # TODO
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
     | 
    
         
            -
            -  
     | 
| 
       4 
     | 
    
         
            -
            -  
     | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
       6 
     | 
    
         
            -
            - Refactor application
         
     | 
| 
      
 3 
     | 
    
         
            +
            - Generate documentaion
         
     | 
| 
      
 4 
     | 
    
         
            +
            - support pre-release version number (of semver)
         
     | 
| 
      
 5 
     | 
    
         
            +
            - support build version number (of semver)
         
     | 
| 
       7 
6 
     | 
    
         | 
| 
       8 
     | 
    
         
            -
            -  
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
              - no `files` case
         
     | 
| 
      
 7 
     | 
    
         
            +
            - yaml parse error handling
         
     | 
| 
      
 8 
     | 
    
         
            +
            - no `version` case handling
         
     | 
| 
      
 9 
     | 
    
         
            +
            - no `files` case handling
         
     | 
| 
       12 
10 
     | 
    
         | 
| 
       13 
     | 
    
         
            -
            -  
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
              - `placeholder` field
         
     | 
| 
       16 
     | 
    
         
            -
              - interactive init command
         
     | 
| 
       17 
     | 
    
         
            -
              - label
         
     | 
| 
      
 11 
     | 
    
         
            +
            - Add `this file is auto modified by bmp command` comment
         
     | 
| 
      
 12 
     | 
    
         
            +
            - interactive init command
         
     | 
| 
       18 
13 
     | 
    
         | 
| 
       19 
     | 
    
         
            -
            - test
         
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
              - Command
         
     | 
| 
      
 14 
     | 
    
         
            +
            - test FileRewriteRule
         
     | 
| 
      
 15 
     | 
    
         
            +
            - test FileRewriteRuleFactory
         
     | 
| 
      
 16 
     | 
    
         
            +
            - test VersionDescriptor
         
     | 
| 
      
 17 
     | 
    
         
            +
            - test VersionDescriptorRepository
         
     | 
| 
      
 18 
     | 
    
         
            +
            - test Application
         
     | 
| 
      
 19 
     | 
    
         
            +
            - test CLI
         
     | 
| 
      
 20 
     | 
    
         
            +
            - test Logger
         
     | 
| 
      
 21 
     | 
    
         
            +
            - test Command
         
     | 
| 
       28 
22 
     | 
    
         | 
| 
       29 
23 
     | 
    
         
             
            # DONE
         
     | 
| 
       30 
24 
     | 
    
         | 
| 
      
 25 
     | 
    
         
            +
            - Rename file_rewrite_rule to file_update_rule
         
     | 
| 
      
 26 
     | 
    
         
            +
            - Rename version_descriptor to bump_info
         
     | 
| 
      
 27 
     | 
    
         
            +
            - Refactor application
         
     | 
| 
       31 
28 
     | 
    
         
             
            - travis - done
         
     | 
| 
       32 
29 
     | 
    
         
             
            - coveralls - done
         
     | 
| 
       33 
30 
     | 
    
         
             
            - introduce simplecov - done
         
     | 
    
        data/lib/bump/application.rb
    CHANGED
    
    | 
         @@ -6,6 +6,11 @@ module Bump 
     | 
|
| 
       6 
6 
     | 
    
         | 
| 
       7 
7 
     | 
    
         
             
                class Application
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
      
 9 
     | 
    
         
            +
                    # @param [Hash] options The cli options
         
     | 
| 
      
 10 
     | 
    
         
            +
                    # @param [String] help The help message
         
     | 
| 
      
 11 
     | 
    
         
            +
                    # @param [String] version The version expression of this command
         
     | 
| 
      
 12 
     | 
    
         
            +
                    # @param [String] file The file name of bump info file
         
     | 
| 
      
 13 
     | 
    
         
            +
                    # @param [Bump::Logger] logger The logger
         
     | 
| 
       9 
14 
     | 
    
         
             
                    def initialize options, help, version, file, logger
         
     | 
| 
       10 
15 
     | 
    
         
             
                        @options = options
         
     | 
| 
       11 
16 
     | 
    
         
             
                        @help = help
         
     | 
| 
         @@ -14,6 +19,9 @@ module Bump 
     | 
|
| 
       14 
19 
     | 
    
         
             
                        @logger = logger
         
     | 
| 
       15 
20 
     | 
    
         
             
                    end
         
     | 
| 
       16 
21 
     | 
    
         | 
| 
      
 22 
     | 
    
         
            +
                    # Select the main action
         
     | 
| 
      
 23 
     | 
    
         
            +
                    #
         
     | 
| 
      
 24 
     | 
    
         
            +
                    # @return [Symbol]
         
     | 
| 
       17 
25 
     | 
    
         
             
                    def selectAction
         
     | 
| 
       18 
26 
     | 
    
         
             
                        if @options[:help]
         
     | 
| 
       19 
27 
     | 
    
         
             
                            return :help
         
     | 
| 
         @@ -35,102 +43,141 @@ module Bump 
     | 
|
| 
       35 
43 
     | 
    
         
             
                        return :info
         
     | 
| 
       36 
44 
     | 
    
         
             
                    end
         
     | 
| 
       37 
45 
     | 
    
         | 
| 
      
 46 
     | 
    
         
            +
                    # handler of `bmp --version`
         
     | 
| 
       38 
47 
     | 
    
         
             
                    def actionVersion
         
     | 
| 
       39 
     | 
    
         
            -
                         
     | 
| 
      
 48 
     | 
    
         
            +
                        log @version
         
     | 
| 
       40 
49 
     | 
    
         
             
                    end
         
     | 
| 
       41 
50 
     | 
    
         | 
| 
      
 51 
     | 
    
         
            +
                    # handler of `bmp --help`
         
     | 
| 
       42 
52 
     | 
    
         
             
                    def actionHelp
         
     | 
| 
       43 
     | 
    
         
            -
                         
     | 
| 
      
 53 
     | 
    
         
            +
                        log @help
         
     | 
| 
       44 
54 
     | 
    
         
             
                    end
         
     | 
| 
       45 
55 
     | 
    
         | 
| 
       46 
     | 
    
         
            -
                     
     | 
| 
       47 
     | 
    
         
            -
             
     | 
| 
      
 56 
     | 
    
         
            +
                    # Gets the bump info
         
     | 
| 
      
 57 
     | 
    
         
            +
                    #
         
     | 
| 
      
 58 
     | 
    
         
            +
                    # @return [Bump::BumpInfo]
         
     | 
| 
      
 59 
     | 
    
         
            +
                    def getBumpInfo
         
     | 
| 
      
 60 
     | 
    
         
            +
             
     | 
| 
      
 61 
     | 
    
         
            +
                        repo = BumpInfoRepository.new @file
         
     | 
| 
       48 
62 
     | 
    
         | 
| 
       49 
63 
     | 
    
         
             
                        begin
         
     | 
| 
       50 
     | 
    
         
            -
                             
     | 
| 
      
 64 
     | 
    
         
            +
                            bumpInfo = repo.fromFile
         
     | 
| 
       51 
65 
     | 
    
         
             
                        rescue Errno::ENOENT => e then
         
     | 
| 
       52 
     | 
    
         
            -
                             
     | 
| 
      
 66 
     | 
    
         
            +
                            log_red "Error: the file `#{@file}` not found."
         
     | 
| 
       53 
67 
     | 
    
         
             
                            exit 1
         
     | 
| 
       54 
68 
     | 
    
         
             
                        end
         
     | 
| 
       55 
69 
     | 
    
         | 
| 
       56 
     | 
    
         
            -
                         
     | 
| 
       57 
     | 
    
         
            -
             
     | 
| 
      
 70 
     | 
    
         
            +
                        return bumpInfo
         
     | 
| 
      
 71 
     | 
    
         
            +
             
     | 
| 
      
 72 
     | 
    
         
            +
                    end
         
     | 
| 
      
 73 
     | 
    
         
            +
             
     | 
| 
      
 74 
     | 
    
         
            +
                    # Saves the bump info
         
     | 
| 
      
 75 
     | 
    
         
            +
                    #
         
     | 
| 
      
 76 
     | 
    
         
            +
                    # @param [Bump::BumpInfo] bumpInfo
         
     | 
| 
      
 77 
     | 
    
         
            +
                    def saveBumpInfo bumpInfo
         
     | 
| 
      
 78 
     | 
    
         
            +
                        repo = BumpInfoRepository.new @file
         
     | 
| 
       58 
79 
     | 
    
         | 
| 
       59 
     | 
    
         
            -
                         
     | 
| 
      
 80 
     | 
    
         
            +
                        repo.save bumpInfo
         
     | 
| 
      
 81 
     | 
    
         
            +
                    end
         
     | 
| 
       60 
82 
     | 
    
         | 
| 
       61 
     | 
    
         
            -
             
     | 
| 
       62 
     | 
    
         
            -
             
     | 
| 
      
 83 
     | 
    
         
            +
                    # Shows the version patterns.
         
     | 
| 
      
 84 
     | 
    
         
            +
                    #
         
     | 
| 
      
 85 
     | 
    
         
            +
                    # @param [Bump::BumpInfo] bumpInfo
         
     | 
| 
      
 86 
     | 
    
         
            +
                    def showVersionPatterns bumpInfo
         
     | 
| 
       63 
87 
     | 
    
         | 
| 
       64 
     | 
    
         
            -
             
     | 
| 
       65 
     | 
    
         
            -
             
     | 
| 
      
 88 
     | 
    
         
            +
                        log "Current Version:", false
         
     | 
| 
      
 89 
     | 
    
         
            +
                        log_green " #{bumpInfo.beforeVersion}"
         
     | 
| 
      
 90 
     | 
    
         
            +
             
     | 
| 
      
 91 
     | 
    
         
            +
                        log "Version patterns:"
         
     | 
| 
      
 92 
     | 
    
         
            +
             
     | 
| 
      
 93 
     | 
    
         
            +
                        bumpInfo.updateRules.each do |rule|
         
     | 
| 
      
 94 
     | 
    
         
            +
                            log "  #{rule.file}:", false
         
     | 
| 
      
 95 
     | 
    
         
            +
             
     | 
| 
      
 96 
     | 
    
         
            +
                            if rule.patternExists
         
     | 
| 
      
 97 
     | 
    
         
            +
                                log_green " '#{rule.beforePattern}'"
         
     | 
| 
      
 98 
     | 
    
         
            +
                            else
         
     | 
| 
      
 99 
     | 
    
         
            +
                                log_red " '#{rule.beforePattern}' (pattern not found)"
         
     | 
| 
      
 100 
     | 
    
         
            +
                            end
         
     | 
| 
       66 
101 
     | 
    
         
             
                        end
         
     | 
| 
      
 102 
     | 
    
         
            +
             
     | 
| 
       67 
103 
     | 
    
         
             
                    end
         
     | 
| 
       68 
104 
     | 
    
         | 
| 
       69 
     | 
    
         
            -
                     
     | 
| 
      
 105 
     | 
    
         
            +
                    # handler of `bmp [--info]`
         
     | 
| 
      
 106 
     | 
    
         
            +
                    def actionInfo
         
     | 
| 
       70 
107 
     | 
    
         | 
| 
       71 
     | 
    
         
            -
                         
     | 
| 
      
 108 
     | 
    
         
            +
                        bumpInfo = getBumpInfo
         
     | 
| 
       72 
109 
     | 
    
         | 
| 
       73 
     | 
    
         
            -
                         
     | 
| 
       74 
     | 
    
         
            -
             
     | 
| 
       75 
     | 
    
         
            -
                         
     | 
| 
       76 
     | 
    
         
            -
                             
     | 
| 
      
 110 
     | 
    
         
            +
                        showVersionPatterns bumpInfo
         
     | 
| 
      
 111 
     | 
    
         
            +
             
     | 
| 
      
 112 
     | 
    
         
            +
                        if bumpInfo.check
         
     | 
| 
      
 113 
     | 
    
         
            +
                            exit 0
         
     | 
| 
      
 114 
     | 
    
         
            +
                        else
         
     | 
| 
       77 
115 
     | 
    
         
             
                            exit 1
         
     | 
| 
       78 
116 
     | 
    
         
             
                        end
         
     | 
| 
       79 
117 
     | 
    
         | 
| 
      
 118 
     | 
    
         
            +
                    end
         
     | 
| 
      
 119 
     | 
    
         
            +
             
     | 
| 
      
 120 
     | 
    
         
            +
                    # handler of `bmp --patch|--minor|--major|--commit`
         
     | 
| 
      
 121 
     | 
    
         
            +
                    def actionBump
         
     | 
| 
      
 122 
     | 
    
         
            +
             
     | 
| 
      
 123 
     | 
    
         
            +
                        bumpInfo = getBumpInfo
         
     | 
| 
      
 124 
     | 
    
         
            +
             
     | 
| 
       80 
125 
     | 
    
         
             
                        if @options[:patch]
         
     | 
| 
       81 
     | 
    
         
            -
                             
     | 
| 
      
 126 
     | 
    
         
            +
                            bumpInfo.patchBump
         
     | 
| 
       82 
127 
     | 
    
         | 
| 
       83 
     | 
    
         
            -
                             
     | 
| 
       84 
     | 
    
         
            -
                             
     | 
| 
      
 128 
     | 
    
         
            +
                            log 'Bump patch level'
         
     | 
| 
      
 129 
     | 
    
         
            +
                            log_green "  #{bumpInfo.beforeVersion} => #{bumpInfo.afterVersion}"
         
     | 
| 
       85 
130 
     | 
    
         
             
                        end
         
     | 
| 
       86 
131 
     | 
    
         | 
| 
       87 
132 
     | 
    
         
             
                        if @options[:minor]
         
     | 
| 
       88 
     | 
    
         
            -
                             
     | 
| 
      
 133 
     | 
    
         
            +
                            bumpInfo.minorBump
         
     | 
| 
       89 
134 
     | 
    
         | 
| 
       90 
     | 
    
         
            -
                             
     | 
| 
       91 
     | 
    
         
            -
                             
     | 
| 
      
 135 
     | 
    
         
            +
                            log 'Bump minor level'
         
     | 
| 
      
 136 
     | 
    
         
            +
                            log_green "  #{bumpInfo.beforeVersion} => #{bumpInfo.afterVersion}"
         
     | 
| 
       92 
137 
     | 
    
         
             
                        end
         
     | 
| 
       93 
138 
     | 
    
         | 
| 
       94 
139 
     | 
    
         
             
                        if @options[:major]
         
     | 
| 
       95 
     | 
    
         
            -
                             
     | 
| 
      
 140 
     | 
    
         
            +
                            bumpInfo.majorBump
         
     | 
| 
       96 
141 
     | 
    
         | 
| 
       97 
     | 
    
         
            -
                             
     | 
| 
       98 
     | 
    
         
            -
                             
     | 
| 
      
 142 
     | 
    
         
            +
                            log 'Bump major level'
         
     | 
| 
      
 143 
     | 
    
         
            +
                            log_green "  #{bumpInfo.beforeVersion} => #{bumpInfo.afterVersion}"
         
     | 
| 
       99 
144 
     | 
    
         
             
                        end
         
     | 
| 
       100 
145 
     | 
    
         | 
| 
       101 
     | 
    
         
            -
                         
     | 
| 
      
 146 
     | 
    
         
            +
                        log
         
     | 
| 
       102 
147 
     | 
    
         | 
| 
       103 
     | 
    
         
            -
                         
     | 
| 
       104 
     | 
    
         
            -
                             
     | 
| 
      
 148 
     | 
    
         
            +
                        if not bumpInfo.check
         
     | 
| 
      
 149 
     | 
    
         
            +
                            log_red "Some patterns are invalid!"
         
     | 
| 
      
 150 
     | 
    
         
            +
                            log_red "Stops updating version numbers."
         
     | 
| 
      
 151 
     | 
    
         
            +
                            log
         
     | 
| 
       105 
152 
     | 
    
         | 
| 
       106 
     | 
    
         
            -
                             
     | 
| 
       107 
     | 
    
         
            -
                                @logger.log "#{rule.file}"
         
     | 
| 
       108 
     | 
    
         
            -
                                @logger.log "  Performed pattern replacement:"
         
     | 
| 
       109 
     | 
    
         
            -
                                @logger.log_green "    '#{rule.beforePattern}' => '#{rule.afterPattern}'"
         
     | 
| 
       110 
     | 
    
         
            -
                                @logger.log
         
     | 
| 
       111 
     | 
    
         
            -
                            else
         
     | 
| 
       112 
     | 
    
         
            -
                                @logger.log_red "  Current version pattern ('#{rule.beforePattern}') not found!"
         
     | 
| 
       113 
     | 
    
         
            -
                                @logger.log
         
     | 
| 
      
 153 
     | 
    
         
            +
                            showVersionPatterns bumpInfo
         
     | 
| 
       114 
154 
     | 
    
         | 
| 
       115 
     | 
    
         
            -
             
     | 
| 
       116 
     | 
    
         
            -
                            end
         
     | 
| 
      
 155 
     | 
    
         
            +
                            exit 1
         
     | 
| 
       117 
156 
     | 
    
         
             
                        end
         
     | 
| 
       118 
157 
     | 
    
         | 
| 
       119 
     | 
    
         
            -
                         
     | 
| 
      
 158 
     | 
    
         
            +
                        bumpInfo.performUpdate
         
     | 
| 
      
 159 
     | 
    
         
            +
             
     | 
| 
      
 160 
     | 
    
         
            +
                        bumpInfo.updateRules.each do |rule|
         
     | 
| 
      
 161 
     | 
    
         
            +
             
     | 
| 
      
 162 
     | 
    
         
            +
                            log "#{rule.file}"
         
     | 
| 
      
 163 
     | 
    
         
            +
                            log "  Performed pattern replacement:"
         
     | 
| 
      
 164 
     | 
    
         
            +
                            log_green "    '#{rule.beforePattern}' => '#{rule.afterPattern}'"
         
     | 
| 
      
 165 
     | 
    
         
            +
                            log
         
     | 
| 
      
 166 
     | 
    
         
            +
             
     | 
| 
      
 167 
     | 
    
         
            +
                        end
         
     | 
| 
      
 168 
     | 
    
         
            +
             
     | 
| 
      
 169 
     | 
    
         
            +
                        saveBumpInfo bumpInfo
         
     | 
| 
       120 
170 
     | 
    
         | 
| 
       121 
171 
     | 
    
         
             
                        comm = Command.new @logger
         
     | 
| 
       122 
172 
     | 
    
         | 
| 
       123 
173 
     | 
    
         
             
                        if @options[:commit]
         
     | 
| 
       124 
174 
     | 
    
         
             
                            comm.exec "git add ."
         
     | 
| 
       125 
     | 
    
         
            -
                            comm.exec "git commit -m 'Bump to version v#{ 
     | 
| 
       126 
     | 
    
         
            -
                            comm.exec "git tag v#{ 
     | 
| 
      
 175 
     | 
    
         
            +
                            comm.exec "git commit -m 'Bump to version v#{bumpInfo.afterVersion}'"
         
     | 
| 
      
 176 
     | 
    
         
            +
                            comm.exec "git tag v#{bumpInfo.afterVersion}"
         
     | 
| 
       127 
177 
     | 
    
         
             
                        end
         
     | 
| 
       128 
178 
     | 
    
         
             
                    end
         
     | 
| 
       129 
179 
     | 
    
         | 
| 
       130 
     | 
    
         
            -
                     
     | 
| 
       131 
     | 
    
         
            -
                        @logger.error @error_message
         
     | 
| 
       132 
     | 
    
         
            -
                    end
         
     | 
| 
       133 
     | 
    
         
            -
             
     | 
| 
      
 180 
     | 
    
         
            +
                    # The entry point
         
     | 
| 
       134 
181 
     | 
    
         
             
                    def main
         
     | 
| 
       135 
182 
     | 
    
         | 
| 
       136 
183 
     | 
    
         
             
                        action = selectAction
         
     | 
| 
         @@ -144,12 +191,40 @@ module Bump 
     | 
|
| 
       144 
191 
     | 
    
         
             
                            actionInfo
         
     | 
| 
       145 
192 
     | 
    
         
             
                        when :bump
         
     | 
| 
       146 
193 
     | 
    
         
             
                            actionBump
         
     | 
| 
       147 
     | 
    
         
            -
                        when :error
         
     | 
| 
       148 
     | 
    
         
            -
                            actionError
         
     | 
| 
       149 
194 
     | 
    
         
             
                        end
         
     | 
| 
       150 
195 
     | 
    
         | 
| 
       151 
196 
     | 
    
         
             
                    end
         
     | 
| 
       152 
197 
     | 
    
         | 
| 
      
 198 
     | 
    
         
            +
                    # Logs the message
         
     | 
| 
      
 199 
     | 
    
         
            +
                    #
         
     | 
| 
      
 200 
     | 
    
         
            +
                    # @param [String] message
         
     | 
| 
      
 201 
     | 
    
         
            +
                    # @param [Boolean] newline
         
     | 
| 
      
 202 
     | 
    
         
            +
                    def log message = '', newline = true
         
     | 
| 
      
 203 
     | 
    
         
            +
             
     | 
| 
      
 204 
     | 
    
         
            +
                        @logger.log message, newline
         
     | 
| 
      
 205 
     | 
    
         
            +
             
     | 
| 
      
 206 
     | 
    
         
            +
                    end
         
     | 
| 
      
 207 
     | 
    
         
            +
             
     | 
| 
      
 208 
     | 
    
         
            +
                    # Logs the message in red
         
     | 
| 
      
 209 
     | 
    
         
            +
                    #
         
     | 
| 
      
 210 
     | 
    
         
            +
                    # @param [String] message
         
     | 
| 
      
 211 
     | 
    
         
            +
                    # @param [Boolean] newline
         
     | 
| 
      
 212 
     | 
    
         
            +
                    def log_red message, newline = true
         
     | 
| 
      
 213 
     | 
    
         
            +
             
     | 
| 
      
 214 
     | 
    
         
            +
                        @logger.log_red message, newline
         
     | 
| 
      
 215 
     | 
    
         
            +
             
     | 
| 
      
 216 
     | 
    
         
            +
                    end
         
     | 
| 
      
 217 
     | 
    
         
            +
             
     | 
| 
      
 218 
     | 
    
         
            +
                    # Logs the message in green
         
     | 
| 
      
 219 
     | 
    
         
            +
                    #
         
     | 
| 
      
 220 
     | 
    
         
            +
                    # @param [String] message
         
     | 
| 
      
 221 
     | 
    
         
            +
                    # @param [Boolean] newline
         
     | 
| 
      
 222 
     | 
    
         
            +
                    def log_green message, newline = true
         
     | 
| 
      
 223 
     | 
    
         
            +
             
     | 
| 
      
 224 
     | 
    
         
            +
                        @logger.log_green message, newline
         
     | 
| 
      
 225 
     | 
    
         
            +
             
     | 
| 
      
 226 
     | 
    
         
            +
                    end
         
     | 
| 
      
 227 
     | 
    
         
            +
             
     | 
| 
       153 
228 
     | 
    
         
             
                end
         
     | 
| 
       154 
229 
     | 
    
         | 
| 
       155 
230 
     | 
    
         
             
            end
         
     | 
    
        data/lib/bump/domain.rb
    CHANGED
    
    | 
         @@ -1,8 +1,8 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # lib/bump/domain.rb
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
     | 
    
         
            -
            require 'bump/domain/ 
     | 
| 
       4 
     | 
    
         
            -
            require 'bump/domain/ 
     | 
| 
       5 
     | 
    
         
            -
            require 'bump/domain/ 
     | 
| 
       6 
     | 
    
         
            -
            require 'bump/domain/ 
     | 
| 
       7 
     | 
    
         
            -
            require 'bump/domain/ 
     | 
| 
       8 
     | 
    
         
            -
            require 'bump/domain/ 
     | 
| 
      
 3 
     | 
    
         
            +
            require 'bump/domain/version_number'
         
     | 
| 
      
 4 
     | 
    
         
            +
            require 'bump/domain/version_number_factory'
         
     | 
| 
      
 5 
     | 
    
         
            +
            require 'bump/domain/bump_info'
         
     | 
| 
      
 6 
     | 
    
         
            +
            require 'bump/domain/bump_info_repository'
         
     | 
| 
      
 7 
     | 
    
         
            +
            require 'bump/domain/file_update_rule'
         
     | 
| 
      
 8 
     | 
    
         
            +
            require 'bump/domain/file_update_rule_factory'
         
     | 
| 
         @@ -0,0 +1,99 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
             
     | 
| 
      
 2 
     | 
    
         
            +
            require 'yaml'
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            module Bump
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
                class BumpInfo
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
                    # @param [Bump::VersionNumber] version
         
     | 
| 
      
 9 
     | 
    
         
            +
                    # @param [Array] files
         
     | 
| 
      
 10 
     | 
    
         
            +
                    def initialize version, files
         
     | 
| 
      
 11 
     | 
    
         
            +
                        @version = version
         
     | 
| 
      
 12 
     | 
    
         
            +
                        @files = files
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
                        @before_version = @version.to_s
         
     | 
| 
      
 15 
     | 
    
         
            +
                        @after_version = @version.to_s
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
                    end
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
                    def version
         
     | 
| 
      
 20 
     | 
    
         
            +
                        @version
         
     | 
| 
      
 21 
     | 
    
         
            +
                    end
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
                    def files
         
     | 
| 
      
 24 
     | 
    
         
            +
                        @files
         
     | 
| 
      
 25 
     | 
    
         
            +
                    end
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
                    def majorBump
         
     | 
| 
      
 28 
     | 
    
         
            +
                        @version.bump 'major'
         
     | 
| 
      
 29 
     | 
    
         
            +
                        @after_version = @version.to_s
         
     | 
| 
      
 30 
     | 
    
         
            +
                    end
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
                    def minorBump
         
     | 
| 
      
 33 
     | 
    
         
            +
                        @version.bump 'minor'
         
     | 
| 
      
 34 
     | 
    
         
            +
                        @after_version = @version.to_s
         
     | 
| 
      
 35 
     | 
    
         
            +
                    end
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
                    def patchBump
         
     | 
| 
      
 38 
     | 
    
         
            +
                        @version.bump 'patch'
         
     | 
| 
      
 39 
     | 
    
         
            +
                        @after_version = @version.to_s
         
     | 
| 
      
 40 
     | 
    
         
            +
                    end
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
                    def updateRules
         
     | 
| 
      
 43 
     | 
    
         
            +
                        createUpdateRules
         
     | 
| 
      
 44 
     | 
    
         
            +
                    end
         
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
      
 46 
     | 
    
         
            +
                    # Creates file update rules according to the current settings.
         
     | 
| 
      
 47 
     | 
    
         
            +
                    #
         
     | 
| 
      
 48 
     | 
    
         
            +
                    # @return [Bump::FileUpdateRule[]]
         
     | 
| 
      
 49 
     | 
    
         
            +
                    def createUpdateRules
         
     | 
| 
      
 50 
     | 
    
         
            +
                        @files.map { |file, pattern|
         
     | 
| 
      
 51 
     | 
    
         
            +
                            FileUpdateRuleFactory.create(file, pattern, @before_version, @after_version)
         
     | 
| 
      
 52 
     | 
    
         
            +
                        }.flatten
         
     | 
| 
      
 53 
     | 
    
         
            +
                    end
         
     | 
| 
      
 54 
     | 
    
         
            +
             
     | 
| 
      
 55 
     | 
    
         
            +
                    # Performs all updates.
         
     | 
| 
      
 56 
     | 
    
         
            +
                    def performUpdate
         
     | 
| 
      
 57 
     | 
    
         
            +
             
     | 
| 
      
 58 
     | 
    
         
            +
                        createUpdateRules.each do |rule|
         
     | 
| 
      
 59 
     | 
    
         
            +
             
     | 
| 
      
 60 
     | 
    
         
            +
                            rule.perform
         
     | 
| 
      
 61 
     | 
    
         
            +
             
     | 
| 
      
 62 
     | 
    
         
            +
                        end
         
     | 
| 
      
 63 
     | 
    
         
            +
             
     | 
| 
      
 64 
     | 
    
         
            +
                    end
         
     | 
| 
      
 65 
     | 
    
         
            +
             
     | 
| 
      
 66 
     | 
    
         
            +
                    # Checks the all the version patterns are available
         
     | 
| 
      
 67 
     | 
    
         
            +
                    #
         
     | 
| 
      
 68 
     | 
    
         
            +
                    # @return [Boolean]
         
     | 
| 
      
 69 
     | 
    
         
            +
                    def check
         
     | 
| 
      
 70 
     | 
    
         
            +
             
     | 
| 
      
 71 
     | 
    
         
            +
                        createUpdateRules.each do |rule|
         
     | 
| 
      
 72 
     | 
    
         
            +
             
     | 
| 
      
 73 
     | 
    
         
            +
                            if not rule.patternExists
         
     | 
| 
      
 74 
     | 
    
         
            +
                                return false
         
     | 
| 
      
 75 
     | 
    
         
            +
                            end
         
     | 
| 
      
 76 
     | 
    
         
            +
             
     | 
| 
      
 77 
     | 
    
         
            +
                        end
         
     | 
| 
      
 78 
     | 
    
         
            +
             
     | 
| 
      
 79 
     | 
    
         
            +
                        return true
         
     | 
| 
      
 80 
     | 
    
         
            +
             
     | 
| 
      
 81 
     | 
    
         
            +
                    end
         
     | 
| 
      
 82 
     | 
    
         
            +
             
     | 
| 
      
 83 
     | 
    
         
            +
                    # Returns the version number after the bumping.
         
     | 
| 
      
 84 
     | 
    
         
            +
                    #
         
     | 
| 
      
 85 
     | 
    
         
            +
                    # @return [String]
         
     | 
| 
      
 86 
     | 
    
         
            +
                    def afterVersion
         
     | 
| 
      
 87 
     | 
    
         
            +
                        @after_version
         
     | 
| 
      
 88 
     | 
    
         
            +
                    end
         
     | 
| 
      
 89 
     | 
    
         
            +
             
     | 
| 
      
 90 
     | 
    
         
            +
                    # Returns the version number before the bumping.
         
     | 
| 
      
 91 
     | 
    
         
            +
                    #
         
     | 
| 
      
 92 
     | 
    
         
            +
                    # @return [String]
         
     | 
| 
      
 93 
     | 
    
         
            +
                    def beforeVersion
         
     | 
| 
      
 94 
     | 
    
         
            +
                        @before_version
         
     | 
| 
      
 95 
     | 
    
         
            +
                    end
         
     | 
| 
      
 96 
     | 
    
         
            +
             
     | 
| 
      
 97 
     | 
    
         
            +
                end
         
     | 
| 
      
 98 
     | 
    
         
            +
             
     | 
| 
      
 99 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,44 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
             
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            require 'yaml'
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            module Bump
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
                class BumpInfoRepository
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
                    def initialize file
         
     | 
| 
      
 10 
     | 
    
         
            +
                        @file = file
         
     | 
| 
      
 11 
     | 
    
         
            +
                    end
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
                    # Gets the bump info from the given file
         
     | 
| 
      
 14 
     | 
    
         
            +
                    #
         
     | 
| 
      
 15 
     | 
    
         
            +
                    # @param [String] file
         
     | 
| 
      
 16 
     | 
    
         
            +
                    def fromFile
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
                        config = YAML.load_file @file
         
     | 
| 
      
 19 
     | 
    
         
            +
                        version = VersionNumberFactory.fromString config['version']
         
     | 
| 
      
 20 
     | 
    
         
            +
                        files = config['files']
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
                        BumpInfo.new version, files
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
                    end
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
                    # Saves the bump info
         
     | 
| 
      
 27 
     | 
    
         
            +
                    #
         
     | 
| 
      
 28 
     | 
    
         
            +
                    # @param [Bump::BumpInfo] bumpInfo
         
     | 
| 
      
 29 
     | 
    
         
            +
                    def save bumpInfo
         
     | 
| 
      
 30 
     | 
    
         
            +
                        File.write @file, toYaml(bumpInfo)
         
     | 
| 
      
 31 
     | 
    
         
            +
                    end
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
                    # @private
         
     | 
| 
      
 34 
     | 
    
         
            +
                    # @param [Bump::BumpInfo] bumpInfo
         
     | 
| 
      
 35 
     | 
    
         
            +
                    # @return [Hash]
         
     | 
| 
      
 36 
     | 
    
         
            +
                    def toYaml bumpInfo
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
                        {"version" => bumpInfo.version.to_s, "files" => bumpInfo.files}.to_yaml
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
                    end
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
                end
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -2,18 +2,19 @@ 
     | 
|
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            module Bump
         
     | 
| 
       4 
4 
     | 
    
         | 
| 
       5 
     | 
    
         
            -
                class  
     | 
| 
      
 5 
     | 
    
         
            +
                class FileUpdateRule
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
7 
     | 
    
         
             
                    PLACEHOLDER_PATTERN = '%.%.%'
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
      
 9 
     | 
    
         
            +
                    # @param [String] file
         
     | 
| 
      
 10 
     | 
    
         
            +
                    # @param [String] pattern
         
     | 
| 
      
 11 
     | 
    
         
            +
                    # @param [Bump::VersionNumber] before_version
         
     | 
| 
      
 12 
     | 
    
         
            +
                    # @param [Bump::VersionNumber] after_version
         
     | 
| 
       9 
13 
     | 
    
         
             
                    def initialize(file, pattern, before_version, after_version)
         
     | 
| 
       10 
14 
     | 
    
         
             
                        @file = file
         
     | 
| 
       11 
15 
     | 
    
         
             
                        @pattern = pattern || PLACEHOLDER_PATTERN # default pattern is '%.%.%'
         
     | 
| 
       12 
16 
     | 
    
         
             
                        @before_version = before_version
         
     | 
| 
       13 
17 
     | 
    
         
             
                        @after_version = after_version
         
     | 
| 
       14 
     | 
    
         
            -
                    end
         
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
                    def prepare
         
     | 
| 
       17 
18 
     | 
    
         
             
                        @before_pattern = @pattern.sub PLACEHOLDER_PATTERN, @before_version
         
     | 
| 
       18 
19 
     | 
    
         
             
                        @after_pattern = @pattern.sub PLACEHOLDER_PATTERN, @after_version
         
     | 
| 
       19 
20 
     | 
    
         
             
                    end
         
     | 
| 
         @@ -30,17 +31,33 @@ module Bump 
     | 
|
| 
       30 
31 
     | 
    
         
             
                        @after_pattern
         
     | 
| 
       31 
32 
     | 
    
         
             
                    end
         
     | 
| 
       32 
33 
     | 
    
         | 
| 
       33 
     | 
    
         
            -
                    def  
     | 
| 
       34 
     | 
    
         
            -
                         
     | 
| 
      
 34 
     | 
    
         
            +
                    def fileGetContents
         
     | 
| 
      
 35 
     | 
    
         
            +
                        File.read @file, :encoding => Encoding::UTF_8
         
     | 
| 
      
 36 
     | 
    
         
            +
                    end
         
     | 
| 
       35 
37 
     | 
    
         | 
| 
       36 
     | 
    
         
            -
             
     | 
| 
      
 38 
     | 
    
         
            +
                    # Checks if the pattern found in the file
         
     | 
| 
      
 39 
     | 
    
         
            +
                    #
         
     | 
| 
      
 40 
     | 
    
         
            +
                    # @return [Boolean]
         
     | 
| 
      
 41 
     | 
    
         
            +
                    def patternExists
         
     | 
| 
      
 42 
     | 
    
         
            +
                        fileGetContents.index @before_pattern
         
     | 
| 
      
 43 
     | 
    
         
            +
                    end
         
     | 
| 
      
 44 
     | 
    
         
            +
             
     | 
| 
      
 45 
     | 
    
         
            +
                    # Performs file update
         
     | 
| 
      
 46 
     | 
    
         
            +
                    #
         
     | 
| 
      
 47 
     | 
    
         
            +
                    # @return [Boolean]
         
     | 
| 
      
 48 
     | 
    
         
            +
                    def perform
         
     | 
| 
      
 49 
     | 
    
         
            +
                        contents = fileGetContents
         
     | 
| 
       37 
50 
     | 
    
         | 
| 
       38 
51 
     | 
    
         
             
                        if contents.index @before_pattern
         
     | 
| 
      
 52 
     | 
    
         
            +
             
     | 
| 
       39 
53 
     | 
    
         
             
                            File.write @file, contents.sub(@before_pattern, @after_pattern)
         
     | 
| 
       40 
54 
     | 
    
         | 
| 
       41 
55 
     | 
    
         
             
                            return true
         
     | 
| 
      
 56 
     | 
    
         
            +
             
     | 
| 
       42 
57 
     | 
    
         
             
                        else
         
     | 
| 
      
 58 
     | 
    
         
            +
             
     | 
| 
       43 
59 
     | 
    
         
             
                            return false
         
     | 
| 
      
 60 
     | 
    
         
            +
             
     | 
| 
       44 
61 
     | 
    
         
             
                        end
         
     | 
| 
       45 
62 
     | 
    
         
             
                    end
         
     | 
| 
       46 
63 
     | 
    
         | 
| 
         @@ -0,0 +1,28 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
             
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            module Bump
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
                class FileUpdateRuleFactory
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
                    # Creates the file update rule from the given params.
         
     | 
| 
      
 8 
     | 
    
         
            +
                    #
         
     | 
| 
      
 9 
     | 
    
         
            +
                    # @param [String] file The filename
         
     | 
| 
      
 10 
     | 
    
         
            +
                    # @param [String|Array] param The version update info
         
     | 
| 
      
 11 
     | 
    
         
            +
                    # @param [String] before_version
         
     | 
| 
      
 12 
     | 
    
         
            +
                    # @param [String] after_version
         
     | 
| 
      
 13 
     | 
    
         
            +
                    def self.create file, param, before_version, after_version
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
                        case param
         
     | 
| 
      
 16 
     | 
    
         
            +
                        when String
         
     | 
| 
      
 17 
     | 
    
         
            +
                            return FileUpdateRule.new file, param, before_version, after_version
         
     | 
| 
      
 18 
     | 
    
         
            +
                        when Array
         
     | 
| 
      
 19 
     | 
    
         
            +
                            return param.map { |param| FileUpdateRule.new file, param, before_version, after_version }.flatten
         
     | 
| 
      
 20 
     | 
    
         
            +
                        else
         
     | 
| 
      
 21 
     | 
    
         
            +
                            return FileUpdateRule.new file, nil, before_version, after_version
         
     | 
| 
      
 22 
     | 
    
         
            +
                        end
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
                    end
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
                end
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -2,14 +2,14 @@ 
     | 
|
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            module Bump
         
     | 
| 
       4 
4 
     | 
    
         | 
| 
       5 
     | 
    
         
            -
                class  
     | 
| 
      
 5 
     | 
    
         
            +
                class VersionNumberFactory
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
7 
     | 
    
         
             
                    VERSION_REGEXP = /^(\d+).(\d+).(\d+)(\S*)$/
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
       9 
9 
     | 
    
         
             
                    def self.fromString version_string
         
     | 
| 
       10 
10 
     | 
    
         
             
                        match = VERSION_REGEXP.match version_string
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
       12 
     | 
    
         
            -
                        return  
     | 
| 
      
 12 
     | 
    
         
            +
                        return VersionNumber.new match[1].to_i, match[2].to_i, match[3].to_i, match[4]
         
     | 
| 
       13 
13 
     | 
    
         
             
                    end
         
     | 
| 
       14 
14 
     | 
    
         | 
| 
       15 
15 
     | 
    
         
             
                end
         
     | 
    
        data/lib/bump/version.rb
    CHANGED
    
    
| 
         @@ -2,12 +2,12 @@ 
     | 
|
| 
       2 
2 
     | 
    
         
             
            require 'bump'
         
     | 
| 
       3 
3 
     | 
    
         
             
            require 'spec_helper'
         
     | 
| 
       4 
4 
     | 
    
         | 
| 
       5 
     | 
    
         
            -
            describe Bump:: 
     | 
| 
      
 5 
     | 
    
         
            +
            describe Bump::FileUpdateRule do
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
7 
     | 
    
         
             
                describe '#file' do
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
       9 
9 
     | 
    
         
             
                    it 'returns file property' do
         
     | 
| 
       10 
     | 
    
         
            -
                        rule = Bump:: 
     | 
| 
      
 10 
     | 
    
         
            +
                        rule = Bump::FileUpdateRule.new 'abc', '%.%.%', '0.0.1', '1.0.0'
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
       12 
12 
     | 
    
         
             
                        expect(rule.file).to eq 'abc'
         
     | 
| 
       13 
13 
     | 
    
         
             
                    end
         
     | 
| 
         @@ -17,9 +17,7 @@ describe Bump::FileRewriteRule do 
     | 
|
| 
       17 
17 
     | 
    
         
             
                describe '#beforePattern' do
         
     | 
| 
       18 
18 
     | 
    
         | 
| 
       19 
19 
     | 
    
         
             
                    it 'returns before_pattern property' do
         
     | 
| 
       20 
     | 
    
         
            -
                        rule = Bump:: 
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
                        rule.prepare
         
     | 
| 
      
 20 
     | 
    
         
            +
                        rule = Bump::FileUpdateRule.new 'abc', 'v%.%.%', '0.0.1', '1.0.0'
         
     | 
| 
       23 
21 
     | 
    
         | 
| 
       24 
22 
     | 
    
         
             
                        expect(rule.beforePattern).to eq 'v0.0.1'
         
     | 
| 
       25 
23 
     | 
    
         
             
                    end
         
     | 
| 
         @@ -29,13 +27,21 @@ describe Bump::FileRewriteRule do 
     | 
|
| 
       29 
27 
     | 
    
         
             
                describe '#afterPattern' do
         
     | 
| 
       30 
28 
     | 
    
         | 
| 
       31 
29 
     | 
    
         
             
                    it 'returns before_pattern property' do
         
     | 
| 
       32 
     | 
    
         
            -
                        rule = Bump:: 
     | 
| 
       33 
     | 
    
         
            -
             
     | 
| 
       34 
     | 
    
         
            -
                        rule.prepare
         
     | 
| 
      
 30 
     | 
    
         
            +
                        rule = Bump::FileUpdateRule.new 'abc', 'v%.%.%', '0.0.1', '1.0.0'
         
     | 
| 
       35 
31 
     | 
    
         | 
| 
       36 
32 
     | 
    
         
             
                        expect(rule.afterPattern).to eq 'v1.0.0'
         
     | 
| 
       37 
33 
     | 
    
         
             
                    end
         
     | 
| 
       38 
34 
     | 
    
         | 
| 
       39 
35 
     | 
    
         
             
                end
         
     | 
| 
       40 
36 
     | 
    
         | 
| 
      
 37 
     | 
    
         
            +
                describe '#patternExists' do
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
                    it 'checks if the given pattern found in the file' do
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
                        rule = Bump::FileUpdateRule.new 'abc', 'v%.%.%', '0.0.1', '1.0.0'
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
                    end
         
     | 
| 
      
 44 
     | 
    
         
            +
             
     | 
| 
      
 45 
     | 
    
         
            +
                end
         
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
       41 
47 
     | 
    
         
             
            end
         
     | 
| 
         @@ -2,13 +2,13 @@ 
     | 
|
| 
       2 
2 
     | 
    
         
             
            require 'bump'
         
     | 
| 
       3 
3 
     | 
    
         
             
            require 'spec_helper'
         
     | 
| 
       4 
4 
     | 
    
         | 
| 
       5 
     | 
    
         
            -
            describe Bump:: 
     | 
| 
      
 5 
     | 
    
         
            +
            describe Bump::VersionNumberFactory do
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
7 
     | 
    
         
             
                describe "#fromString" do
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
       9 
9 
     | 
    
         
             
                    it "creates version object from version string" do
         
     | 
| 
       10 
10 
     | 
    
         | 
| 
       11 
     | 
    
         
            -
                        version = Bump:: 
     | 
| 
      
 11 
     | 
    
         
            +
                        version = Bump::VersionNumberFactory.fromString "1.2.3a"
         
     | 
| 
       12 
12 
     | 
    
         | 
| 
       13 
13 
     | 
    
         
             
                        expect(version.to_s).to eq "1.2.3a"
         
     | 
| 
       14 
14 
     | 
    
         | 
| 
         @@ -28,7 +28,7 @@ describe Bump::VersionFactory do 
     | 
|
| 
       28 
28 
     | 
    
         | 
| 
       29 
29 
     | 
    
         
             
                        expect(version.to_s).to eq "2.0.0rc1"
         
     | 
| 
       30 
30 
     | 
    
         | 
| 
       31 
     | 
    
         
            -
                        version = Bump:: 
     | 
| 
      
 31 
     | 
    
         
            +
                        version = Bump::VersionNumberFactory.fromString "1.2.100abc"
         
     | 
| 
       32 
32 
     | 
    
         | 
| 
       33 
33 
     | 
    
         
             
                        version.patchBump
         
     | 
| 
       34 
34 
     | 
    
         | 
| 
         @@ -3,19 +3,19 @@ 
     | 
|
| 
       3 
3 
     | 
    
         
             
            require 'bump'
         
     | 
| 
       4 
4 
     | 
    
         
             
            require 'spec_helper'
         
     | 
| 
       5 
5 
     | 
    
         | 
| 
       6 
     | 
    
         
            -
            describe Bump:: 
     | 
| 
      
 6 
     | 
    
         
            +
            describe Bump::VersionNumber do
         
     | 
| 
       7 
7 
     | 
    
         | 
| 
       8 
8 
     | 
    
         
             
                describe "#to_s" do
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
       10 
10 
     | 
    
         
             
                    it "returns version string" do
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
       12 
12 
     | 
    
         
             
                        # no suffix
         
     | 
| 
       13 
     | 
    
         
            -
                        version = Bump:: 
     | 
| 
      
 13 
     | 
    
         
            +
                        version = Bump::VersionNumber.new 1, 2, 3
         
     | 
| 
       14 
14 
     | 
    
         | 
| 
       15 
15 
     | 
    
         
             
                        expect(version.to_s).to eq '1.2.3'
         
     | 
| 
       16 
16 
     | 
    
         | 
| 
       17 
17 
     | 
    
         
             
                        # with a suffix
         
     | 
| 
       18 
     | 
    
         
            -
                        version = Bump:: 
     | 
| 
      
 18 
     | 
    
         
            +
                        version = Bump::VersionNumber.new 1, 2, 3, 'rc1'
         
     | 
| 
       19 
19 
     | 
    
         | 
| 
       20 
20 
     | 
    
         
             
                        expect(version.to_s).to eq '1.2.3rc1'
         
     | 
| 
       21 
21 
     | 
    
         | 
| 
         @@ -27,7 +27,7 @@ describe Bump::Version do 
     | 
|
| 
       27 
27 
     | 
    
         | 
| 
       28 
28 
     | 
    
         
             
                    it "bumps patch level" do
         
     | 
| 
       29 
29 
     | 
    
         | 
| 
       30 
     | 
    
         
            -
                        version = Bump:: 
     | 
| 
      
 30 
     | 
    
         
            +
                        version = Bump::VersionNumber.new 1, 2, 3
         
     | 
| 
       31 
31 
     | 
    
         | 
| 
       32 
32 
     | 
    
         
             
                        version.patchBump
         
     | 
| 
       33 
33 
     | 
    
         | 
| 
         @@ -37,7 +37,7 @@ describe Bump::Version do 
     | 
|
| 
       37 
37 
     | 
    
         | 
| 
       38 
38 
     | 
    
         
             
                    it "bumps 0.1.10 to 0.1.11" do
         
     | 
| 
       39 
39 
     | 
    
         | 
| 
       40 
     | 
    
         
            -
                        version = Bump:: 
     | 
| 
      
 40 
     | 
    
         
            +
                        version = Bump::VersionNumber.new 0, 1, 10
         
     | 
| 
       41 
41 
     | 
    
         | 
| 
       42 
42 
     | 
    
         
             
                        version.patchBump
         
     | 
| 
       43 
43 
     | 
    
         | 
| 
         @@ -47,7 +47,7 @@ describe Bump::Version do 
     | 
|
| 
       47 
47 
     | 
    
         | 
| 
       48 
48 
     | 
    
         
             
                    it "remove suffix if it is set" do
         
     | 
| 
       49 
49 
     | 
    
         | 
| 
       50 
     | 
    
         
            -
                        version = Bump:: 
     | 
| 
      
 50 
     | 
    
         
            +
                        version = Bump::VersionNumber.new 1, 2, 3, 'rc1'
         
     | 
| 
       51 
51 
     | 
    
         | 
| 
       52 
52 
     | 
    
         
             
                        version.patchBump
         
     | 
| 
       53 
53 
     | 
    
         | 
| 
         @@ -61,7 +61,7 @@ describe Bump::Version do 
     | 
|
| 
       61 
61 
     | 
    
         | 
| 
       62 
62 
     | 
    
         
             
                    it "bumps patch level" do
         
     | 
| 
       63 
63 
     | 
    
         | 
| 
       64 
     | 
    
         
            -
                        version = Bump:: 
     | 
| 
      
 64 
     | 
    
         
            +
                        version = Bump::VersionNumber.new 1, 2, 3
         
     | 
| 
       65 
65 
     | 
    
         | 
| 
       66 
66 
     | 
    
         
             
                        version.minorBump
         
     | 
| 
       67 
67 
     | 
    
         | 
| 
         @@ -71,7 +71,7 @@ describe Bump::Version do 
     | 
|
| 
       71 
71 
     | 
    
         | 
| 
       72 
72 
     | 
    
         
             
                    it "remove suffix if it is set" do
         
     | 
| 
       73 
73 
     | 
    
         | 
| 
       74 
     | 
    
         
            -
                        version = Bump:: 
     | 
| 
      
 74 
     | 
    
         
            +
                        version = Bump::VersionNumber.new 1, 2, 3, 'rc1'
         
     | 
| 
       75 
75 
     | 
    
         | 
| 
       76 
76 
     | 
    
         
             
                        version.minorBump
         
     | 
| 
       77 
77 
     | 
    
         | 
| 
         @@ -85,7 +85,7 @@ describe Bump::Version do 
     | 
|
| 
       85 
85 
     | 
    
         | 
| 
       86 
86 
     | 
    
         
             
                    it "bumps patch level" do
         
     | 
| 
       87 
87 
     | 
    
         | 
| 
       88 
     | 
    
         
            -
                        version = Bump:: 
     | 
| 
      
 88 
     | 
    
         
            +
                        version = Bump::VersionNumber.new 1, 2, 3
         
     | 
| 
       89 
89 
     | 
    
         | 
| 
       90 
90 
     | 
    
         
             
                        version.majorBump
         
     | 
| 
       91 
91 
     | 
    
         | 
| 
         @@ -95,7 +95,7 @@ describe Bump::Version do 
     | 
|
| 
       95 
95 
     | 
    
         | 
| 
       96 
96 
     | 
    
         
             
                    it "remove suffix if it is set" do
         
     | 
| 
       97 
97 
     | 
    
         | 
| 
       98 
     | 
    
         
            -
                        version = Bump:: 
     | 
| 
      
 98 
     | 
    
         
            +
                        version = Bump::VersionNumber.new 1, 2, 3, 'rc1'
         
     | 
| 
       99 
99 
     | 
    
         | 
| 
       100 
100 
     | 
    
         
             
                        version.majorBump
         
     | 
| 
       101 
101 
     | 
    
         | 
| 
         @@ -109,7 +109,7 @@ describe Bump::Version do 
     | 
|
| 
       109 
109 
     | 
    
         | 
| 
       110 
110 
     | 
    
         
             
                    it "appends a suffix" do
         
     | 
| 
       111 
111 
     | 
    
         | 
| 
       112 
     | 
    
         
            -
                        version = Bump:: 
     | 
| 
      
 112 
     | 
    
         
            +
                        version = Bump::VersionNumber.new 1, 2, 3
         
     | 
| 
       113 
113 
     | 
    
         | 
| 
       114 
114 
     | 
    
         
             
                        version.append 'rc1'
         
     | 
| 
       115 
115 
     | 
    
         | 
| 
         @@ -119,7 +119,7 @@ describe Bump::Version do 
     | 
|
| 
       119 
119 
     | 
    
         | 
| 
       120 
120 
     | 
    
         
             
                    it "rewrite the suffix if it is already set" do
         
     | 
| 
       121 
121 
     | 
    
         | 
| 
       122 
     | 
    
         
            -
                        version = Bump:: 
     | 
| 
      
 122 
     | 
    
         
            +
                        version = Bump::VersionNumber.new 1, 2, 3, 'rc1'
         
     | 
| 
       123 
123 
     | 
    
         | 
| 
       124 
124 
     | 
    
         
             
                        version.append 'rc2'
         
     | 
| 
       125 
125 
     | 
    
         | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: bmp
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.9.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Yoshiya Hinosawa
         
     | 
| 
         @@ -61,6 +61,7 @@ extensions: [] 
     | 
|
| 
       61 
61 
     | 
    
         
             
            extra_rdoc_files: []
         
     | 
| 
       62 
62 
     | 
    
         
             
            files:
         
     | 
| 
       63 
63 
     | 
    
         
             
            - ".bmp.yml"
         
     | 
| 
      
 64 
     | 
    
         
            +
            - ".editorconfig"
         
     | 
| 
       64 
65 
     | 
    
         
             
            - ".gitignore"
         
     | 
| 
       65 
66 
     | 
    
         
             
            - ".travis.yml"
         
     | 
| 
       66 
67 
     | 
    
         
             
            - Gemfile
         
     | 
| 
         @@ -76,22 +77,22 @@ files: 
     | 
|
| 
       76 
77 
     | 
    
         
             
            - lib/bump/cli.rb
         
     | 
| 
       77 
78 
     | 
    
         
             
            - lib/bump/command.rb
         
     | 
| 
       78 
79 
     | 
    
         
             
            - lib/bump/domain.rb
         
     | 
| 
       79 
     | 
    
         
            -
            - lib/bump/domain/ 
     | 
| 
       80 
     | 
    
         
            -
            - lib/bump/domain/ 
     | 
| 
       81 
     | 
    
         
            -
            - lib/bump/domain/ 
     | 
| 
       82 
     | 
    
         
            -
            - lib/bump/domain/ 
     | 
| 
       83 
     | 
    
         
            -
            - lib/bump/domain/ 
     | 
| 
       84 
     | 
    
         
            -
            - lib/bump/domain/ 
     | 
| 
      
 80 
     | 
    
         
            +
            - lib/bump/domain/bump_info.rb
         
     | 
| 
      
 81 
     | 
    
         
            +
            - lib/bump/domain/bump_info_repository.rb
         
     | 
| 
      
 82 
     | 
    
         
            +
            - lib/bump/domain/file_update_rule.rb
         
     | 
| 
      
 83 
     | 
    
         
            +
            - lib/bump/domain/file_update_rule_factory.rb
         
     | 
| 
      
 84 
     | 
    
         
            +
            - lib/bump/domain/version_number.rb
         
     | 
| 
      
 85 
     | 
    
         
            +
            - lib/bump/domain/version_number_factory.rb
         
     | 
| 
       85 
86 
     | 
    
         
             
            - lib/bump/logger.rb
         
     | 
| 
       86 
87 
     | 
    
         
             
            - lib/bump/version.rb
         
     | 
| 
       87 
88 
     | 
    
         
             
            - spec/bump/application_spec.rb
         
     | 
| 
       88 
89 
     | 
    
         
             
            - spec/bump/cli_spec.rb
         
     | 
| 
       89 
     | 
    
         
            -
            - spec/bump/domain/ 
     | 
| 
       90 
     | 
    
         
            -
            - spec/bump/domain/ 
     | 
| 
       91 
     | 
    
         
            -
            - spec/bump/domain/ 
     | 
| 
       92 
     | 
    
         
            -
            - spec/bump/domain/ 
     | 
| 
       93 
     | 
    
         
            -
            - spec/bump/domain/ 
     | 
| 
       94 
     | 
    
         
            -
            - spec/bump/domain/ 
     | 
| 
      
 90 
     | 
    
         
            +
            - spec/bump/domain/bump_info_repository_spec.rb
         
     | 
| 
      
 91 
     | 
    
         
            +
            - spec/bump/domain/bump_info_spec.rb
         
     | 
| 
      
 92 
     | 
    
         
            +
            - spec/bump/domain/file_update_rule_factory_spec.rb
         
     | 
| 
      
 93 
     | 
    
         
            +
            - spec/bump/domain/file_update_rule_spec.rb
         
     | 
| 
      
 94 
     | 
    
         
            +
            - spec/bump/domain/version_number_factory_spec.rb
         
     | 
| 
      
 95 
     | 
    
         
            +
            - spec/bump/domain/version_number_spec.rb
         
     | 
| 
       95 
96 
     | 
    
         
             
            - spec/bump/logger_spec.rb
         
     | 
| 
       96 
97 
     | 
    
         
             
            - spec/spec_helper.rb
         
     | 
| 
       97 
98 
     | 
    
         
             
            homepage: https://github.com/kt3k/bump
         
     | 
| 
         @@ -121,11 +122,11 @@ summary: No hassle on bumping 
     | 
|
| 
       121 
122 
     | 
    
         
             
            test_files:
         
     | 
| 
       122 
123 
     | 
    
         
             
            - spec/bump/application_spec.rb
         
     | 
| 
       123 
124 
     | 
    
         
             
            - spec/bump/cli_spec.rb
         
     | 
| 
       124 
     | 
    
         
            -
            - spec/bump/domain/ 
     | 
| 
       125 
     | 
    
         
            -
            - spec/bump/domain/ 
     | 
| 
       126 
     | 
    
         
            -
            - spec/bump/domain/ 
     | 
| 
       127 
     | 
    
         
            -
            - spec/bump/domain/ 
     | 
| 
       128 
     | 
    
         
            -
            - spec/bump/domain/ 
     | 
| 
       129 
     | 
    
         
            -
            - spec/bump/domain/ 
     | 
| 
      
 125 
     | 
    
         
            +
            - spec/bump/domain/bump_info_repository_spec.rb
         
     | 
| 
      
 126 
     | 
    
         
            +
            - spec/bump/domain/bump_info_spec.rb
         
     | 
| 
      
 127 
     | 
    
         
            +
            - spec/bump/domain/file_update_rule_factory_spec.rb
         
     | 
| 
      
 128 
     | 
    
         
            +
            - spec/bump/domain/file_update_rule_spec.rb
         
     | 
| 
      
 129 
     | 
    
         
            +
            - spec/bump/domain/version_number_factory_spec.rb
         
     | 
| 
      
 130 
     | 
    
         
            +
            - spec/bump/domain/version_number_spec.rb
         
     | 
| 
       130 
131 
     | 
    
         
             
            - spec/bump/logger_spec.rb
         
     | 
| 
       131 
132 
     | 
    
         
             
            - spec/spec_helper.rb
         
     | 
| 
         @@ -1,22 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
             
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            module Bump
         
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
                class FileRewriteRuleFactory
         
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       7 
     | 
    
         
            -
                    def self.create file, param, before_version, after_version
         
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
       9 
     | 
    
         
            -
                        case param
         
     | 
| 
       10 
     | 
    
         
            -
                        when String
         
     | 
| 
       11 
     | 
    
         
            -
                            return FileRewriteRule.new file, param, before_version, after_version
         
     | 
| 
       12 
     | 
    
         
            -
                        when Array
         
     | 
| 
       13 
     | 
    
         
            -
                            return param.map { |param| FileRewriteRule.new file, param, before_version, after_version }.flatten
         
     | 
| 
       14 
     | 
    
         
            -
                        else
         
     | 
| 
       15 
     | 
    
         
            -
                            return FileRewriteRule.new file, nil, before_version, after_version
         
     | 
| 
       16 
     | 
    
         
            -
                        end
         
     | 
| 
       17 
     | 
    
         
            -
             
     | 
| 
       18 
     | 
    
         
            -
                    end
         
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
     | 
    
         
            -
                end
         
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
            end
         
     | 
| 
         @@ -1,65 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
             
     | 
| 
       2 
     | 
    
         
            -
            require 'yaml'
         
     | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
       4 
     | 
    
         
            -
            module Bump
         
     | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
       6 
     | 
    
         
            -
                class VersionDescriptor
         
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
       8 
     | 
    
         
            -
                    def initialize config
         
     | 
| 
       9 
     | 
    
         
            -
                        @config = config
         
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
                        @version = VersionFactory.fromString @config['version']
         
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
       13 
     | 
    
         
            -
                        @before_version = @version.to_s
         
     | 
| 
       14 
     | 
    
         
            -
                        @after_version = @version.to_s
         
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
                    end
         
     | 
| 
       17 
     | 
    
         
            -
             
     | 
| 
       18 
     | 
    
         
            -
                    def resetAfterVersion
         
     | 
| 
       19 
     | 
    
         
            -
                        @after_version = @version.to_s
         
     | 
| 
       20 
     | 
    
         
            -
                        @config['version'] = @after_version
         
     | 
| 
       21 
     | 
    
         
            -
                    end
         
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
                    def toYaml
         
     | 
| 
       24 
     | 
    
         
            -
                        @config.to_yaml
         
     | 
| 
       25 
     | 
    
         
            -
                    end
         
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
                    def majorBump
         
     | 
| 
       28 
     | 
    
         
            -
                        @version.bump 'major'
         
     | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
       30 
     | 
    
         
            -
                        resetAfterVersion
         
     | 
| 
       31 
     | 
    
         
            -
                    end
         
     | 
| 
       32 
     | 
    
         
            -
             
     | 
| 
       33 
     | 
    
         
            -
                    def minorBump
         
     | 
| 
       34 
     | 
    
         
            -
                        @version.bump 'minor'
         
     | 
| 
       35 
     | 
    
         
            -
             
     | 
| 
       36 
     | 
    
         
            -
                        resetAfterVersion
         
     | 
| 
       37 
     | 
    
         
            -
                    end
         
     | 
| 
       38 
     | 
    
         
            -
             
     | 
| 
       39 
     | 
    
         
            -
                    def patchBump
         
     | 
| 
       40 
     | 
    
         
            -
                        @version.bump 'patch'
         
     | 
| 
       41 
     | 
    
         
            -
             
     | 
| 
       42 
     | 
    
         
            -
                        resetAfterVersion
         
     | 
| 
       43 
     | 
    
         
            -
                    end
         
     | 
| 
       44 
     | 
    
         
            -
             
     | 
| 
       45 
     | 
    
         
            -
                    def config
         
     | 
| 
       46 
     | 
    
         
            -
                        @config
         
     | 
| 
       47 
     | 
    
         
            -
                    end
         
     | 
| 
       48 
     | 
    
         
            -
             
     | 
| 
       49 
     | 
    
         
            -
                    def rewriteRules
         
     | 
| 
       50 
     | 
    
         
            -
                        return @config['files'].map { |file, param|
         
     | 
| 
       51 
     | 
    
         
            -
                            FileRewriteRuleFactory.create(file, param, @before_version, @after_version)
         
     | 
| 
       52 
     | 
    
         
            -
                        }.flatten
         
     | 
| 
       53 
     | 
    
         
            -
                    end
         
     | 
| 
       54 
     | 
    
         
            -
             
     | 
| 
       55 
     | 
    
         
            -
                    def afterVersion
         
     | 
| 
       56 
     | 
    
         
            -
                        @after_version
         
     | 
| 
       57 
     | 
    
         
            -
                    end
         
     | 
| 
       58 
     | 
    
         
            -
             
     | 
| 
       59 
     | 
    
         
            -
                    def beforeVersion
         
     | 
| 
       60 
     | 
    
         
            -
                        @before_version
         
     | 
| 
       61 
     | 
    
         
            -
                    end
         
     | 
| 
       62 
     | 
    
         
            -
             
     | 
| 
       63 
     | 
    
         
            -
                end
         
     | 
| 
       64 
     | 
    
         
            -
             
     | 
| 
       65 
     | 
    
         
            -
            end
         
     | 
| 
         @@ -1,23 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
             
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            require 'yaml'
         
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
            module Bump
         
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       7 
     | 
    
         
            -
                class VersionDescriptorRepository
         
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
       9 
     | 
    
         
            -
                    def initialize file
         
     | 
| 
       10 
     | 
    
         
            -
                        @file = file
         
     | 
| 
       11 
     | 
    
         
            -
                    end
         
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
       13 
     | 
    
         
            -
                    def fromFile
         
     | 
| 
       14 
     | 
    
         
            -
                        VersionDescriptor.new YAML.load_file @file
         
     | 
| 
       15 
     | 
    
         
            -
                    end
         
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
       17 
     | 
    
         
            -
                    def save descriptor
         
     | 
| 
       18 
     | 
    
         
            -
                        File.write @file, descriptor.toYaml
         
     | 
| 
       19 
     | 
    
         
            -
                    end
         
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
                end
         
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
            end
         
     |