Class: R10K::SVN::WorkingDir Private
- Inherits:
-
Object
- Object
- R10K::SVN::WorkingDir
- Includes:
- Logging, Util::Setopts
- Defined in:
- lib/r10k/svn/working_dir.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Manage an SVN working copy.
If SVN authentication is required, both username and password must be specified.
Constant Summary
Constants included from Logging
Logging::LOG_LEVELS, Logging::SYSLOG_LEVELS_MAP
Instance Attribute Summary collapse
- #password ⇒ Object readonly private
- #path ⇒ Object readonly private
- #username ⇒ Object readonly private
Instance Method Summary collapse
- #checkout(url, revision = nil) ⇒ Object private
-
#initialize(path, opts = {}) ⇒ WorkingDir
constructor
private
A new instance of WorkingDir.
-
#is_svn? ⇒ Boolean
private
Is the directory at this path actually an SVN repository?.
- #revision ⇒ Object private
- #root ⇒ Object private
- #update(revision = nil) ⇒ Object private
- #url ⇒ Object private
Methods included from Logging
add_outputters, debug_formatter, default_formatter, default_outputter, #logger, #logger_name, parse_level
Constructor Details
#initialize(path, opts = {}) ⇒ WorkingDir
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of WorkingDir.
37 38 39 40 41 42 43 44 45 |
# File 'lib/r10k/svn/working_dir.rb', line 37 def initialize(path, opts = {}) @path = path setopts(opts, {:username => :self, :password => :self}) if !!(@username) ^ !!(@password) raise ArgumentError, _("Both username and password must be specified") end end |
Instance Attribute Details
#password ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
30 31 32 |
# File 'lib/r10k/svn/working_dir.rb', line 30 def password @password end |
#path ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
20 21 22 |
# File 'lib/r10k/svn/working_dir.rb', line 20 def path @path end |
#username ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
25 26 27 |
# File 'lib/r10k/svn/working_dir.rb', line 25 def username @username end |
Instance Method Details
#checkout(url, revision = nil) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
73 74 75 76 77 78 79 80 81 |
# File 'lib/r10k/svn/working_dir.rb', line 73 def checkout(url, revision = nil) argv = ['checkout', url] argv << '-r' << revision if revision argv << @path.basename.to_s argv.concat(auth) argv << '-q' svn(argv, :cwd => @path.parent) end |
#is_svn? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Is the directory at this path actually an SVN repository?
48 49 50 51 |
# File 'lib/r10k/svn/working_dir.rb', line 48 def is_svn? dot_svn = @path + '.svn' dot_svn.exist? end |
#revision ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
53 54 55 |
# File 'lib/r10k/svn/working_dir.rb', line 53 def revision info.slice(/^Revision: (\d+)$/, 1) end |
#root ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
61 62 63 |
# File 'lib/r10k/svn/working_dir.rb', line 61 def root info.slice(/^Repository Root: (.*)$/, 1) end |
#update(revision = nil) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
65 66 67 68 69 70 71 |
# File 'lib/r10k/svn/working_dir.rb', line 65 def update(revision = nil) argv = %w[update] argv << '-r' << revision if revision argv.concat(auth) svn(argv, :cwd => @path) end |
#url ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
57 58 59 |
# File 'lib/r10k/svn/working_dir.rb', line 57 def url info.slice(/^URL: (.*)$/, 1) end |