Class | Capistrano::Deploy::SCM::Cvs |
In: |
lib/capistrano/recipes/deploy/scm/cvs.rb
lib/capistrano/recipes/deploy/scm/cvs.rb |
Parent: | Base |
Implements the Capistrano SCM interface for the CVS revision control system.
Returns the command that will check out the given revision to the given destination.
# File lib/capistrano/recipes/deploy/scm/cvs.rb, line 22 22: def checkout(revision, destination) 23: [ prep_destination(destination), 24: scm(verbose, cvs_root, :checkout, cvs_revision(revision), cvs_destination(destination), variable(:scm_module)) 25: ].join(' && ') 26: end
Returns the command that will check out the given revision to the given destination.
# File lib/capistrano/recipes/deploy/scm/cvs.rb, line 22 22: def checkout(revision, destination) 23: [ prep_destination(destination), 24: scm(verbose, cvs_root, :checkout, cvs_revision(revision), cvs_destination(destination), variable(:scm_module)) 25: ].join(' && ') 26: end
Returns the command that will do an "cvs diff" for the two revisions.
# File lib/capistrano/recipes/deploy/scm/cvs.rb, line 45 45: def diff(from, to=nil) 46: rev_type = revision_type(from) 47: if rev_type == :date 48: range_args = "-D '#{from}' -D '#{to || 'now'}'" 49: else 50: range_args = "-r '#{from}' -r '#{to || head}'" 51: end 52: scm cvs_root, :diff, range_args 53: end
Returns the command that will do an "cvs diff" for the two revisions.
# File lib/capistrano/recipes/deploy/scm/cvs.rb, line 45 45: def diff(from, to=nil) 46: rev_type = revision_type(from) 47: if rev_type == :date 48: range_args = "-D '#{from}' -D '#{to || 'now'}'" 49: else 50: range_args = "-r '#{from}' -r '#{to || head}'" 51: end 52: scm cvs_root, :diff, range_args 53: end
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 38: def export(revision, destination) 39: [ prep_destination(destination), 40: scm(verbose, cvs_root, :export, cvs_revision(revision), cvs_destination(destination), variable(:scm_module)) 41: ].join(' && ') 42: end
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 38: def export(revision, destination) 39: [ prep_destination(destination), 40: scm(verbose, cvs_root, :export, cvs_revision(revision), cvs_destination(destination), variable(:scm_module)) 41: ].join(' && ') 42: end
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 81 81: def handle_data(state, stream, text) 82: logger.info "[#{stream}] #{text}" 83: case text 84: when /\bpassword.*:/i 85: # prompting for a password 86: "#{variable(:scm_password) || variable(:password)}\n" 87: when %r{\(yes/no\)} 88: # let's be agreeable... 89: "yes\n" 90: end 91: end
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 81 81: def handle_data(state, stream, text) 82: logger.info "[#{stream}] #{text}" 83: case text 84: when /\bpassword.*:/i 85: # prompting for a password 86: "#{variable(:scm_password) || variable(:password)}\n" 87: when %r{\(yes/no\)} 88: # let's be agreeable... 89: "yes\n" 90: end 91: end
CVS understands ‘HEAD’ to refer to the latest revision in the repository.
# File lib/capistrano/recipes/deploy/scm/cvs.rb, line 16 16: def head 17: "HEAD" 18: end
CVS understands ‘HEAD’ to refer to the latest revision in the repository.
# File lib/capistrano/recipes/deploy/scm/cvs.rb, line 16 16: def head 17: "HEAD" 18: end
Returns an "cvs log" command for the two revisions.
# File lib/capistrano/recipes/deploy/scm/cvs.rb, line 56 56: def log(from, to=nil) 57: rev_type = revision_type(from) 58: if rev_type == :date 59: range_arg = "-d '#{from}<#{to || 'now'}'" 60: else 61: range_arg = "-r '#{from}:#{to || head}'" 62: end 63: scm cvs_root, :log, range_arg 64: end
Returns an "cvs log" command for the two revisions.
# File lib/capistrano/recipes/deploy/scm/cvs.rb, line 56 56: def log(from, to=nil) 57: rev_type = revision_type(from) 58: if rev_type == :date 59: range_arg = "-d '#{from}<#{to || 'now'}'" 60: else 61: range_arg = "-r '#{from}:#{to || head}'" 62: end 63: scm cvs_root, :log, range_arg 64: end
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 69: def query_revision(revision) 70: return revision if revision_type(revision) == :date 71: revision = yield(scm(cvs_root, :log, "-r#{revision}")). 72: grep(/^date:/). 73: map { |line| line[/^date: (.*?);/, 1] }. 74: sort.last 75: return revision 76: end
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 69: def query_revision(revision) 70: return revision if revision_type(revision) == :date 71: revision = yield(scm(cvs_root, :log, "-r#{revision}")). 72: grep(/^date:/). 73: map { |line| line[/^date: (.*?);/, 1] }. 74: sort.last 75: return revision 76: end
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 30: def sync(revision, destination) 31: [ prep_destination(destination), 32: scm(verbose, cvs_root, :update, cvs_revision(revision), cvs_destination(destination)) 33: ].join(' && ') 34: end
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 30: def sync(revision, destination) 31: [ prep_destination(destination), 32: scm(verbose, cvs_root, :update, cvs_revision(revision), cvs_destination(destination)) 33: ].join(' && ') 34: end