revision 2.0.1 → 2.1.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/lib/revision/releasable.rb +38 -28
- data/lib/revision/version.rb +4 -1
- data/releasables.yaml +4 -0
- metadata +1 -1
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 9986acff4f8508220c70e554255da7faa2b5d3902469f48802edf4527cf3a5fe
         | 
| 4 | 
            +
              data.tar.gz: 2fcb43d6ed4e766b13306b6b329c61c7f14653dc19da4f535c296438f6c99347
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 79ae96751598c3e8db0623049cea440d940070f4e2793f57e9acf274475443beea2006d4ff551e1718bab7da010b7956589b6fa59a8bcfd0260e3e41ea4f0418
         | 
| 7 | 
            +
              data.tar.gz: 2a999551ccfbf8db424366aee105a8dc9bf9c180934c5169a16063f5261e683b0c9a5083077244412367bea639895d46d6a355443cd62c74d69e211ca46dc3f8
         | 
    
        data/lib/revision/releasable.rb
    CHANGED
    
    | @@ -248,6 +248,38 @@ module Revision | |
| 248 248 | 
             
                  end
         | 
| 249 249 | 
             
                end
         | 
| 250 250 |  | 
| 251 | 
            +
                def deploy_to(d)
         | 
| 252 | 
            +
                  destination = File.expand_path(d[:dest])
         | 
| 253 | 
            +
             | 
| 254 | 
            +
                  if d.dig(:pre)
         | 
| 255 | 
            +
                    exec_pipeline('deploy (pre / #{d[:dest]})', d[:pre])
         | 
| 256 | 
            +
                  end
         | 
| 257 | 
            +
             | 
| 258 | 
            +
                  puts "Deploying #{artefacts.length} build artefacts to #{destination}..."
         | 
| 259 | 
            +
                  if not File.exist?(destination)
         | 
| 260 | 
            +
                    puts "... folder not found -> creating ... '#{destination}'"
         | 
| 261 | 
            +
                    FileUtils.mkdir_p(destination)
         | 
| 262 | 
            +
                  end
         | 
| 263 | 
            +
                  artefacts.each.with_index(1) do |a, idx|
         | 
| 264 | 
            +
                    # src, dest = entry
         | 
| 265 | 
            +
                    src = File.join(@root,a[:src])
         | 
| 266 | 
            +
                    dest = destination.empty? ? a[:dest] : File.join(destination, a[:dest])
         | 
| 267 | 
            +
                    puts "... (#{idx}/#{artefacts.length}) #{src} => #{dest}"
         | 
| 268 | 
            +
                    if File.exist?(dest)
         | 
| 269 | 
            +
                      puts "... deleting existing '#{dest}' ..."
         | 
| 270 | 
            +
                      FileUtils.rm_rf(dest)
         | 
| 271 | 
            +
                    end
         | 
| 272 | 
            +
                    puts "... deploying '#{src}' -> '#{dest}'"
         | 
| 273 | 
            +
                    FileUtils.cp_r(src,dest)
         | 
| 274 | 
            +
                    puts "... writing checksum for '#{dest}' to '#{Checksum.from_file(dest).write}'" if a[:chk]
         | 
| 275 | 
            +
                  end
         | 
| 276 | 
            +
                  File.open(File.join(destination,changelog_name),'w') { |f| output_changelog(f)}
         | 
| 277 | 
            +
             | 
| 278 | 
            +
                  if d.dig(:post)
         | 
| 279 | 
            +
                    exec_pipeline('deploy (post / #{d[:dest]})', d[:post])
         | 
| 280 | 
            +
                  end
         | 
| 281 | 
            +
                end
         | 
| 282 | 
            +
             | 
| 251 283 | 
             
                def deploy(destination='')
         | 
| 252 284 | 
             
                  destinations = []
         | 
| 253 285 | 
             
                  if not destination.empty?
         | 
| @@ -263,34 +295,12 @@ module Revision | |
| 263 295 | 
             
                  raise Errors::NotSpecified.new(':deploy') if destinations.empty?
         | 
| 264 296 |  | 
| 265 297 | 
             
                  destinations.each do |d|
         | 
| 266 | 
            -
                     | 
| 267 | 
            -
             | 
| 268 | 
            -
                     | 
| 269 | 
            -
                      exec_pipeline( | 
| 270 | 
            -
                     | 
| 271 | 
            -
             | 
| 272 | 
            -
                    puts "Deploying #{artefacts.length} build artefacts to #{destination}..."
         | 
| 273 | 
            -
                    if not File.exist?(destination)
         | 
| 274 | 
            -
                      puts "... folder not found -> creating ... '#{destination}'"
         | 
| 275 | 
            -
                      FileUtils.mkdir_p(destination)
         | 
| 276 | 
            -
                    end
         | 
| 277 | 
            -
                    artefacts.each.with_index(1) do |a, idx|
         | 
| 278 | 
            -
                      # src, dest = entry
         | 
| 279 | 
            -
                      src = File.join(@root,a[:src])
         | 
| 280 | 
            -
                      dest = destination.empty? ? a[:dest] : File.join(destination, a[:dest])
         | 
| 281 | 
            -
                      puts "... (#{idx}/#{artefacts.length}) #{src} => #{dest}"
         | 
| 282 | 
            -
                      if File.exist?(dest)
         | 
| 283 | 
            -
                        puts "... deleting existing '#{dest}' ..."
         | 
| 284 | 
            -
                        FileUtils.rm_rf(dest)
         | 
| 285 | 
            -
                      end
         | 
| 286 | 
            -
                      puts "... deploying '#{src}' -> '#{dest}'"
         | 
| 287 | 
            -
                      FileUtils.cp_r(src,dest)
         | 
| 288 | 
            -
                      puts "... writing checksum for '#{dest}' to '#{Checksum.from_file(dest).write}'" if a[:chk]
         | 
| 289 | 
            -
                    end
         | 
| 290 | 
            -
                    File.open(File.join(destination,changelog_name),'w') { |f| output_changelog(f)}
         | 
| 291 | 
            -
             | 
| 292 | 
            -
                    if d.dig(:post)
         | 
| 293 | 
            -
                      exec_pipeline('deploy (post / #{d[:dest]})', d[:post])
         | 
| 298 | 
            +
                    if d.dig(:dest)
         | 
| 299 | 
            +
                      deploy_to(d)
         | 
| 300 | 
            +
                    elsif d.dig(:steps)
         | 
| 301 | 
            +
                      exec_pipeline("deploy", d[:steps])
         | 
| 302 | 
            +
                    else
         | 
| 303 | 
            +
                      puts "ERROR: Please specify a series of deployment :steps: or a :dest: in releasables.yaml"
         | 
| 294 304 | 
             
                    end
         | 
| 295 305 | 
             
                  end
         | 
| 296 306 |  | 
    
        data/lib/revision/version.rb
    CHANGED
    
    | @@ -1,10 +1,13 @@ | |
| 1 1 | 
             
            # Defines the revision ID for the revision gem
         | 
| 2 2 | 
             
            module Revision
         | 
| 3 | 
            -
              VERSION = "2.0 | 
| 3 | 
            +
              VERSION = "2.1.0".freeze
         | 
| 4 4 | 
             
            end
         | 
| 5 5 |  | 
| 6 6 | 
             
            # <BEGIN CHANGELOG>
         | 
| 7 7 | 
             
            #
         | 
| 8 | 
            +
            # Version 2.1.0 (16 Apr 2024)
         | 
| 9 | 
            +
            # - feat(deploy): A deployment target can now be a series of commands rather than a filesystem destination
         | 
| 10 | 
            +
            #
         | 
| 8 11 | 
             
            # Version 2.0.1 (30 Nov 2023)
         | 
| 9 12 | 
             
            # - deps(thor): Relaxed version dep from ~>1.0 to >=0.14
         | 
| 10 13 | 
             
            #
         | 
    
        data/releasables.yaml
    CHANGED