Class: R10K::Source::SVN
- Includes:
- Logging, Util::Purgeable, Util::Setopts
- Defined in:
- lib/r10k/source/svn.rb
Overview
This class implements a source for SVN environments.
An SVN source generates environments by enumerating the branches and trunk for a given SVN remote. SVN repositories must conform to the conventional SVN repository structure with the directories trunk/, branches/, and optionally tags/ in the root of the repository. The trunk/ directory is specifically mapped to the production environment, branches are created as environments with the name of the given branch.
Defined Under Namespace
Classes: BranchName
Constant Summary
Constants included from Logging
Instance Attribute Summary collapse
- #password ⇒ Object readonly
- #remote ⇒ Object readonly
- #svn_remote ⇒ Object readonly
- #username ⇒ Object readonly
Attributes inherited from Base
Instance Method Summary collapse
- #current_contents ⇒ Object
-
#desired_contents ⇒ Array<String>
List all environments that should exist in the basedir for this source.
-
#environments ⇒ Array<R10K::Environment::SVN>
Enumerate the environments associated with this SVN source.
-
#generate_environments ⇒ Array<R10K::Environment::SVN>
Generate a list of currently available SVN environments.
-
#initialize(name, basedir, options = {}) ⇒ SVN
constructor
Initialize the given source.
- #managed_directory ⇒ Object
Methods included from Logging
formatter, included, level, level=, levels, #logger, #logger_name, outputter, parse_level
Methods included from Util::Purgeable
#logger, #pending_contents, #purge!, #stale_contents
Methods inherited from Base
Constructor Details
#initialize(name, basedir, options = {}) ⇒ SVN
Initialize the given source.
54 55 56 57 58 59 60 |
# File 'lib/r10k/source/svn.rb', line 54 def initialize(name, basedir, = {}) super setopts(, {:remote => :self, :username => :self, :password => :self}) @environments = [] @svn_remote = R10K::SVN::Remote.new(@remote, :username => @username, :password => @password) end |
Instance Attribute Details
#password ⇒ Object (readonly)
39 40 41 |
# File 'lib/r10k/source/svn.rb', line 39 def password @password end |
#remote ⇒ Object (readonly)
24 25 26 |
# File 'lib/r10k/source/svn.rb', line 24 def remote @remote end |
#svn_remote ⇒ Object (readonly)
29 30 31 |
# File 'lib/r10k/source/svn.rb', line 29 def svn_remote @svn_remote end |
#username ⇒ Object (readonly)
34 35 36 |
# File 'lib/r10k/source/svn.rb', line 34 def username @username end |
Instance Method Details
#current_contents ⇒ Object
99 100 101 102 103 |
# File 'lib/r10k/source/svn.rb', line 99 def current_contents Dir.glob(File.join(@basedir, '*')).map do |fname| File.basename fname end end |
#desired_contents ⇒ Array<String>
This implements a required method for the Purgeable mixin
List all environments that should exist in the basedir for this source
108 109 110 |
# File 'lib/r10k/source/svn.rb', line 108 def desired_contents @environments.map {|env| env.dirname } end |
#environments ⇒ Array<R10K::Environment::SVN>
Enumerate the environments associated with this SVN source.
66 67 68 69 70 71 72 |
# File 'lib/r10k/source/svn.rb', line 66 def environments if @environments.empty? @environments = generate_environments() end @environments end |
#generate_environments ⇒ Array<R10K::Environment::SVN>
respect environment name corrections
Generate a list of currently available SVN environments
81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/r10k/source/svn.rb', line 81 def generate_environments branch_names.map do |branch| = { :remote => branch.remote, :username => @username, :password => @password } R10K::Environment::SVN.new(branch.name, @basedir, branch.dirname, ) end end |
#managed_directory ⇒ Object
95 96 97 |
# File 'lib/r10k/source/svn.rb', line 95 def managed_directory @basedir end |