Class: SwitchTower::SCM::Cvs
Overview
An SCM module for using CVS as your source control tool. You can specify it by placing the following line in your configuration:
set :scm, :cvs
Also, this module accepts a :cvs
configuration variable, which (if specified) will be used as the full path to the cvs executable on the remote machine:
set :cvs, "/opt/local/bin/cvs"
You can specify the location of your local copy (used to query the revisions, etc.) via the :local
variable, which defaults to “.”.
Also, you can specify the CVS_RSH variable to use on the remote machine(s) via the :cvs_rsh
variable. This defaults to the value of the CVS_RSH environment variable locally, or if it is not set, to “ssh”.
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#checkout(actor) ⇒ Object
Check out (on all servers associated with the current task) the latest revision.
-
#latest_revision ⇒ Object
Return a string representing the date of the last revision (CVS is seriously retarded, in that it does not give you a way to query when the last revision was made to the repository, so this is a fairly expensive operation…).
Methods inherited from Base
#current_revision, #diff, #initialize, #update
Constructor Details
This class inherits a constructor from SwitchTower::SCM::Base
Instance Method Details
#checkout(actor) ⇒ Object
Check out (on all servers associated with the current task) the latest revision. Uses the given actor instance to execute the command.
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/switchtower/scm/cvs.rb', line 42 def checkout(actor) cvs = configuration[:cvs] || "cvs" cvs_rsh = configuration[:cvs_rsh] || ENV['CVS_RSH'] || "ssh" command = <<-CMD cd #{configuration.releases_path}; CVS_RSH="#{cvs_rsh}" #{cvs} -d #{configuration.repository} -Q co -D "#{configuration.revision}" -d #{File.basename(actor.release_path)} #{actor.application}; CMD run_checkout(actor, command) do |ch, stream, out| prefix = "#{stream} :: #{ch[:host]}" actor.logger.info out, prefix if out =~ %r{password:} actor.logger.info "CVS is asking for a password", prefix ch.send_data "#{actor.password}\n" elsif out =~ %r{^Enter passphrase} = "CVS needs your key's passphrase and cannot proceed" actor.logger.info , prefix raise end end end |
#latest_revision ⇒ Object
Return a string representing the date of the last revision (CVS is seriously retarded, in that it does not give you a way to query when the last revision was made to the repository, so this is a fairly expensive operation…)
30 31 32 33 34 35 36 37 38 |
# File 'lib/switchtower/scm/cvs.rb', line 30 def latest_revision return @latest_revision if @latest_revision configuration.logger.debug "querying latest revision..." @latest_revision = cvs_log(configuration.local). split(/\r?\n/). grep(/^date: (.*?);/) { Time.parse($1).strftime("%F %T") }. sort. last end |