Class: Capistrano::Deploy::SCM::Perforce

### Home Classes Methods

### In Files

- lib/capistrano/recipes/deploy/scm/perforce.rb

### Parent

Capistrano::Deploy::SCM::Base

### Methods

- #checkout
- #diff
- #export
- #handle_data
- #head
- #log
- #next_revision
- #query_revision
- #sync

### 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::SCM::Perforce

Implements the Capistrano SCM interface for the Perforce revision control system (www.perforce.com).

### Public Instance Methods

checkout(revision, destination) click to toggle source

Returns the command that will sync the given revision to the given destination directory. The perforce client has a fixed destination so the files must be copied from there to their intended resting place.

    # File lib/capistrano/recipes/deploy/scm/perforce.rb, line 27
    def checkout(revision, destination)
      p4_sync(revision, destination, p4sync_flags)
    end

diff(from, to=head) click to toggle source

Returns the command that will do an "p4 diff2" for the two revisions.

    # File lib/capistrano/recipes/deploy/scm/perforce.rb, line 46
    def diff(from, to=head)
      scm authentication, :diff2, "-u -db", "//#{p4client}/...#{rev_no(from)}", "//#{p4client}/...#{rev_no(to)}"
    end

export(revision, destination) click to toggle source

Returns the command that will sync the given revision to the given destination directory. The perforce client has a fixed destination so the files must be copied from there to their intended resting place.

    # File lib/capistrano/recipes/deploy/scm/perforce.rb, line 41
    def export(revision, destination)
      p4_sync(revision, destination, p4sync_flags)
    end

handle_data(state, stream, text) click to toggle source

Determines what the response should be for a particular bit of text from the SCM. Password prompts, connection requests, passphrases, etc. are handled here.

    # File lib/capistrano/recipes/deploy/scm/perforce.rb, line 69
    def handle_data(state, stream, text)
      case text
      when /\(P4PASSWD\) invalid or unset\./
        raise Capistrano::Error, "scm_password (or p4passwd) is incorrect or unset"
      when /Can.t create a new user.*/
        raise Capistrano::Error, "scm_username (or p4user) is incorrect or unset"
      when /Perforce client error\:/
        raise Capistrano::Error, "p4port is incorrect or unset"
      when /Client \'[\w\-\_\.]+\' unknown.*/
        raise Capistrano::Error, "p4client is incorrect or unset"
      end
    end

head() click to toggle source

Perforce understands 'head' to refer to the latest revision in the depot.

    # File lib/capistrano/recipes/deploy/scm/perforce.rb, line 20
    def head
      'head'
    end

log(from=1, to=head) click to toggle source

Returns a "p4 changes" command for the two revisions.

    # File lib/capistrano/recipes/deploy/scm/perforce.rb, line 51
    def log(from=1, to=head)
      scm authentication, :changes, "-s submitted", "//#{p4client}/...#{rev_no(from)},#{rev_no(to)}"
    end

next_revision(revision) click to toggle source

Increments the given revision number and returns it.

    # File lib/capistrano/recipes/deploy/scm/perforce.rb, line 62
    def next_revision(revision)
      revision.to_i + 1
    end

query_revision(revision) click to toggle source

    # File lib/capistrano/recipes/deploy/scm/perforce.rb, line 55
    def query_revision(revision)
      return revision if revision.to_s =~ /^\d+$/
      command = scm(authentication, :changes, "-s submitted", "-m 1", "//#{p4client}/...#{rev_no(revision)}")
      yield(command)[/Change (\d+) on/, 1]
    end

sync(revision, destination) click to toggle source

Returns the command that will sync the given revision to the given destination directory. The perforce client has a fixed destination so the files must be copied from there to their intended resting place.

    # File lib/capistrano/recipes/deploy/scm/perforce.rb, line 34
    def sync(revision, destination)
      p4_sync(revision, destination, p4sync_flags)
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.