Class: R10K::Module::Git
Instance Attribute Summary collapse
-
#default_ref ⇒ Object
readonly
Returns the value of attribute default_ref.
-
#desired_ref ⇒ Object
readonly
Returns the value of attribute desired_ref.
-
#repo ⇒ Object
readonly
Returns the value of attribute repo.
Attributes inherited from Base
#dirname, #environment, #name, #owner, #path, #title
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(title, dirname, args, environment = nil) ⇒ Git
constructor
A new instance of Git.
- #properties ⇒ Object
- #status ⇒ Object
- #sync(opts = {}) ⇒ Object
- #version ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(title, dirname, args, environment = nil) ⇒ Git
Returns a new instance of Git.
31 32 33 34 35 36 37 |
# File 'lib/r10k/module/git.rb', line 31 def initialize(title, dirname, args, environment=nil) super (@args) @repo = R10K::Git::StatefulRepository.new(@remote, @dirname, @name) end |
Instance Attribute Details
#default_ref ⇒ Object (readonly)
Returns the value of attribute default_ref.
29 30 31 |
# File 'lib/r10k/module/git.rb', line 29 def default_ref @default_ref end |
#desired_ref ⇒ Object (readonly)
Returns the value of attribute desired_ref.
24 25 26 |
# File 'lib/r10k/module/git.rb', line 24 def desired_ref @desired_ref end |
#repo ⇒ Object (readonly)
Returns the value of attribute repo.
19 20 21 |
# File 'lib/r10k/module/git.rb', line 19 def repo @repo end |
Class Method Details
.implement?(name, args) ⇒ Boolean
10 11 12 13 14 |
# File 'lib/r10k/module/git.rb', line 10 def self.implement?(name, args) args.is_a? Hash and args.has_key?(:git) rescue false end |
Instance Method Details
#properties ⇒ Object
43 44 45 46 47 48 49 |
# File 'lib/r10k/module/git.rb', line 43 def properties { :expected => version, :actual => (@repo.head || "(unresolvable)"), :type => :git, } end |
#status ⇒ Object
56 57 58 |
# File 'lib/r10k/module/git.rb', line 56 def status @repo.status(version) end |
#sync(opts = {}) ⇒ Object
51 52 53 54 |
# File 'lib/r10k/module/git.rb', line 51 def sync(opts={}) force = opts && opts.fetch(:force, true) @repo.sync(version, force) end |
#version ⇒ Object
39 40 41 |
# File 'lib/r10k/module/git.rb', line 39 def version validate_ref(@desired_ref, @default_ref) end |