Sha256: 03d79c52876421e32306c35ed8c834037b2e4538dd5a70e9ddeeffa6611ba45e

Contents?: true

Size: 1.11 KB

Versions: 35

Compression:

Stored size: 1.11 KB

Contents

# Tasks to aid the migration of an established Capistrano 1.x installation to
# Capistrano 2.x.

namespace :upgrade do
  desc <<-DESC
    Migrate from the revisions log to REVISION. Capistrano 1.x recorded each \
    deployment to a revisions.log file. Capistrano 2.x is cleaner, and just \
    puts a REVISION file in the root of the deployed revision. This task \
    migrates from the revisions.log used in Capistrano 1.x, to the REVISION \
    tag file used in Capistrano 2.x. It is non-destructive and may be safely \
    run any number of times.
  DESC
  task :revisions, :except => { :no_release => true } do
    revisions = capture("cat #{deploy_to}/revisions.log")

    mapping = {}
    revisions.each do |line|
      revision, directory = line.chomp.split[-2,2]
      mapping[directory] = revision
    end

    commands = mapping.keys.map do |directory|
      "echo '.'; test -d #{directory} && echo '#{mapping[directory]}' > #{directory}/REVISION"
    end

    command = commands.join(";")

    run "cd #{releases_path}; #{command}; true" do |ch, stream, out|
      STDOUT.print(".")
      STDOUT.flush
    end
  end
end

Version data entries

35 entries across 35 versions & 8 rubygems

Version Path
wulffeld-capistrano-2.5.8.3 lib/capistrano/recipes/upgrade.rb
dan-capistrano-2.5.6 lib/capistrano/recipes/upgrade.rb
fotonauts-capistrano-2.5.2 lib/capistrano/recipes/upgrade.rb
mbailey-capistrano-2.5.5 lib/capistrano/recipes/upgrade.rb
mbailey-capistrano-2.5.6 lib/capistrano/recipes/upgrade.rb
mbailey-capistrano-2.5.7 lib/capistrano/recipes/upgrade.rb
sneakin-capistrano-2.5.5 lib/capistrano/recipes/upgrade.rb
thoughtbot-capistrano-2.5.5 lib/capistrano/recipes/upgrade.rb
thoughtbot-capistrano-2.5.6 lib/capistrano/recipes/upgrade.rb
wulffeld-capistrano-2.5.8.1 lib/capistrano/recipes/upgrade.rb
wulffeld-capistrano-2.5.8 lib/capistrano/recipes/upgrade.rb
wulffeld-capistrano-2.5.8.2 lib/capistrano/recipes/upgrade.rb
capistrano-2.5.14 lib/capistrano/recipes/upgrade.rb
capistrano-2.5.13 lib/capistrano/recipes/upgrade.rb
capistrano-2.5.12 lib/capistrano/recipes/upgrade.rb
capistrano-2.5.11 lib/capistrano/recipes/upgrade.rb
capistrano-2.5.10 lib/capistrano/recipes/upgrade.rb
capistrano-2.5.9 lib/capistrano/recipes/upgrade.rb
capistrano-2.5.6 lib/capistrano/recipes/upgrade.rb
capistrano-2.5.7 lib/capistrano/recipes/upgrade.rb