Class: R10K::Module::SVN
- Includes:
- Util::Setopts
- Defined in:
- lib/r10k/module/svn.rb
Constant Summary collapse
- INITIALIZE_OPTS =
{ :svn => :url, :rev => :expected_revision, :revision => :expected_revision, :username => :self, :password => :self }
Instance Attribute Summary collapse
-
#expected_revision ⇒ Object
(also: #expected_version)
readonly
Returns the value of attribute expected_revision.
-
#full_path ⇒ Object
readonly
Returns the value of attribute full_path.
-
#password ⇒ Object
readonly
Returns the value of attribute password.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
-
#working_dir ⇒ Object
readonly
Returns the value of attribute working_dir.
Attributes inherited from Base
#dirname, #environment, #name, #owner, #path, #title
Class Method Summary collapse
Instance Method Summary collapse
- #exist? ⇒ Boolean
-
#initialize(name, dirname, opts, environment = nil) ⇒ SVN
constructor
A new instance of SVN.
- #properties ⇒ Object
- #status ⇒ Object
- #sync(opts = {}) ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(name, dirname, opts, environment = nil) ⇒ SVN
Returns a new instance of SVN.
47 48 49 50 51 52 53 |
# File 'lib/r10k/module/svn.rb', line 47 def initialize(name, dirname, opts, environment=nil) super setopts(opts, INITIALIZE_OPTS) @working_dir = R10K::SVN::WorkingDir.new(@path, :username => @username, :password => @password) end |
Instance Attribute Details
#expected_revision ⇒ Object (readonly) Also known as: expected_version
Returns the value of attribute expected_revision.
15 16 17 |
# File 'lib/r10k/module/svn.rb', line 15 def expected_revision @expected_revision end |
#full_path ⇒ Object (readonly)
Returns the value of attribute full_path.
20 21 22 |
# File 'lib/r10k/module/svn.rb', line 20 def full_path @full_path end |
#password ⇒ Object (readonly)
Returns the value of attribute password.
30 31 32 |
# File 'lib/r10k/module/svn.rb', line 30 def password @password end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
25 26 27 |
# File 'lib/r10k/module/svn.rb', line 25 def username @username end |
#working_dir ⇒ Object (readonly)
Returns the value of attribute working_dir.
35 36 37 |
# File 'lib/r10k/module/svn.rb', line 35 def working_dir @working_dir end |
Class Method Details
.implement?(name, args) ⇒ Boolean
9 10 11 |
# File 'lib/r10k/module/svn.rb', line 9 def self.implement?(name, args) args.is_a? Hash and args.has_key? :svn end |
Instance Method Details
#exist? ⇒ Boolean
80 81 82 |
# File 'lib/r10k/module/svn.rb', line 80 def exist? path.exist? end |
#properties ⇒ Object
84 85 86 87 88 89 90 |
# File 'lib/r10k/module/svn.rb', line 84 def properties { :expected => expected_revision, :actual => (@working_dir.revision rescue "(unresolvable)"), :type => :svn, } end |
#status ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/r10k/module/svn.rb', line 55 def status if not self.exist? :absent elsif not @working_dir.is_svn? :mismatched elsif not @url == @working_dir.url :mismatched elsif not @expected_revision == @working_dir.revision :outdated else :insync end end |
#sync(opts = {}) ⇒ Object
69 70 71 72 73 74 75 76 77 78 |
# File 'lib/r10k/module/svn.rb', line 69 def sync(opts={}) case status when :absent install when :mismatched reinstall when :outdated update end end |