Sha256: 2a03eb30970b11c2cb50c2ee0daef581b4785acb6203192d098dae2ffe3dcfd5

Contents?: true

Size: 1.69 KB

Versions: 95

Compression:

Stored size: 1.69 KB

Contents

require 'capistrano/recipes/deploy/strategy/base'

module Capistrano
  module Deploy
    module Strategy

      # An abstract superclass, which forms the base for all deployment
      # strategies which work by grabbing the code from the repository directly
      # from remote host. This includes deploying by checkout (the default),
      # and deploying by export.
      class Remote < Base
        # Executes the SCM command for this strategy and writes the REVISION
        # mark file to each host.
        def deploy!
          scm_run "#{command} && #{mark}"
        end

        def check!
          super.check do |d|
            d.remote.command(source.command)
          end
        end

        protected

          # Runs the given command, filtering output back through the
          # #handle_data filter of the SCM implementation.
          def scm_run(command)
            run(command) do |ch,stream,text|
              ch[:state] ||= { :channel => ch }
              output = source.handle_data(ch[:state], stream, text)
              ch.send_data(output) if output
            end
          end

          # An abstract method which must be overridden in subclasses, to
          # return the actual SCM command(s) which must be executed on each
          # target host in order to perform the deployment.
          def command
            raise NotImplementedError, "`command' is not implemented by #{self.class.name}"
          end

          # Returns the command which will write the identifier of the
          # revision being deployed to the REVISION file on each host.
          def mark
            "(echo #{revision} > #{configuration[:release_path]}/REVISION)"
          end
      end

    end
  end
end

Version data entries

95 entries across 95 versions & 11 rubygems

Version Path
capistrano-2.15.11 lib/capistrano/recipes/deploy/strategy/remote.rb
capistrano-2.15.10 lib/capistrano/recipes/deploy/strategy/remote.rb
capistrano-2.15.9 lib/capistrano/recipes/deploy/strategy/remote.rb
wulffeld-capistrano-2.5.8.3 lib/capistrano/recipes/deploy/strategy/remote.rb
capistrano-2.15.8 lib/capistrano/recipes/deploy/strategy/remote.rb
capistrano-2.5.22 lib/capistrano/recipes/deploy/strategy/remote.rb
capistrano-2.15.7 lib/capistrano/recipes/deploy/strategy/remote.rb
capistrano-2.15.6 lib/capistrano/recipes/deploy/strategy/remote.rb
dan-capistrano-2.5.6 lib/capistrano/recipes/deploy/strategy/remote.rb
fotonauts-capistrano-2.5.2 lib/capistrano/recipes/deploy/strategy/remote.rb
mbailey-capistrano-2.5.5 lib/capistrano/recipes/deploy/strategy/remote.rb
mbailey-capistrano-2.5.6 lib/capistrano/recipes/deploy/strategy/remote.rb
mbailey-capistrano-2.5.7 lib/capistrano/recipes/deploy/strategy/remote.rb
sneakin-capistrano-2.5.5 lib/capistrano/recipes/deploy/strategy/remote.rb
thoughtbot-capistrano-2.5.5 lib/capistrano/recipes/deploy/strategy/remote.rb
thoughtbot-capistrano-2.5.6 lib/capistrano/recipes/deploy/strategy/remote.rb
wulffeld-capistrano-2.5.8.1 lib/capistrano/recipes/deploy/strategy/remote.rb
wulffeld-capistrano-2.5.8 lib/capistrano/recipes/deploy/strategy/remote.rb
capistrano-2.15.5 lib/capistrano/recipes/deploy/strategy/remote.rb
minmb-capistrano-2.15.4 lib/capistrano/recipes/deploy/strategy/remote.rb