Class: Capistrano::Deploy::RemoteDependency

### Home Classes Methods

### In Files

- lib/capistrano/recipes/deploy/remote_dependency.rb

### Parent

Object

### Methods

- ::new
- #command
- #deb
- #directory
- #file
- #gem
- #match
- #message
- #or
- #pass?
- #rpm
- #writable

### Files

- help.txt

### Class/Module Index

Quicksearch

- Capistrano
- Capistrano::CLI
- Capistrano::CLI::Execute
- Capistrano::CLI::Execute::ClassMethods
- Capistrano::CLI::Help
- Capistrano::CLI::Options
- Capistrano::CLI::Options::ClassMethods
- Capistrano::CLI::UI
- Capistrano::CLI::UI::ClassMethods
- Capistrano::Callback
- Capistrano::Command
- Capistrano::Command::Tree
- Capistrano::Command::Tree::Branch
- Capistrano::Command::Tree::ConditionBranch
- Capistrano::Command::Tree::ConditionBranch::Evaluator
- Capistrano::Command::Tree::ElseBranch
- Capistrano::Configuration
- Capistrano::Configuration::Actions
- Capistrano::Configuration::Actions::FileTransfer
- Capistrano::Configuration::Actions::Inspect
- Capistrano::Configuration::Actions::Invocation
- Capistrano::Configuration::Actions::Invocation::ClassMethods
- Capistrano::Configuration::AliasTask
- Capistrano::Configuration::Callbacks
- Capistrano::Configuration::Connections
- Capistrano::Configuration::Execution
- Capistrano::Configuration::Loading
- Capistrano::Configuration::Loading::ClassMethods
- Capistrano::Configuration::LogFormatters
- Capistrano::Configuration::Namespaces
- Capistrano::Configuration::Namespaces::Namespace
- Capistrano::Configuration::Roles
- Capistrano::Configuration::Servers
- Capistrano::Configuration::Variables
- Capistrano::Deploy
- Capistrano::Deploy::Dependencies
- Capistrano::Deploy::LocalDependency
- Capistrano::Deploy::RemoteDependency
- Capistrano::Deploy::SCM
- Capistrano::Deploy::SCM::Accurev
- Capistrano::Deploy::SCM::Accurev::InternalRevision
- Capistrano::Deploy::SCM::Base
- Capistrano::Deploy::SCM::Base::LocalProxy
- Capistrano::Deploy::SCM::Bzr
- Capistrano::Deploy::SCM::Cvs
- Capistrano::Deploy::SCM::Darcs
- Capistrano::Deploy::SCM::Git
- Capistrano::Deploy::SCM::Mercurial
- Capistrano::Deploy::SCM::None
- Capistrano::Deploy::SCM::Perforce
- Capistrano::Deploy::SCM::Subversion
- Capistrano::Deploy::Strategy
- Capistrano::Deploy::Strategy::Base
- Capistrano::Deploy::Strategy::Checkout
- Capistrano::Deploy::Strategy::Copy
- Capistrano::Deploy::Strategy::Export
- Capistrano::Deploy::Strategy::Remote
- Capistrano::Deploy::Strategy::RemoteCache
- Capistrano::Deploy::Strategy::UnsharedRemoteCache
- Capistrano::ProcCallback
- Capistrano::Processable
- Capistrano::Processable::SessionAssociation
- Capistrano::RemoteError
- Capistrano::Role
- Capistrano::Role::DynamicServerList
- Capistrano::SSH
- Capistrano::ServerDefinition
- Capistrano::Shell
- Capistrano::TaskCallback
- Capistrano::TaskDefinition
- Capistrano::Transfer
- Capistrano::Transfer::SFTPTransferWrapper
- Capistrano::Version
- Kernel
- Object
- String

No matching classes.

# Capistrano::Deploy::RemoteDependency

### Attributes

configuration[R]
hosts[R]

### Public Class Methods

new(configuration) click to toggle source

    # File lib/capistrano/recipes/deploy/remote_dependency.rb, line 9
    def initialize(configuration)
      @configuration = configuration
      @success = true
      @hosts = nil
    end

### Public Instance Methods

command(command, options={}) click to toggle source

    # File lib/capistrano/recipes/deploy/remote_dependency.rb, line 33
    def command(command, options={})
      @message ||= "`#{command}' could not be found in the path"
      try("which #{command}", options)
      self
    end

deb(name, version, options={}) click to toggle source

    # File lib/capistrano/recipes/deploy/remote_dependency.rb, line 46
    def deb(name, version, options={})
      @message ||= "package `#{name}' #{version} could not be found"
      try("dpkg -s #{name} | grep '^Version: #{version}'", options)
      self
    end

directory(path, options={}) click to toggle source

    # File lib/capistrano/recipes/deploy/remote_dependency.rb, line 15
    def directory(path, options={})
      @message ||= "`#{path}' is not a directory"
      try("test -d #{path}", options)
      self
    end

file(path, options={}) click to toggle source

    # File lib/capistrano/recipes/deploy/remote_dependency.rb, line 21
    def file(path, options={})
      @message ||= "`#{path}' is not a file"
      try("test -f #{path}", options)
      self
    end

gem(name, version, options={}) click to toggle source

    # File lib/capistrano/recipes/deploy/remote_dependency.rb, line 39
    def gem(name, version, options={})
      @message ||= "gem `#{name}' #{version} could not be found"
      gem_cmd = configuration.fetch(:gem_command, "gem")
      try("#{gem_cmd} specification --version '#{version}' #{name} 2>&1 | awk 'BEGIN { s = 0 } /^name:/ { s = 1; exit }; END { if(s == 0) exit 1 }'", options)
      self
    end

match(command, expect, options={}) click to toggle source

    # File lib/capistrano/recipes/deploy/remote_dependency.rb, line 58
    def match(command, expect, options={})
      expect = Regexp.new(Regexp.escape(expect.to_s)) unless expect.is_a?(Regexp)

      output_per_server = {}
      try("#{command} ", options) do |ch, stream, out|
        output_per_server[ch[:server]] ||= ''
        output_per_server[ch[:server]] += out
      end

      # It is possible for some of these commands to return a status != 0
      # (for example, rake --version exits with a 1). For this check we
      # just care if the output matches, so we reset the success flag.
      @success = true

      errored_hosts = []
      output_per_server.each_pair do |server, output|
        next if output =~ expect
        errored_hosts << server
      end

      if errored_hosts.any?
        @hosts = errored_hosts.join(', ')
        output = output_per_server[errored_hosts.first]
        @message = "the output #{output.inspect} from #{command.inspect} did not match #{expect.inspect}"
        @success = false
      end

      self
    end

message() click to toggle source

    # File lib/capistrano/recipes/deploy/remote_dependency.rb, line 97
    def message
      s = @message.dup
      s << " (#{@hosts})" if @hosts
      s
    end

or(message) click to toggle source

    # File lib/capistrano/recipes/deploy/remote_dependency.rb, line 88
    def or(message)
      @message = message
      self
    end

pass?() click to toggle source

    # File lib/capistrano/recipes/deploy/remote_dependency.rb, line 93
    def pass?
      @success
    end

rpm(name, version, options={}) click to toggle source

    # File lib/capistrano/recipes/deploy/remote_dependency.rb, line 52
    def rpm(name, version, options={})
      @message ||= "package `#{name}' #{version} could not be found"
      try("rpm -q #{name} | grep '#{version}'", options)
      self
    end

writable(path, options={}) click to toggle source

    # File lib/capistrano/recipes/deploy/remote_dependency.rb, line 27
    def writable(path, options={})
      @message ||= "`#{path}' is not writable"
      try("test -w #{path}", options)
      self
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.