class R10K::Module::SVN
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.has_key?(:svn) || args[:type].to_s == 'svn' end
new(name, dirname, opts, environment=nil)
click to toggle source
Calls superclass method
R10K::Module::Base::new
# File lib/r10k/module/svn.rb, line 43 def initialize(name, dirname, opts, environment=nil) super setopts(opts, { # Standard option interface :source => :url, :version => :expected_revision, :type => ::R10K::Util::Setopts::Ignore, # Type-specific options :svn => :url, :rev => :expected_revision, :revision => :expected_revision, :username => :self, :password => :self }, :raise_on_unhandled => false) @working_dir = R10K::SVN::WorkingDir.new(@path, :username => @username, :password => @password) end
statically_defined_version(name, args)
click to toggle source
# File lib/r10k/module/svn.rb, line 13 def self.statically_defined_version(name, args) nil end
Public Instance Methods
exist?()
click to toggle source
# File lib/r10k/module/svn.rb, line 97 def exist? path.exist? end
properties()
click to toggle source
# File lib/r10k/module/svn.rb, line 101 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 62 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={})
click to toggle source
@param [Hash] opts Deprecated @return [Boolean] true if the module was updated, false otherwise
# File lib/r10k/module/svn.rb, line 78 def sync(opts={}) updated = false if should_sync? case status when :absent install updated = true when :mismatched reinstall updated = true when :outdated update updated = true end maybe_delete_spec_dir end updated end
Private Instance Methods
install()
click to toggle source
# File lib/r10k/module/svn.rb, line 111 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 121 def reinstall uninstall install end
uninstall()
click to toggle source
# File lib/r10k/module/svn.rb, line 117 def uninstall path.rmtree end
update()
click to toggle source
# File lib/r10k/module/svn.rb, line 126 def update @working_dir.update(@expected_revision) end