Class: R10K::Environment::SVN
- Includes:
- Logging, Util::Setopts
- Defined in:
- lib/r10k/environment/svn.rb
Overview
This class implements an environment based on an SVN branch.
Constant Summary
Constants included from Logging
Instance Attribute Summary collapse
- #password ⇒ Object readonly
- #remote ⇒ Object readonly
- #username ⇒ Object readonly
- #working_dir ⇒ Object readonly
Attributes inherited from Base
#basedir, #dirname, #name, #path, #puppetfile, #puppetfile_name
Instance Method Summary collapse
-
#initialize(name, basedir, dirname, options = {}) ⇒ SVN
constructor
Initialize the given SVN environment.
-
#signature ⇒ String
Return a sting which uniquely identifies (per source) the current state of the environment.
- #status ⇒ Object
-
#sync ⇒ void
Perform an initial checkout of the SVN repository or update the repository.
Methods included from Logging
debug_formatter, default_formatter, default_outputter, #logger, #logger_name, parse_level
Methods inherited from Base
#accept, #generate_types!, #info, #modules, #purge_exclusions, #whitelist
Constructor Details
#initialize(name, basedir, dirname, options = {}) ⇒ SVN
Initialize the given SVN environment.
45 46 47 48 49 50 51 |
# File 'lib/r10k/environment/svn.rb', line 45 def initialize(name, basedir, dirname, = {}) super setopts(, {:remote => :self, :username => :self, :password => :self, :puppetfile_name => :self }) @working_dir = R10K::SVN::WorkingDir.new(Pathname.new(@full_path), :username => @username, :password => @password) end |
Instance Attribute Details
#password ⇒ Object (readonly)
31 32 33 |
# File 'lib/r10k/environment/svn.rb', line 31 def password @password end |
#remote ⇒ Object (readonly)
16 17 18 |
# File 'lib/r10k/environment/svn.rb', line 16 def remote @remote end |
#username ⇒ Object (readonly)
26 27 28 |
# File 'lib/r10k/environment/svn.rb', line 26 def username @username end |
#working_dir ⇒ Object (readonly)
21 22 23 |
# File 'lib/r10k/environment/svn.rb', line 21 def working_dir @working_dir end |
Instance Method Details
#signature ⇒ String
Return a sting which uniquely identifies (per source) the current state of the environment.
74 75 76 |
# File 'lib/r10k/environment/svn.rb', line 74 def signature @working_dir.revision end |
#status ⇒ Object
78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/r10k/environment/svn.rb', line 78 def status if !@path.exist? :absent elsif !@working_dir.is_svn? :mismatched elsif !(@remote == @working_dir.url) :mismatched elsif !@synced :outdated else :insync end end |
#sync ⇒ void
This method returns an undefined value.
Perform an initial checkout of the SVN repository or update the repository.
If the environment is being created for the first time, it will automatically update all modules to ensure that the environment is complete.
60 61 62 63 64 65 66 67 |
# File 'lib/r10k/environment/svn.rb', line 60 def sync if @working_dir.is_svn? @working_dir.update else @working_dir.checkout(@remote) end @synced = true end |