qb 0.1.56 → 0.1.57
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/lib/qb/version.rb +1 -1
- data/plugins/filter_plugins/version.py +5 -2
- data/roles/nrser.rb/library/set_fact_with_ruby.rb +94 -0
- data/roles/qb.bump/.qb-options.yml +5 -0
- data/roles/qb.bump/README.md +13 -0
- data/roles/qb.bump/defaults/main.yml +7 -0
- data/roles/qb.bump/library/bump +272 -0
- data/roles/qb.bump/meta/main.yml +9 -0
- data/roles/qb.bump/meta/qb.yml +74 -0
- data/roles/qb.bump/tasks/frontend/level/dev.yml +80 -0
- data/roles/qb.bump/tasks/frontend/level/rc.yml +120 -0
- data/roles/qb.bump/tasks/frontend/level/release.yml +112 -0
- data/roles/qb.bump/tasks/frontend/main.yml +22 -0
- data/roles/qb.bump/tasks/main.yml +82 -0
- metadata +14 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 4995bf75df88c4e41eb0d9faf8d87df23a46715b
         | 
| 4 | 
            +
              data.tar.gz: 5840addfe4c798eac0cc9cfef8686448e6eefb15
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: f62010e8cbb650069092df7095b78f733fe5f71a6a462f6bbbbcebe5e36791c69167423d8e6fd4ac8cb0c003090b68bb988d63499dbbe5ab8b2606076845bf57
         | 
| 7 | 
            +
              data.tar.gz: de0962656f44993001f4f6393aa7eefc5fb1356a97942ed128bc9fb6377342929f9f7509621834e9b2132398b41da34229946a261a510e833c29dc21fad46809
         | 
    
        data/lib/qb/version.rb
    CHANGED
    
    
| @@ -81,9 +81,12 @@ def semver_parse(version): | |
| 81 81 | 
             
                )
         | 
| 82 82 |  | 
| 83 83 | 
             
                if version['is_release']:
         | 
| 84 | 
            -
                    version[' | 
| 84 | 
            +
                    version['level'] = 'release'
         | 
| 85 85 | 
             
                else:
         | 
| 86 | 
            -
                    version[' | 
| 86 | 
            +
                    version['level'] = version['prerelease'][0]
         | 
| 87 | 
            +
                
         | 
| 88 | 
            +
                # depreciated name for level
         | 
| 89 | 
            +
                version['type'] = version['level']
         | 
| 87 90 |  | 
| 88 91 | 
             
                version['release'] = "%(major)s.%(minor)s.%(patch)s" % version
         | 
| 89 92 |  | 
| @@ -0,0 +1,94 @@ | |
| 1 | 
            +
            #!/usr/bin/env ruby
         | 
| 2 | 
            +
            # WANT_JSON
         | 
| 3 | 
            +
            # ^ i think this is something telling ansible to provide JSON args?
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            # stdlib
         | 
| 6 | 
            +
            require 'json'
         | 
| 7 | 
            +
            require 'shellwords'
         | 
| 8 | 
            +
            require 'pp'
         | 
| 9 | 
            +
             | 
| 10 | 
            +
            # deps
         | 
| 11 | 
            +
            require 'nrser'
         | 
| 12 | 
            +
             | 
| 13 | 
            +
            $warnings = []
         | 
| 14 | 
            +
             | 
| 15 | 
            +
            def namespace prefix, hash
         | 
| 16 | 
            +
              Hash[
         | 
| 17 | 
            +
                hash.map {|key, value|
         | 
| 18 | 
            +
                  ["#{ prefix }_#{ key }", value]
         | 
| 19 | 
            +
                }
         | 
| 20 | 
            +
              ]
         | 
| 21 | 
            +
            end
         | 
| 22 | 
            +
             | 
| 23 | 
            +
            def warn msg, **details
         | 
| 24 | 
            +
              unless details.empty?
         | 
| 25 | 
            +
                
         | 
| 26 | 
            +
              end
         | 
| 27 | 
            +
              
         | 
| 28 | 
            +
              $warnings << msg
         | 
| 29 | 
            +
            end
         | 
| 30 | 
            +
             | 
| 31 | 
            +
            def main
         | 
| 32 | 
            +
              input = nil
         | 
| 33 | 
            +
              args = nil
         | 
| 34 | 
            +
             | 
| 35 | 
            +
              begin
         | 
| 36 | 
            +
                input = File.read ARGV[0]
         | 
| 37 | 
            +
                args = JSON.load input
         | 
| 38 | 
            +
                
         | 
| 39 | 
            +
                var_name = args.fetch 'var_name'
         | 
| 40 | 
            +
                
         | 
| 41 | 
            +
                b = binding
         | 
| 42 | 
            +
                
         | 
| 43 | 
            +
                ['bind', 'vars'].each do |key|
         | 
| 44 | 
            +
                  if args.key? key
         | 
| 45 | 
            +
                    args[key].each {|k, v|
         | 
| 46 | 
            +
                      b.local_variable_set k, v
         | 
| 47 | 
            +
                    }
         | 
| 48 | 
            +
                  end
         | 
| 49 | 
            +
                end
         | 
| 50 | 
            +
                
         | 
| 51 | 
            +
                result = b.eval args.fetch('src')
         | 
| 52 | 
            +
             | 
| 53 | 
            +
                print JSON.dump({
         | 
| 54 | 
            +
                  'changed' => false,
         | 
| 55 | 
            +
                  'ansible_facts' => {
         | 
| 56 | 
            +
                    var_name => result,
         | 
| 57 | 
            +
                  },
         | 
| 58 | 
            +
                  'warnings' => $warnings,
         | 
| 59 | 
            +
                })
         | 
| 60 | 
            +
                
         | 
| 61 | 
            +
              rescue Exception => e
         | 
| 62 | 
            +
                path = File.join Dir.pwd, "ansible-error.log"
         | 
| 63 | 
            +
                msg = NRSER.squish <<-END
         | 
| 64 | 
            +
                  set_fact_with_ruby failed: #{ e.message } (#{ e.class.name }).
         | 
| 65 | 
            +
                  See #{ path } for details.
         | 
| 66 | 
            +
                END
         | 
| 67 | 
            +
                
         | 
| 68 | 
            +
                formatted = NRSER.format_exception(e)
         | 
| 69 | 
            +
                
         | 
| 70 | 
            +
                File.open(path, 'w') {|f|
         | 
| 71 | 
            +
                  f.puts "ERROR:\n\n"
         | 
| 72 | 
            +
                  f.puts NRSER.indent(formatted)
         | 
| 73 | 
            +
                  
         | 
| 74 | 
            +
                  f.puts "\nINPUT:\n\n"
         | 
| 75 | 
            +
                  f.puts NRSER.indent(input) if defined? input
         | 
| 76 | 
            +
                  
         | 
| 77 | 
            +
                  f.puts "\nARGS:\n\n"
         | 
| 78 | 
            +
                  f.puts NRSER.indent(args.pretty_inspect) if defined? args
         | 
| 79 | 
            +
                  
         | 
| 80 | 
            +
                  f.puts "\nRUBY:\n"
         | 
| 81 | 
            +
                  f.puts NRSER.indent("VERSION: #{ RUBY_VERSION }")
         | 
| 82 | 
            +
                  f.puts NRSER.indent("PATH: #{ RbConfig.ruby }")
         | 
| 83 | 
            +
                }
         | 
| 84 | 
            +
                
         | 
| 85 | 
            +
                print JSON.dump({
         | 
| 86 | 
            +
                  'failed' => true,
         | 
| 87 | 
            +
                  'msg' => msg,
         | 
| 88 | 
            +
                  'warnings' => $warnings,
         | 
| 89 | 
            +
                  'exception' => formatted,
         | 
| 90 | 
            +
                })
         | 
| 91 | 
            +
              end
         | 
| 92 | 
            +
            end
         | 
| 93 | 
            +
             | 
| 94 | 
            +
            main if __FILE__ == $0
         | 
| @@ -0,0 +1,13 @@ | |
| 1 | 
            +
            bump role
         | 
| 2 | 
            +
            ==============================================================================
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            bump a service to the next version, committing the change and tagging the
         | 
| 5 | 
            +
            commit.
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            ------------------------------------------------------------------------------
         | 
| 8 | 
            +
            usage
         | 
| 9 | 
            +
            ------------------------------------------------------------------------------
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            CLI help:
         | 
| 12 | 
            +
             | 
| 13 | 
            +
                qb bump --help
         | 
| @@ -0,0 +1,272 @@ | |
| 1 | 
            +
            #!/usr/bin/env ruby
         | 
| 2 | 
            +
            # WANT_JSON
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            # init bundler in dev env
         | 
| 5 | 
            +
            if ENV['QB_DEV_ENV']
         | 
| 6 | 
            +
              ENV.each {|k, v|
         | 
| 7 | 
            +
                if k.start_with? 'QB_DEV_ENV_'
         | 
| 8 | 
            +
                  ENV[k.sub('QB_DEV_ENV_', '')] = v
         | 
| 9 | 
            +
                end
         | 
| 10 | 
            +
              }
         | 
| 11 | 
            +
              require 'bundler/setup'
         | 
| 12 | 
            +
            end
         | 
| 13 | 
            +
             | 
| 14 | 
            +
            require 'json'
         | 
| 15 | 
            +
            require 'pathname'
         | 
| 16 | 
            +
             | 
| 17 | 
            +
            require 'qb'
         | 
| 18 | 
            +
            require 'cmds'
         | 
| 19 | 
            +
            require 'nrser'
         | 
| 20 | 
            +
            require 'nrser/refinements'
         | 
| 21 | 
            +
             | 
| 22 | 
            +
            using NRSER
         | 
| 23 | 
            +
             | 
| 24 | 
            +
            class Version
         | 
| 25 | 
            +
              # raw version string if available (version was read from file or whatever),
         | 
| 26 | 
            +
              # defaults to `nil`.
         | 
| 27 | 
            +
              # 
         | 
| 28 | 
            +
              # @return [nil | String]
         | 
| 29 | 
            +
              attr_reader :raw
         | 
| 30 | 
            +
              
         | 
| 31 | 
            +
              # major (first element) of version (the `1` in `1.2.3-rc.4`).
         | 
| 32 | 
            +
              # 
         | 
| 33 | 
            +
              # @return [Fixnum]
         | 
| 34 | 
            +
              attr_reader :major
         | 
| 35 | 
            +
              
         | 
| 36 | 
            +
              # minor (second element) of version (the `2` in `1.2.3-rc.4`).
         | 
| 37 | 
            +
              # 
         | 
| 38 | 
            +
              # @return [Fixnum]
         | 
| 39 | 
            +
              attr_reader :minor
         | 
| 40 | 
            +
              
         | 
| 41 | 
            +
              # patch (third element) of version (the `3` in `1.2.3-rc.4`).
         | 
| 42 | 
            +
              # 
         | 
| 43 | 
            +
              # @return [Fixnum]
         | 
| 44 | 
            +
              attr_reader :patch
         | 
| 45 | 
            +
              
         | 
| 46 | 
            +
              # array of everything after the patch element.
         | 
| 47 | 
            +
              # 
         | 
| 48 | 
            +
              # (`['rc', 4]` in `1.2.3-rc.4` or `1.2.3.rc.4`).
         | 
| 49 | 
            +
              # 
         | 
| 50 | 
            +
              # @return [Array<String | Fixnum>]
         | 
| 51 | 
            +
              attr_reader :prerelease
         | 
| 52 | 
            +
              
         | 
| 53 | 
            +
              
         | 
| 54 | 
            +
              def initialize raw: nil, major:, minor:, patch:, prerelease:
         | 
| 55 | 
            +
                @raw = raw
         | 
| 56 | 
            +
                @major = major
         | 
| 57 | 
            +
                @minor = minor
         | 
| 58 | 
            +
                @patch = patch
         | 
| 59 | 
            +
                @prerelease = prerelease
         | 
| 60 | 
            +
              end # #initialize
         | 
| 61 | 
            +
              
         | 
| 62 | 
            +
              
         | 
| 63 | 
            +
              # version without prerelease
         | 
| 64 | 
            +
              def release
         | 
| 65 | 
            +
                [@major, @minor, @patch].join '.'
         | 
| 66 | 
            +
              end # #release
         | 
| 67 | 
            +
              
         | 
| 68 | 
            +
              
         | 
| 69 | 
            +
              def to_hash
         | 
| 70 | 
            +
                {
         | 
| 71 | 
            +
                  raw: @raw,
         | 
| 72 | 
            +
                  major: @major,
         | 
| 73 | 
            +
                  minor: @minor,
         | 
| 74 | 
            +
                  patch: @patch,
         | 
| 75 | 
            +
                  prerelease: @prerelease,
         | 
| 76 | 
            +
                  release: release,
         | 
| 77 | 
            +
                }
         | 
| 78 | 
            +
              end # #to_hash
         | 
| 79 | 
            +
              
         | 
| 80 | 
            +
              
         | 
| 81 | 
            +
              def merge **changes
         | 
| 82 | 
            +
                self.class.new **to_hash.omit(:raw, :release).merge(**changes)
         | 
| 83 | 
            +
              end # #merge
         | 
| 84 | 
            +
              
         | 
| 85 | 
            +
              # ruby inter-op
         | 
| 86 | 
            +
              # ------------------------------------------------------------------------
         | 
| 87 | 
            +
              
         | 
| 88 | 
            +
              def to_json options
         | 
| 89 | 
            +
                QB::AnsibleModule.stringify_keys(to_hash).to_json options
         | 
| 90 | 
            +
              end # #to_json
         | 
| 91 | 
            +
            end # Version
         | 
| 92 | 
            +
             | 
| 93 | 
            +
             | 
| 94 | 
            +
            # abstract base class for bumpers - classes that implement reading and 
         | 
| 95 | 
            +
            # writing Version objects to a package directory.
         | 
| 96 | 
            +
            class Bumper
         | 
| 97 | 
            +
              # absolute path to the root directory of the package.
         | 
| 98 | 
            +
              # 
         | 
| 99 | 
            +
              # @return [String]
         | 
| 100 | 
            +
              attr_reader :package_dir
         | 
| 101 | 
            +
              
         | 
| 102 | 
            +
              # absolute file paths that are relevant to a version bump.
         | 
| 103 | 
            +
              # used when doing a `git add` to commit changes to the version.
         | 
| 104 | 
            +
              # 
         | 
| 105 | 
            +
              # @return [Array<String>]
         | 
| 106 | 
            +
              attr_reader :files
         | 
| 107 | 
            +
              
         | 
| 108 | 
            +
              # current Version the package is at (before bump).
         | 
| 109 | 
            +
              # 
         | 
| 110 | 
            +
              # **DOES NOT** get updated when {#bump} is called.
         | 
| 111 | 
            +
              # 
         | 
| 112 | 
            +
              # @return [Version]
         | 
| 113 | 
            +
              attr_reader :current
         | 
| 114 | 
            +
              
         | 
| 115 | 
            +
              
         | 
| 116 | 
            +
              def initialize package_dir:, files:
         | 
| 117 | 
            +
                @package_dir = package_dir
         | 
| 118 | 
            +
                @files = files
         | 
| 119 | 
            +
              end # #initialize
         | 
| 120 | 
            +
            end # Bumper
         | 
| 121 | 
            +
             | 
| 122 | 
            +
             | 
| 123 | 
            +
            class NodeBumper < Bumper
         | 
| 124 | 
            +
              
         | 
| 125 | 
            +
              def self.parse version_string
         | 
| 126 | 
            +
                js = <<-END
         | 
| 127 | 
            +
                  var semver = require('semver');
         | 
| 128 | 
            +
                  var parsed = semver(#{ JSON.dump version_string});
         | 
| 129 | 
            +
                  var json = JSON.stringify(parsed, null, 2);
         | 
| 130 | 
            +
                  
         | 
| 131 | 
            +
                  console.log(json);
         | 
| 132 | 
            +
                END
         | 
| 133 | 
            +
                
         | 
| 134 | 
            +
                obj = JSON.load(
         | 
| 135 | 
            +
                  Cmds.new("node --eval %s", chdir: QB::ROOT.to_s).chomp!(js)
         | 
| 136 | 
            +
                )
         | 
| 137 | 
            +
                
         | 
| 138 | 
            +
                Version.new raw: obj['raw'],
         | 
| 139 | 
            +
                            major: obj['major'],
         | 
| 140 | 
            +
                            minor: obj['minor'],
         | 
| 141 | 
            +
                            patch: obj['patch'],
         | 
| 142 | 
            +
                            prerelease: obj['prerelease']
         | 
| 143 | 
            +
              end # .parse
         | 
| 144 | 
            +
              
         | 
| 145 | 
            +
              
         | 
| 146 | 
            +
              def self.format version
         | 
| 147 | 
            +
                "#{ version.release }-#{ version.prerelease.join '.' }"
         | 
| 148 | 
            +
              end
         | 
| 149 | 
            +
              
         | 
| 150 | 
            +
              
         | 
| 151 | 
            +
              def initialize package_dir:
         | 
| 152 | 
            +
                @package_json_path = File.join(package_dir, 'package.json')
         | 
| 153 | 
            +
                
         | 
| 154 | 
            +
                super package_dir: package_dir, files: [@package_json_path]
         | 
| 155 | 
            +
                
         | 
| 156 | 
            +
                @package_json = JSON.load File.read(@package_json_path)
         | 
| 157 | 
            +
                @current = self.class.parse @package_json.fetch('version')
         | 
| 158 | 
            +
              end # #initialize
         | 
| 159 | 
            +
              
         | 
| 160 | 
            +
              
         | 
| 161 | 
            +
              def bump! **merge
         | 
| 162 | 
            +
                next_version = @current.merge **merge
         | 
| 163 | 
            +
                
         | 
| 164 | 
            +
                # bump the version in package.json using yarn
         | 
| 165 | 
            +
                Cmds.new(
         | 
| 166 | 
            +
                  "yarn version <%= opts %>",
         | 
| 167 | 
            +
                  chdir: @package_dir,
         | 
| 168 | 
            +
                  kwds: {
         | 
| 169 | 
            +
                    opts: {
         | 
| 170 | 
            +
                      'new-version': self.class.format(next_version),
         | 
| 171 | 
            +
                      'no-git-tag-version': true,
         | 
| 172 | 
            +
                    }
         | 
| 173 | 
            +
                  }
         | 
| 174 | 
            +
                ).stream!
         | 
| 175 | 
            +
                
         | 
| 176 | 
            +
                next_version
         | 
| 177 | 
            +
              end # #bump!
         | 
| 178 | 
            +
              
         | 
| 179 | 
            +
            end # NodeBumper
         | 
| 180 | 
            +
             | 
| 181 | 
            +
             | 
| 182 | 
            +
            class Bump < QB::AnsibleModule
         | 
| 183 | 
            +
              
         | 
| 184 | 
            +
              def check_repo_clean!
         | 
| 185 | 
            +
                unless Cmds.chomp!('git status --porcelain 2>/dev/null') == ''
         | 
| 186 | 
            +
                  raise "can not bump a dirty repo"
         | 
| 187 | 
            +
                end
         | 
| 188 | 
            +
              end # #check_repo_clean!
         | 
| 189 | 
            +
              
         | 
| 190 | 
            +
              
         | 
| 191 | 
            +
              def next_rc
         | 
| 192 | 
            +
                re = /^#{ Regexp.escape(@tag_prefix + @bumper.current.release) }-rc\.(\d+)$/
         | 
| 193 | 
            +
                
         | 
| 194 | 
            +
                result = 0
         | 
| 195 | 
            +
                
         | 
| 196 | 
            +
                Cmds.new("git tag", chdir: @repo_root).chomp!.lines.each {|tag|
         | 
| 197 | 
            +
                  if m = re.match(tag.chomp)
         | 
| 198 | 
            +
                    succ = m[1].to_i.succ
         | 
| 199 | 
            +
                    
         | 
| 200 | 
            +
                    result = succ if succ > result
         | 
| 201 | 
            +
                  end
         | 
| 202 | 
            +
                }
         | 
| 203 | 
            +
                
         | 
| 204 | 
            +
                result
         | 
| 205 | 
            +
              end # #next_rc
         | 
| 206 | 
            +
              
         | 
| 207 | 
            +
              
         | 
| 208 | 
            +
              def bump_rc    
         | 
| 209 | 
            +
                @next_version = @bumper.bump! prerelease: ['rc', next_rc]
         | 
| 210 | 
            +
                @next_version_formatted = @bumper.class.format @next_version
         | 
| 211 | 
            +
                
         | 
| 212 | 
            +
                # add the files
         | 
| 213 | 
            +
                Cmds.new(
         | 
| 214 | 
            +
                  "git add <%= *args %>", chdir: @repo_root
         | 
| 215 | 
            +
                ).stream! *@bumper.files
         | 
| 216 | 
            +
                
         | 
| 217 | 
            +
                # commit the changes
         | 
| 218 | 
            +
                Cmds.new(
         | 
| 219 | 
            +
                  "git commit %{opts}",
         | 
| 220 | 
            +
                  chdir: @repo_root,
         | 
| 221 | 
            +
                ).stream! opts: {
         | 
| 222 | 
            +
                  m: "bump #{ @rel_path.to_s } to #{ @next_version_formatted }"
         | 
| 223 | 
            +
                }
         | 
| 224 | 
            +
                
         | 
| 225 | 
            +
                # create tag
         | 
| 226 | 
            +
                @tag = @tag_prefix + @next_version_formatted
         | 
| 227 | 
            +
                Cmds.new("git tag %s", chdir: @repo_root).stream! @tag
         | 
| 228 | 
            +
                
         | 
| 229 | 
            +
                # push tag
         | 
| 230 | 
            +
                Cmds.new("git push origin %s", chdir: @repo_root).stream! @tag
         | 
| 231 | 
            +
              end # #bump_rc
         | 
| 232 | 
            +
              
         | 
| 233 | 
            +
              
         | 
| 234 | 
            +
              def main
         | 
| 235 | 
            +
                # check_repo_clean!
         | 
| 236 | 
            +
                
         | 
| 237 | 
            +
                @package_dir = File.realpath @args.fetch('package_dir')
         | 
| 238 | 
            +
                @level = @args.fetch 'level'
         | 
| 239 | 
            +
                
         | 
| 240 | 
            +
                @repo_root = Cmds.new(
         | 
| 241 | 
            +
                  "git rev-parse --show-toplevel", chdir: @package_dir
         | 
| 242 | 
            +
                ).chomp!
         | 
| 243 | 
            +
                
         | 
| 244 | 
            +
                @rel_path = Pathname.new(@package_dir).realpath.relative_path_from(
         | 
| 245 | 
            +
                  Pathname.new(@repo_root).realpath
         | 
| 246 | 
            +
                ).to_s
         | 
| 247 | 
            +
                
         | 
| 248 | 
            +
                @tag_prefix = if @rel_path == '.'
         | 
| 249 | 
            +
                  'v'
         | 
| 250 | 
            +
                else
         | 
| 251 | 
            +
                  "#{ @rel_path }/v"
         | 
| 252 | 
            +
                end
         | 
| 253 | 
            +
                
         | 
| 254 | 
            +
                @bumper = NodeBumper.new package_dir: @package_dir
         | 
| 255 | 
            +
                
         | 
| 256 | 
            +
                case @level
         | 
| 257 | 
            +
                when 'rc'
         | 
| 258 | 
            +
                  bump_rc
         | 
| 259 | 
            +
                else
         | 
| 260 | 
            +
                  raise "bad level: #{ @level.inspect }"
         | 
| 261 | 
            +
                end
         | 
| 262 | 
            +
                
         | 
| 263 | 
            +
                {
         | 
| 264 | 
            +
                  current: @bumper.current,
         | 
| 265 | 
            +
                  next_version: @next_version,
         | 
| 266 | 
            +
                  tag: @tag,
         | 
| 267 | 
            +
                }
         | 
| 268 | 
            +
              end
         | 
| 269 | 
            +
              
         | 
| 270 | 
            +
            end # Bump
         | 
| 271 | 
            +
             | 
| 272 | 
            +
            Bump.new.run
         | 
| @@ -0,0 +1,74 @@ | |
| 1 | 
            +
            ---
         | 
| 2 | 
            +
            # meta/qb.yml file for bump
         | 
| 3 | 
            +
            # 
         | 
| 4 | 
            +
            # qb settings for this role. see README.md for more info.
         | 
| 5 | 
            +
            #
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            # description of the role to show in it's help output.
         | 
| 8 | 
            +
            description: >-
         | 
| 9 | 
            +
              bump a service to the next version, committing the change and tagging the
         | 
| 10 | 
            +
              commit.
         | 
| 11 | 
            +
             | 
| 12 | 
            +
            # prefix for role variables
         | 
| 13 | 
            +
            var_prefix: null
         | 
| 14 | 
            +
             | 
| 15 | 
            +
            # how to get a default for `dir` if it's not provided as the only
         | 
| 16 | 
            +
            # positional argument. if a positional argument is provided it will
         | 
| 17 | 
            +
            # override the method defined here.
         | 
| 18 | 
            +
            # 
         | 
| 19 | 
            +
            # options:
         | 
| 20 | 
            +
            # 
         | 
| 21 | 
            +
            # -   null
         | 
| 22 | 
            +
            #     -   require the value on the command line.
         | 
| 23 | 
            +
            # -   false
         | 
| 24 | 
            +
            #     -   don't provide qb_dir (means doesn't load or save options either).
         | 
| 25 | 
            +
            # -   git_root
         | 
| 26 | 
            +
            #     -   use the git root fof the directory that the `qb` command is invoked
         | 
| 27 | 
            +
            #         from. useful for 'project-centric' commands so they can be invoked
         | 
| 28 | 
            +
            #         from anywhere in the repo.
         | 
| 29 | 
            +
            # -   cwd
         | 
| 30 | 
            +
            #     -   use the directory the `qb` command is invoked form.
         | 
| 31 | 
            +
            # -   {exe: PATH}
         | 
| 32 | 
            +
            #     -   invoke an execuable, passing a JSON serialization of the options 
         | 
| 33 | 
            +
            #         mapping their CLI names to values. path can be relative to role
         | 
| 34 | 
            +
            #         directory.
         | 
| 35 | 
            +
            # -   {find_up: FILENAME}
         | 
| 36 | 
            +
            #     -   starting at the current direcotry and climbing up to parent 
         | 
| 37 | 
            +
            #         directories, use the first one that contains FILENAME. error
         | 
| 38 | 
            +
            #         if none is found.
         | 
| 39 | 
            +
            default_dir: null
         | 
| 40 | 
            +
             | 
| 41 | 
            +
            # default user to become for play
         | 
| 42 | 
            +
            default_user: null
         | 
| 43 | 
            +
             | 
| 44 | 
            +
            # set to false to not save options in .qb-options.yml files
         | 
| 45 | 
            +
            save_options: false
         | 
| 46 | 
            +
             | 
| 47 | 
            +
            # options to pass to ansible-playbook
         | 
| 48 | 
            +
            ansible_options: {}
         | 
| 49 | 
            +
             | 
| 50 | 
            +
            # examples:
         | 
| 51 | 
            +
            # - |
         | 
| 52 | 
            +
            #   here here
         | 
| 53 | 
            +
            #   
         | 
| 54 | 
            +
            #   there there
         | 
| 55 | 
            +
             | 
| 56 | 
            +
            options: # []
         | 
| 57 | 
            +
            # - name: example
         | 
| 58 | 
            +
            #   description: an example of a variable.
         | 
| 59 | 
            +
            #   required: false
         | 
| 60 | 
            +
            #   type: boolean # boolean (default) | string
         | 
| 61 | 
            +
            #   short: e
         | 
| 62 | 
            +
             | 
| 63 | 
            +
            - name: level
         | 
| 64 | 
            +
              description: the version level to bump.
         | 
| 65 | 
            +
              required: true
         | 
| 66 | 
            +
              type:
         | 
| 67 | 
            +
                one_of:
         | 
| 68 | 
            +
                - major
         | 
| 69 | 
            +
                - minor
         | 
| 70 | 
            +
                - patch
         | 
| 71 | 
            +
                - release
         | 
| 72 | 
            +
                - rc
         | 
| 73 | 
            +
                - dev
         | 
| 74 | 
            +
              short: t
         | 
| @@ -0,0 +1,80 @@ | |
| 1 | 
            +
            ---
         | 
| 2 | 
            +
            - debug:
         | 
| 3 | 
            +
                msg: bumping to the next development (dev) version...
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            - when: bump_current_version.level not in ['rc', 'release']
         | 
| 6 | 
            +
              fail:
         | 
| 7 | 
            +
                msg: >-
         | 
| 8 | 
            +
                  the frontend service version must have level 'rc' (form `M.m.p-rc.R`) or 
         | 
| 9 | 
            +
                  'release' (form `M.m.p`), found {{ bump_current_version.raw }}
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            - block:  # the next version and commit message depend on the level of the 
         | 
| 12 | 
            +
                      # current version
         | 
| 13 | 
            +
              
         | 
| 14 | 
            +
              - when: bump_current_version.level == 'rc'
         | 
| 15 | 
            +
                name: >-
         | 
| 16 | 
            +
                  the next_version is the current release with a 'dev' prerelease
         | 
| 17 | 
            +
                set_fact:
         | 
| 18 | 
            +
                  bump_next_version: "{{ bump_current_version.release }}-dev"
         | 
| 19 | 
            +
                  bump_commit_message: drop version level back down to dev
         | 
| 20 | 
            +
             | 
| 21 | 
            +
              - when: bump_current_version.level == 'release'
         | 
| 22 | 
            +
                name: >-
         | 
| 23 | 
            +
                  the next version is the current release with the patch incremented and
         | 
| 24 | 
            +
                  a 'dev' prerelease. example: 0.1.2 => 0.1.3-dev
         | 
| 25 | 
            +
                set_fact:
         | 
| 26 | 
            +
                  bump_next_version: >-
         | 
| 27 | 
            +
                    {{
         | 
| 28 | 
            +
                      [
         | 
| 29 | 
            +
                        bump_current_version.major,
         | 
| 30 | 
            +
                        bump_current_version.minor,
         | 
| 31 | 
            +
                        bump_current_version.patch + 1
         | 
| 32 | 
            +
                      ] | join('.') + '-dev'
         | 
| 33 | 
            +
                    }}
         | 
| 34 | 
            +
                  bump_commit_message: >-
         | 
| 35 | 
            +
                    start development on version {{
         | 
| 36 | 
            +
                      [
         | 
| 37 | 
            +
                        bump_current_version.major,
         | 
| 38 | 
            +
                        bump_current_version.minor,
         | 
| 39 | 
            +
                        bump_current_version.patch + 1
         | 
| 40 | 
            +
                      ] | join('.') 
         | 
| 41 | 
            +
                    }}
         | 
| 42 | 
            +
             | 
| 43 | 
            +
            # /block
         | 
| 44 | 
            +
             | 
| 45 | 
            +
            - name: >-
         | 
| 46 | 
            +
                use yarn to set version in frontend/package.json
         | 
| 47 | 
            +
                to {{ bump_next_version }}
         | 
| 48 | 
            +
              shell: |-
         | 
| 49 | 
            +
                yarn version \
         | 
| 50 | 
            +
                  --no-git-tag-version \
         | 
| 51 | 
            +
                  --new-version {{ bump_next_version | quote }}
         | 
| 52 | 
            +
              args:
         | 
| 53 | 
            +
                chdir: "{{ bump_frontend_dir }}"
         | 
| 54 | 
            +
             | 
| 55 | 
            +
            - name: >-
         | 
| 56 | 
            +
                add frontend/package.json changes in git
         | 
| 57 | 
            +
              shell: >-
         | 
| 58 | 
            +
                git add frontend/package.json
         | 
| 59 | 
            +
              args:
         | 
| 60 | 
            +
                chdir: "{{ bump_repo_root }}"
         | 
| 61 | 
            +
             | 
| 62 | 
            +
            - name: >-
         | 
| 63 | 
            +
                commit frontend/package.json changes in git
         | 
| 64 | 
            +
              shell: >-
         | 
| 65 | 
            +
                git commit -m {{ bump_commit_message | quote }}
         | 
| 66 | 
            +
              args:
         | 
| 67 | 
            +
                chdir: "{{ bump_repo_root }}"
         | 
| 68 | 
            +
             | 
| 69 | 
            +
            - name: >-
         | 
| 70 | 
            +
                push changes in git
         | 
| 71 | 
            +
              shell: >-
         | 
| 72 | 
            +
                git push
         | 
| 73 | 
            +
              args:
         | 
| 74 | 
            +
                chdir: "{{ bump_repo_root }}"
         | 
| 75 | 
            +
             | 
| 76 | 
            +
            # done!
         | 
| 77 | 
            +
             | 
| 78 | 
            +
            - debug:
         | 
| 79 | 
            +
                msg: >-
         | 
| 80 | 
            +
                  bumped version to dev.
         | 
| @@ -0,0 +1,120 @@ | |
| 1 | 
            +
            ---
         | 
| 2 | 
            +
            - debug:
         | 
| 3 | 
            +
                msg: bumping to the next release candidate (rc) version...
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            - name: >-
         | 
| 6 | 
            +
                set rc_tag_prefix to 'frontend/v'
         | 
| 7 | 
            +
              set_fact:
         | 
| 8 | 
            +
                bump_rc_tag_prefix: frontend/v
         | 
| 9 | 
            +
             | 
| 10 | 
            +
            - name: >-
         | 
| 11 | 
            +
                fail if unless the frontend service version level is 'dev' or 'rc'
         | 
| 12 | 
            +
              fail:
         | 
| 13 | 
            +
                msg: >
         | 
| 14 | 
            +
                  the frontend version must be 'dev' (form `M.m.p-dev`) or 'rc'
         | 
| 15 | 
            +
                  (form `M.m.p-rc.R`), found {{ bump_current_version.raw }}
         | 
| 16 | 
            +
              when: bump_current_version.level not in ['dev', 'rc']
         | 
| 17 | 
            +
             | 
| 18 | 
            +
            - name: >-
         | 
| 19 | 
            +
                check that the repo is clean of any untracked or changed files
         | 
| 20 | 
            +
              include_role:
         | 
| 21 | 
            +
                name: qb.git_check_clean
         | 
| 22 | 
            +
              vars:
         | 
| 23 | 
            +
                git_check_clean_dir: "{{ bump_repo_root }}"
         | 
| 24 | 
            +
             | 
| 25 | 
            +
            - name: >-
         | 
| 26 | 
            +
                get the git tags
         | 
| 27 | 
            +
              shell: git tag
         | 
| 28 | 
            +
              args:
         | 
| 29 | 
            +
                chdir: "{{ bump_repo_root }}"
         | 
| 30 | 
            +
              register: bump_git_tags
         | 
| 31 | 
            +
              changed_when: false
         | 
| 32 | 
            +
             | 
| 33 | 
            +
            - name: >-
         | 
| 34 | 
            +
                find the next rc number, which is the lowest integer R such that 
         | 
| 35 | 
            +
                '{{ bump_rc_tag_prefix }}{{ bump_current_version.release }}-rc.R'
         | 
| 36 | 
            +
                is a tag, or 0 if there are no such tags.
         | 
| 37 | 
            +
              vars.rb:
         | 
| 38 | 
            +
                namespace: bump
         | 
| 39 | 
            +
                bind:
         | 
| 40 | 
            +
                  tags: "{{ bump_git_tags.stdout_lines }}"
         | 
| 41 | 
            +
                  current_release: "{{ bump_current_version.release }}"
         | 
| 42 | 
            +
                  tag_prefix: "{{ bump_rc_tag_prefix }}"
         | 
| 43 | 
            +
                src: |
         | 
| 44 | 
            +
                  re = /^#{ Regexp.escape(tag_prefix + current_release) }-rc\.(\d+)$/
         | 
| 45 | 
            +
                  
         | 
| 46 | 
            +
                  rc_number = 0
         | 
| 47 | 
            +
                  
         | 
| 48 | 
            +
                  tags.each {|tag|
         | 
| 49 | 
            +
                    if m = re.match(tag)
         | 
| 50 | 
            +
                      succ = m[1].to_i.succ
         | 
| 51 | 
            +
                      
         | 
| 52 | 
            +
                      rc_number = succ if succ > rc_number
         | 
| 53 | 
            +
                    end
         | 
| 54 | 
            +
                  }
         | 
| 55 | 
            +
                  
         | 
| 56 | 
            +
                  {'rc_number' => rc_number}
         | 
| 57 | 
            +
             | 
| 58 | 
            +
            - name: >-
         | 
| 59 | 
            +
                set rc_version to the current release with '-rc.<rc_number>' appended
         | 
| 60 | 
            +
              set_fact:
         | 
| 61 | 
            +
                bump_rc_version: "{{ bump_current_version.release }}-rc.{{ bump_rc_number }}"
         | 
| 62 | 
            +
             | 
| 63 | 
            +
            - name: >-
         | 
| 64 | 
            +
                set rc_tag to rc_tag_prefix contactinated with the rc_version
         | 
| 65 | 
            +
              set_fact:
         | 
| 66 | 
            +
                bump_rc_tag: "{{ bump_rc_tag_prefix }}{{ bump_rc_version }}"
         | 
| 67 | 
            +
             | 
| 68 | 
            +
            - name: >-
         | 
| 69 | 
            +
                use yarn to bump the version in frontend/package.json
         | 
| 70 | 
            +
                to {{ bump_rc_version }}
         | 
| 71 | 
            +
              shell: |-
         | 
| 72 | 
            +
                yarn version \
         | 
| 73 | 
            +
                  --no-git-tag-version \
         | 
| 74 | 
            +
                  --new-version {{ bump_rc_version }}
         | 
| 75 | 
            +
              args:
         | 
| 76 | 
            +
                chdir: "{{ bump_frontend_dir }}"
         | 
| 77 | 
            +
             | 
| 78 | 
            +
            - name: >-
         | 
| 79 | 
            +
                add frontend/package.json changes in git
         | 
| 80 | 
            +
              shell: |-
         | 
| 81 | 
            +
                git add frontend/package.json
         | 
| 82 | 
            +
              args:
         | 
| 83 | 
            +
                chdir: "{{ bump_repo_root }}"
         | 
| 84 | 
            +
             | 
| 85 | 
            +
            - name: >-
         | 
| 86 | 
            +
                commit frontend/package.json changes in git
         | 
| 87 | 
            +
              shell: |-
         | 
| 88 | 
            +
                git commit -m "bump frontend to {{ bump_rc_version }}"
         | 
| 89 | 
            +
              args:
         | 
| 90 | 
            +
                chdir: "{{ bump_repo_root }}"
         | 
| 91 | 
            +
             | 
| 92 | 
            +
            - name: >-
         | 
| 93 | 
            +
                tag commit as {{ bump_rc_tag }}
         | 
| 94 | 
            +
              shell: |-
         | 
| 95 | 
            +
                git tag {{ bump_rc_tag }}
         | 
| 96 | 
            +
              args:
         | 
| 97 | 
            +
                chdir: "{{ bump_repo_root }}"
         | 
| 98 | 
            +
             | 
| 99 | 
            +
            - name: >-
         | 
| 100 | 
            +
                push tag to origin
         | 
| 101 | 
            +
              shell: |-
         | 
| 102 | 
            +
                git push origin {{ bump_rc_tag }}
         | 
| 103 | 
            +
              args:
         | 
| 104 | 
            +
                chdir: "{{ bump_repo_root }}"
         | 
| 105 | 
            +
             | 
| 106 | 
            +
            - debug:
         | 
| 107 | 
            +
                msg: "DONE: bumped frontend to {{ bump_rc_version }}"
         | 
| 108 | 
            +
             | 
| 109 | 
            +
            # TODO doesn't work... get's the path wrong as
         | 
| 110 | 
            +
            # 
         | 
| 111 | 
            +
            #     /Users/nrser/dev/gh/beiarea/www/frontend/main.yml
         | 
| 112 | 
            +
            # 
         | 
| 113 | 
            +
            # shitty ansible.
         | 
| 114 | 
            +
            # 
         | 
| 115 | 
            +
            # - name: kickoff frontend build...
         | 
| 116 | 
            +
            #   when: "{{ bump_build }}"
         | 
| 117 | 
            +
            #   include_role:
         | 
| 118 | 
            +
            #     name: build
         | 
| 119 | 
            +
            #   vars:
         | 
| 120 | 
            +
            #     build_service: "{{ bump_service }}"
         | 
| @@ -0,0 +1,112 @@ | |
| 1 | 
            +
            ---
         | 
| 2 | 
            +
            - debug:
         | 
| 3 | 
            +
                msg: bumping to release version...
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            # setup some variables...
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            - name: >-
         | 
| 8 | 
            +
                bump_rc_tag is the git tag for the current rc version that we're making
         | 
| 9 | 
            +
                the release off. it's format is 'frontend/v<bump_current_release>'
         | 
| 10 | 
            +
              set_fact:
         | 
| 11 | 
            +
                bump_rc_tag: "frontend/v{{ bump_current_version.raw }}"
         | 
| 12 | 
            +
             | 
| 13 | 
            +
            - name: >-
         | 
| 14 | 
            +
                bump_next_version is the version we're going to bump to, which is
         | 
| 15 | 
            +
                just the release part of the current one (`M.m.p-rc.R` => `M.m.p`)
         | 
| 16 | 
            +
              set_fact:
         | 
| 17 | 
            +
                bump_next_version: "{{ bump_current_version.release }}"
         | 
| 18 | 
            +
             | 
| 19 | 
            +
            - name: >-
         | 
| 20 | 
            +
                bump_tag is the tag that will be used for the commit with the release
         | 
| 21 | 
            +
                version in frontend/package.json. it's format is
         | 
| 22 | 
            +
                'frontend/v<bump_next_version>'
         | 
| 23 | 
            +
              set_fact:
         | 
| 24 | 
            +
                bump_tag: "frontend/v{{ bump_next_version }}"
         | 
| 25 | 
            +
             | 
| 26 | 
            +
            - name: >-
         | 
| 27 | 
            +
                bump_commit_message is the message that will be used for the commit that
         | 
| 28 | 
            +
                changes the version in frontend/package.json
         | 
| 29 | 
            +
              set_fact:
         | 
| 30 | 
            +
                bump_commit_message: >-
         | 
| 31 | 
            +
                  bump frontend to release version {{ bump_next_version }}
         | 
| 32 | 
            +
             | 
| 33 | 
            +
            # check some prerequisities...
         | 
| 34 | 
            +
             | 
| 35 | 
            +
            - when: bump_current_version.level not in ['rc']
         | 
| 36 | 
            +
              fail:
         | 
| 37 | 
            +
                msg: >-
         | 
| 38 | 
            +
                  the frontend service version must have level 'rc' (form `M.m.p-rc.R`),
         | 
| 39 | 
            +
                  found {{ bump_current_version.raw }}
         | 
| 40 | 
            +
             | 
| 41 | 
            +
            - name: >-
         | 
| 42 | 
            +
                check that the repo is clean of any untracked or changed files
         | 
| 43 | 
            +
              include_role:
         | 
| 44 | 
            +
                name: qb.git_check_clean
         | 
| 45 | 
            +
              vars:
         | 
| 46 | 
            +
                git_check_clean_dir: "{{ bump_repo_root }}"
         | 
| 47 | 
            +
             | 
| 48 | 
            +
            - name: >-
         | 
| 49 | 
            +
                get the tags for HEAD
         | 
| 50 | 
            +
              shell: |-
         | 
| 51 | 
            +
                git describe --exact-match --tags HEAD
         | 
| 52 | 
            +
              args:
         | 
| 53 | 
            +
                chdir: "{{ bump_repo_root }}"
         | 
| 54 | 
            +
              register: bump_git_tags_at_head
         | 
| 55 | 
            +
              changed_when: false
         | 
| 56 | 
            +
             | 
| 57 | 
            +
            - when: bump_rc_tag not in bump_git_tags_at_head.stdout_lines
         | 
| 58 | 
            +
              fail: >-
         | 
| 59 | 
            +
                repo HEAD needs to be at {{ bump_rc_tag }} tag.
         | 
| 60 | 
            +
             | 
| 61 | 
            +
            # do the work...
         | 
| 62 | 
            +
             | 
| 63 | 
            +
            - name: >-
         | 
| 64 | 
            +
                use yarn to bump the version in //frontend/package.json
         | 
| 65 | 
            +
                to bump_next_version
         | 
| 66 | 
            +
              shell: |-
         | 
| 67 | 
            +
                yarn version \
         | 
| 68 | 
            +
                  --no-git-tag-version \
         | 
| 69 | 
            +
                  --new-version {{ bump_next_version | quote }}
         | 
| 70 | 
            +
              args:
         | 
| 71 | 
            +
                chdir: "{{ bump_frontend_dir }}"
         | 
| 72 | 
            +
                
         | 
| 73 | 
            +
            - name: >-
         | 
| 74 | 
            +
                add //frontend/package.json changes in git
         | 
| 75 | 
            +
              shell: |-
         | 
| 76 | 
            +
                git add frontend/package.json
         | 
| 77 | 
            +
              args:
         | 
| 78 | 
            +
                chdir: "{{ bump_repo_root }}"
         | 
| 79 | 
            +
             | 
| 80 | 
            +
            - name: >-
         | 
| 81 | 
            +
                commit //frontend/package.json changes in git
         | 
| 82 | 
            +
              shell: |-
         | 
| 83 | 
            +
                git commit -m {{ bump_commit_message | quote }}
         | 
| 84 | 
            +
              args:
         | 
| 85 | 
            +
                chdir: "{{ bump_repo_root }}"
         | 
| 86 | 
            +
             | 
| 87 | 
            +
            - name: >-
         | 
| 88 | 
            +
                tag commit as bump_tag
         | 
| 89 | 
            +
              shell: |-
         | 
| 90 | 
            +
                git tag {{ bump_tag | quote }}
         | 
| 91 | 
            +
              args:
         | 
| 92 | 
            +
                chdir: "{{ bump_repo_root }}"
         | 
| 93 | 
            +
             | 
| 94 | 
            +
            - name: >-
         | 
| 95 | 
            +
                push bump_tag to origin
         | 
| 96 | 
            +
              shell: |-
         | 
| 97 | 
            +
                git push origin {{ bump_tag }}
         | 
| 98 | 
            +
              args:
         | 
| 99 | 
            +
                chdir: "{{ bump_repo_root }}"
         | 
| 100 | 
            +
             | 
| 101 | 
            +
            - name: >-
         | 
| 102 | 
            +
                push repo
         | 
| 103 | 
            +
              shell: |-
         | 
| 104 | 
            +
                git push
         | 
| 105 | 
            +
              args:
         | 
| 106 | 
            +
                chdir: "{{ bump_repo_root }}"
         | 
| 107 | 
            +
             | 
| 108 | 
            +
            # done!
         | 
| 109 | 
            +
             | 
| 110 | 
            +
            - debug:
         | 
| 111 | 
            +
                msg: >-
         | 
| 112 | 
            +
                  sucessfully bumped {{ bump_service }} to {{ bump_next_version }}
         | 
| @@ -0,0 +1,22 @@ | |
| 1 | 
            +
            ---
         | 
| 2 | 
            +
            - debug:
         | 
| 3 | 
            +
                msg: bumping frontend version...
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            - name:
         | 
| 6 | 
            +
                set frontend_dir to {{ bump_repo_root }}/frontend
         | 
| 7 | 
            +
              set_fact:
         | 
| 8 | 
            +
                bump_frontend_dir: "{{ bump_repo_root }}/frontend"
         | 
| 9 | 
            +
             | 
| 10 | 
            +
            - name: get frontend/package.json info
         | 
| 11 | 
            +
              include_role:
         | 
| 12 | 
            +
                name: qb.package_json_info
         | 
| 13 | 
            +
              vars:
         | 
| 14 | 
            +
                package_json_info_dir: "{{ bump_frontend_dir }}"
         | 
| 15 | 
            +
                package_json_info_var: bump_frontend_package_json
         | 
| 16 | 
            +
             | 
| 17 | 
            +
            - name: >
         | 
| 18 | 
            +
                set frontend_version to the semver object
         | 
| 19 | 
            +
              set_fact:
         | 
| 20 | 
            +
                bump_current_version: "{{ bump_frontend_package_json.version }}"
         | 
| 21 | 
            +
             | 
| 22 | 
            +
            - include: "level/{{ bump_level }}.yml"
         | 
| @@ -0,0 +1,82 @@ | |
| 1 | 
            +
            ---
         | 
| 2 | 
            +
            # tasks file for bump
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            # set up variables...
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            - name: >-
         | 
| 7 | 
            +
                get the repo root by cd'ing into bump_package_dir and asking git
         | 
| 8 | 
            +
              shell: |-
         | 
| 9 | 
            +
                git rev-parse --show-toplevel
         | 
| 10 | 
            +
              args:
         | 
| 11 | 
            +
                chdir: "{{ bump_package_dir }}"
         | 
| 12 | 
            +
              register: bump_git_revparse_showtoplevel
         | 
| 13 | 
            +
             | 
| 14 | 
            +
            - name: >-
         | 
| 15 | 
            +
                bump_repo_root is the stdout line from bump_git_revparse_showtoplevel
         | 
| 16 | 
            +
              set_fact:
         | 
| 17 | 
            +
                bump_repo_root: "{{ bump_git_revparse_showtoplevel.stdout_lines[0] }}"
         | 
| 18 | 
            +
             | 
| 19 | 
            +
            - name: >-
         | 
| 20 | 
            +
                bump_tag_prefix is simply 'v' if the the package dir is the repo root,
         | 
| 21 | 
            +
                otherwise it's the relative path to the package dir from the repo root
         | 
| 22 | 
            +
                with '/v' appended.
         | 
| 23 | 
            +
              set_fact_with_ruby:
         | 
| 24 | 
            +
                var_name: bump_tag_prefix
         | 
| 25 | 
            +
                bind:
         | 
| 26 | 
            +
                  repo_root: "{{ bump_repo_root }}"
         | 
| 27 | 
            +
                  package_dir: "{{ bump_package_dir }}"
         | 
| 28 | 
            +
                src: |
         | 
| 29 | 
            +
                  require 'pathname'
         | 
| 30 | 
            +
                  
         | 
| 31 | 
            +
                  repo_root_pathname = Pathname.new(repo_root).realpath
         | 
| 32 | 
            +
                  package_dir_pathname = Pathname.new(package_dir).realpath
         | 
| 33 | 
            +
                    
         | 
| 34 | 
            +
                  if repo_root_pathname == package_dir_pathname
         | 
| 35 | 
            +
                    'v'
         | 
| 36 | 
            +
                  else
         | 
| 37 | 
            +
                    package_dir_pathname.
         | 
| 38 | 
            +
                      relative_path_from(repo_root_pathname).
         | 
| 39 | 
            +
                      join('v')
         | 
| 40 | 
            +
                      .to_s
         | 
| 41 | 
            +
                  end
         | 
| 42 | 
            +
             | 
| 43 | 
            +
            - name: >-
         | 
| 44 | 
            +
                bump_package_type is determined by looking at the contents of package_dir
         | 
| 45 | 
            +
                for known package files.
         | 
| 46 | 
            +
              set_fact_with_ruby:
         | 
| 47 | 
            +
                var_name: bump_package_type
         | 
| 48 | 
            +
                bind:
         | 
| 49 | 
            +
                  package_dir: "{{ bump_package_dir }}"
         | 
| 50 | 
            +
                src: |
         | 
| 51 | 
            +
                  require 'pathname'
         | 
| 52 | 
            +
                  
         | 
| 53 | 
            +
                  dir = Pathname.new package_dir
         | 
| 54 | 
            +
                  
         | 
| 55 | 
            +
                  found_types = []
         | 
| 56 | 
            +
                  
         | 
| 57 | 
            +
                  # node packages (npm / yarn)
         | 
| 58 | 
            +
                  if dir.join('package.json').file?
         | 
| 59 | 
            +
                    found_types << :node
         | 
| 60 | 
            +
                  end
         | 
| 61 | 
            +
                  
         | 
| 62 | 
            +
                  gemspec_pathnames = Pathname.glob(dir + '*.gemspec')
         | 
| 63 | 
            +
                  unless gemspec_pathnames.empty?
         | 
| 64 | 
            +
                    if gemspec_pathnames.length > 1
         | 
| 65 | 
            +
                      warn "multiple gemspecs found, skipping gem type",
         | 
| 66 | 
            +
                        files: gemspec_pathnames
         | 
| 67 | 
            +
                    end
         | 
| 68 | 
            +
                    
         | 
| 69 | 
            +
                    found_types << :gem
         | 
| 70 | 
            +
                  end
         | 
| 71 | 
            +
                  
         | 
| 72 | 
            +
                  if dir.join('VERSION').file?
         | 
| 73 | 
            +
                    found_types << :file
         | 
| 74 | 
            +
                  end
         | 
| 75 | 
            +
                  
         | 
| 76 | 
            +
                  case found_types.length
         | 
| 77 | 
            +
             | 
| 78 | 
            +
            - debug: var=bump_package_type
         | 
| 79 | 
            +
             | 
| 80 | 
            +
            # include a tasks file based on the type of package
         | 
| 81 | 
            +
             | 
| 82 | 
            +
             | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: qb
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.1. | 
| 4 | 
            +
              version: 0.1.57
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - nrser
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: exe
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2017-04- | 
| 11 | 
            +
            date: 2017-04-17 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: bundler
         | 
| @@ -276,6 +276,7 @@ files: | |
| 276 276 | 
             
            - roles/nrser.blockinfile/tests/test-replace.yml
         | 
| 277 277 | 
             
            - roles/nrser.blockinfile/tests/test-state.yml
         | 
| 278 278 | 
             
            - roles/nrser.rb/.gitignore
         | 
| 279 | 
            +
            - roles/nrser.rb/library/set_fact_with_ruby.rb
         | 
| 279 280 | 
             
            - roles/nrser.rb/library/sync.rb.rb
         | 
| 280 281 | 
             
            - roles/nrser.rb/library/vars.rb.rb
         | 
| 281 282 | 
             
            - roles/nrser.rb/meta/main.yml
         | 
| @@ -306,6 +307,17 @@ files: | |
| 306 307 | 
             
            - roles/qb.build_gem/defaults/main.yml
         | 
| 307 308 | 
             
            - roles/qb.build_gem/meta/main.yml
         | 
| 308 309 | 
             
            - roles/qb.build_gem/tasks/main.yml
         | 
| 310 | 
            +
            - roles/qb.bump/.qb-options.yml
         | 
| 311 | 
            +
            - roles/qb.bump/README.md
         | 
| 312 | 
            +
            - roles/qb.bump/defaults/main.yml
         | 
| 313 | 
            +
            - roles/qb.bump/library/bump
         | 
| 314 | 
            +
            - roles/qb.bump/meta/main.yml
         | 
| 315 | 
            +
            - roles/qb.bump/meta/qb.yml
         | 
| 316 | 
            +
            - roles/qb.bump/tasks/frontend/level/dev.yml
         | 
| 317 | 
            +
            - roles/qb.bump/tasks/frontend/level/rc.yml
         | 
| 318 | 
            +
            - roles/qb.bump/tasks/frontend/level/release.yml
         | 
| 319 | 
            +
            - roles/qb.bump/tasks/frontend/main.yml
         | 
| 320 | 
            +
            - roles/qb.bump/tasks/main.yml
         | 
| 309 321 | 
             
            - roles/qb.gem/.qb-options.yml
         | 
| 310 322 | 
             
            - roles/qb.gem/defaults/main.yml
         | 
| 311 323 | 
             
            - roles/qb.gem/files/.gitkeep
         |