class R10K::Module::SVN
Constants
- INITIALIZE_OPTS
Attributes
expected_revision[R]
@!attribute [r] #expected_revision
@return [String] The SVN revision that the repo should have checked out
expected_version[R]
@!attribute [r] #expected_revision
@return [String] The SVN revision that the repo should have checked out
full_path[R]
@!attribute [r] #full_path
@return [Pathname] The filesystem path to the SVN repo
password[R]
@!attribute [r] password
@return [String, nil] The SVN password to be passed to the underlying SVN commands @api private
username[R]
@!attribute [r] username
@return [String, nil] The SVN username to be passed to the underlying SVN commands @api private
working_dir[R]
@!attribute [r] #working_dir
@return [R10K::SVN::WorkingDir] @api private
Public Class Methods
implement?(name, args)
click to toggle source
# File lib/r10k/module/svn.rb, line 9 def self.implement?(name, args) args.is_a? Hash and args.has_key? :svn end
new(name, dirname, opts)
click to toggle source
Calls superclass method
R10K::Module::Base.new
# File lib/r10k/module/svn.rb, line 47 def initialize(name, dirname, opts) super setopts(opts, INITIALIZE_OPTS) @working_dir = R10K::SVN::WorkingDir.new(@path, :username => @username, :password => @password) end
Public Instance Methods
exist?()
click to toggle source
# File lib/r10k/module/svn.rb, line 78 def exist? path.exist? end
properties()
click to toggle source
# File lib/r10k/module/svn.rb, line 82 def properties { :expected => expected_revision, :actual => (@working_dir.revision rescue "(unresolvable)"), :type => :svn, } end
status()
click to toggle source
# File lib/r10k/module/svn.rb, line 53 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()
click to toggle source
# File lib/r10k/module/svn.rb, line 67 def sync case status when :absent install when :mismatched reinstall when :outdated update end end
Private Instance Methods
install()
click to toggle source
# File lib/r10k/module/svn.rb, line 92 def install FileUtils.mkdir @dirname unless File.directory? @dirname @working_dir.checkout(@url, @expected_revision) end
reinstall()
click to toggle source
# File lib/r10k/module/svn.rb, line 102 def reinstall uninstall install end
uninstall()
click to toggle source
# File lib/r10k/module/svn.rb, line 98 def uninstall path.rmtree end
update()
click to toggle source
# File lib/r10k/module/svn.rb, line 107 def update @working_dir.update(@expected_revision) end