This class defines the abstract interface for all Capistrano deployment strategies. Subclasses must implement at least the # method.
Performs a check on the remote hosts to determine whether everything is setup such that a deploy could succeed.
# File lib/capistrano/recipes/deploy/strategy/base.rb, line 30 30: def check! 31: Dependencies.new(configuration) do |d| 32: d.remote.directory(configuration[:releases_path]).or("`#{configuration[:releases_path]}' does not exist. Please run `cap deploy:setup'.") 33: d.remote.writable(configuration[:deploy_to]).or("You do not have permissions to write to `#{configuration[:deploy_to]}'.") 34: d.remote.writable(configuration[:releases_path]).or("You do not have permissions to write to `#{configuration[:releases_path]}'.") 35: end 36: end
Executes the necessary commands to deploy the revision of the source code identified by the revision variable. Additionally, this should write the value of the revision variable to a file called REVISION, in the base of the deployed revision. This file is used by other tasks, to perform diffs and such.
# File lib/capistrano/recipes/deploy/strategy/base.rb, line 24 24: def deploy! 25: raise NotImplementedError, "`deploy!' is not implemented by #{self.class.name}" 26: end
This is to allow helper methods like “run” and “put” to be more easily accessible to strategy implementations.
# File lib/capistrano/recipes/deploy/strategy/base.rb, line 42 42: def method_missing(sym, *args, &block) 43: if configuration.respond_to?(sym) 44: configuration.send(sym, *args, &block) 45: else 46: super 47: end 48: end
A wrapper for Kernel#system that logs the command being executed.
# File lib/capistrano/recipes/deploy/strategy/base.rb, line 51 51: def system(*args) 52: cmd = args.join(' ') 53: result = nil 54: if RUBY_PLATFORM =~ /win32/ 55: cmd = cmd.split(/\s+/).collect {|w| w.match(/^[\w+]+:\/\//) ? w : w.gsub('/', '\') }.join(' ') # Split command by spaces, change / by \\ unless element is a some+thing:// 56: cmd.gsub!(/^cd /,'cd /D ') # Replace cd with cd /D 57: cmd.gsub!(/&& cd /,'&& cd /D ') # Replace cd with cd /D 58: logger.trace "executing locally: #{cmd}" 59: elapsed = Benchmark.realtime do 60: result = super(cmd) 61: end 62: else 63: logger.trace "executing locally: #{cmd}" 64: elapsed = Benchmark.realtime do 65: result = super 66: end 67: end 68: 69: logger.trace "command finished in #{(elapsed * 1000).round}ms" 70: result 71: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.