@!attribute [r] #expected_revision
@return [String] The SVN revision that the repo should have checked out
@!attribute [r] #expected_revision
@return [String] The SVN revision that the repo should have checked out
@!attribute [r] #full_path
@return [Pathname] The filesystem path to the SVN repo
@!attribute [r] password
@return [String, nil] The SVN password to be passed to the underlying SVN commands @api private
@!attribute [r] username
@return [String, nil] The SVN username to be passed to the underlying SVN commands @api private
@!attribute [r] #working_dir
@return [R10K::SVN::WorkingDir] @api private
# File lib/r10k/module/svn.rb, line 9 def self.implement?(name, args) args.is_a? Hash and args.has_key? :svn end
# 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
# File lib/r10k/module/svn.rb, line 80 def exist? path.exist? end
# File lib/r10k/module/svn.rb, line 84 def properties { :expected => expected_revision, :actual => (@working_dir.revision rescue "(unresolvable)"), :type => :svn, } end
# 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
# File lib/r10k/module/svn.rb, line 69 def sync(opts={}) case status when :absent install when :mismatched reinstall when :outdated update end end
# File lib/r10k/module/svn.rb, line 94 def install FileUtils.mkdir @dirname unless File.directory? @dirname @working_dir.checkout(@url, @expected_revision) end
# File lib/r10k/module/svn.rb, line 104 def reinstall uninstall install end
# File lib/r10k/module/svn.rb, line 100 def uninstall path.rmtree end
# File lib/r10k/module/svn.rb, line 109 def update @working_dir.update(@expected_revision) end