Files

Class/Module Index [+]

Quicksearch

Capistrano::Deploy::SCM::Cvs

Implements the Capistrano SCM interface for the CVS revision control system.

Public Instance Methods

checkout(revision, destination) click to toggle source

Returns the command that will check out the given revision to the given destination.

# File lib/capistrano/recipes/deploy/scm/cvs.rb, line 22
def checkout(revision, destination)
  [ prep_destination(destination),
    scm(verbose, cvs_root, :checkout, cvs_revision(revision), cvs_destination(destination), variable(:scm_module))
  ].join(' && ')
end
diff(from, to=nil) click to toggle source

Returns the command that will do an "cvs diff" for the two revisions.

# File lib/capistrano/recipes/deploy/scm/cvs.rb, line 45
def diff(from, to=nil)
  rev_type = revision_type(from)
  if rev_type == :date
    range_args = "-D '#{from}' -D '#{to || 'now'}'"
  else
    range_args = "-r '#{from}' -r '#{to || head}'"
  end
  scm cvs_root, :diff, range_args
end
export(revision, destination) click to toggle source

Returns the command that will do an "cvs export" of the given revision to the given destination.

# File lib/capistrano/recipes/deploy/scm/cvs.rb, line 38
def export(revision, destination)
  [ prep_destination(destination),
    scm(verbose, cvs_root, :export, cvs_revision(revision), cvs_destination(destination), variable(:scm_module))
  ].join(' && ')
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/cvs.rb, line 82
def handle_data(state, stream, text)
  logger.info "[#{stream}] #{text}"
  case text
  when /\bpassword.*:/
    # prompting for a password
    "#{variable(:scm_password) || variable(:password)}\n"
  when %{\(yes/no\)}
    # let's be agreeable...
    "yes\n"
  end
end
head() click to toggle source

CVS understands 'HEAD' to refer to the latest revision in the repository.

# File lib/capistrano/recipes/deploy/scm/cvs.rb, line 16
def head
  "HEAD"
end
log(from, to=nil) click to toggle source

Returns an "cvs log" command for the two revisions.

# File lib/capistrano/recipes/deploy/scm/cvs.rb, line 56
def log(from, to=nil)
  rev_type = revision_type(from)
  if rev_type == :date
    range_arg = "-d '#{from}<#{to || 'now'}'"
  else
    range_arg = "-r '#{from}:#{to || head}'"
  end
  scm cvs_root, :log, range_arg
end
query_revision(revision) click to toggle source

Unfortunately, cvs doesn't support the concept of a revision number like subversion and other SCM's do. For now, we'll rely on getting the timestamp of the latest checkin under the revision that's passed to us.

# File lib/capistrano/recipes/deploy/scm/cvs.rb, line 69
def query_revision(revision)
  return revision if revision_type(revision) == :date
  revision = yield(scm(cvs_root, :log, "-r#{revision}")).
               split("\n").
               select { |line| line =~ /^date:/ }.
               map { |line| line[/^date: (.*?);/, 1] }.
               sort.last + " UTC"
  return revision
end
sync(revision, destination) click to toggle source

Returns the command that will do an "cvs update" to the given revision, for the working copy at the given destination.

# File lib/capistrano/recipes/deploy/scm/cvs.rb, line 30
def sync(revision, destination)
  [ prep_destination(destination),
    scm(verbose, cvs_root, :update, cvs_revision(revision), cvs_destination(destination))
  ].join(' && ')
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.