Class Index [+]

Quicksearch

Capistrano::Deploy::SCM::Subversion

Implements the Capistrano SCM interface for the Subversion revision control system (subversion.tigris.org).

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/subversion.rb, line 23
23:         def checkout(revision, destination)
24:           scm :checkout, arguments, arguments(:checkout), verbose, authentication, "-r#{revision}", repository, destination
25:         end
diff(from, to=nil) click to toggle source

Returns the command that will do an “svn diff” for the two revisions.

    # File lib/capistrano/recipes/deploy/scm/subversion.rb, line 40
40:         def diff(from, to=nil)
41:           scm :diff, repository, arguments(:diff), authentication, "-r#{from}:#{to || head}"
42:         end
export(revision, destination) click to toggle source

Returns the command that will do an “svn export” of the given revision to the given destination.

    # File lib/capistrano/recipes/deploy/scm/subversion.rb, line 35
35:         def export(revision, destination)
36:           scm :export, arguments, arguments(:export), verbose, authentication, "-r#{revision}", repository, destination
37:         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/subversion.rb, line 70
70:         def handle_data(state, stream, text)
71:           host = state[:channel][:host]
72:                 logger.info "[#{host} :: #{stream}] #{text}"
73:           case text
74:           when /\bpassword.*:/
75:             # subversion is prompting for a password
76:             "#{scm_password_prompt}\n"
77:           when %{\(yes/no\)}
78:             # subversion is asking whether or not to connect
79:             "yes\n"
80:           when /passphrase/
81:             # subversion is asking for the passphrase for the user's key
82:             "#{variable(:scm_passphrase)}\n"
83:           when /The entry \'(.+?)\' is no longer a directory/
84:             raise Capistrano::Error, "subversion can't update because directory '#{$1}' was replaced. Please add it to svn:ignore."
85:           when /accept \(t\)emporarily/
86:             # subversion is asking whether to accept the certificate
87:             "t\n"
88:           end
89:         end
head() click to toggle source

Subversion understands ‘HEAD’ to refer to the latest revision in the repository.

    # File lib/capistrano/recipes/deploy/scm/subversion.rb, line 17
17:         def head
18:           "HEAD"
19:         end
log(from, to=nil) click to toggle source

Returns an “svn log” command for the two revisions.

    # File lib/capistrano/recipes/deploy/scm/subversion.rb, line 45
45:         def log(from, to=nil)
46:           scm :log, repository, arguments(:log), authentication, "-r#{from}:#{to || head}"
47:         end
next_revision(revision) click to toggle source

Increments the given revision number and returns it.

    # File lib/capistrano/recipes/deploy/scm/subversion.rb, line 63
63:         def next_revision(revision)
64:           revision.to_i + 1
65:         end
query_revision(revision) click to toggle source

Attempts to translate the given revision identifier to a “real” revision. If the identifier is an integer, it will simply be returned. Otherwise, this will yield a string of the commands it needs to be executed (svn info), and will extract the revision from the response.

    # File lib/capistrano/recipes/deploy/scm/subversion.rb, line 53
53:         def query_revision(revision)
54:           return revision if revision =~ /^\d+$/
55:           command = scm(:info, arguments, arguments(:info), repository, authentication, "-r#{revision}")
56:           result = yield(command)
57:           yaml = YAML.load(result)
58:           raise "tried to run `#{command}' and got unexpected result #{result.inspect}" unless Hash === yaml
59:           [ (yaml['Last Changed Rev'] || 0).to_i, (yaml['Revision'] || 0).to_i ].max
60:         end
sync(revision, destination) click to toggle source

Returns the command that will do an “svn update” to the given revision, for the working copy at the given destination.

    # File lib/capistrano/recipes/deploy/scm/subversion.rb, line 29
29:         def sync(revision, destination)
30:           scm :switch, arguments, verbose, authentication, "-r#{revision}", repository, destination
31:         end

Private Instance Methods

authentication() click to toggle source

If a username is configured for the SCM, return the command-line switches for that. Note that we don’t need to return the password switch, since Capistrano will check for that prompt in the output and will respond appropriately.

     # File lib/capistrano/recipes/deploy/scm/subversion.rb, line 97
 97:           def authentication
 98:             username = variable(:scm_username)
 99:             return "" unless username
100:             result = "--username #{variable(:scm_username)} "
101:             result << "--password #{variable(:scm_password)} " unless variable(:scm_auth_cache) || variable(:scm_prefer_prompt)
102:             result << "--no-auth-cache " unless variable(:scm_auth_cache)
103:             result
104:           end
scm_password_prompt() click to toggle source
     # File lib/capistrano/recipes/deploy/scm/subversion.rb, line 112
112:           def scm_password_prompt
113:             @scm_password_prompt ||= variable(:scm_password) ||
114:               variable(:password) ||
115:               Capistrano::CLI.password_prompt("Subversion password: ")
116:           end
verbose() click to toggle source

If verbose output is requested, return nil, otherwise return the command-line switch for “quiet” (“-q”).

     # File lib/capistrano/recipes/deploy/scm/subversion.rb, line 108
108:           def verbose
109:             variable(:scm_verbose) ? nil : "-q"
110:           end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.