Class: Git::Submodule
Constant Summary collapse
- STATUS_MATCH =
/(^.)(\w*?)\s(.*?)\s?(\(.*\))?$/
Instance Attribute Summary collapse
-
#commitish ⇒ Object
Returns the value of attribute commitish.
-
#description ⇒ Object
Returns the value of attribute description.
-
#path ⇒ Object
Returns the value of attribute path.
Instance Method Summary collapse
- #init ⇒ Object
-
#initialize(base, path) ⇒ Submodule
constructor
A new instance of Submodule.
- #initialized? ⇒ Boolean
- #repository ⇒ Object
- #status ⇒ Object
- #to_s ⇒ Object
- #update ⇒ Object
- #updated? ⇒ Boolean
- #uri ⇒ Object
Methods inherited from Path
Constructor Details
#initialize(base, path) ⇒ Submodule
Returns a new instance of Submodule.
8 9 10 11 12 |
# File 'lib/git/submodule.rb', line 8 def initialize(base, path) @path = path @base = base set_with_status(self.status) end |
Instance Attribute Details
#commitish ⇒ Object
Returns the value of attribute commitish.
6 7 8 |
# File 'lib/git/submodule.rb', line 6 def commitish @commitish end |
#description ⇒ Object
Returns the value of attribute description.
6 7 8 |
# File 'lib/git/submodule.rb', line 6 def description @description end |
#path ⇒ Object
Returns the value of attribute path.
6 7 8 |
# File 'lib/git/submodule.rb', line 6 def path @path end |
Instance Method Details
#init ⇒ Object
22 23 24 25 |
# File 'lib/git/submodule.rb', line 22 def init @base.lib.submodule_init(@path) set_with_status(self.status) end |
#initialized? ⇒ Boolean
32 33 34 |
# File 'lib/git/submodule.rb', line 32 def initialized? @state != '-' end |
#repository ⇒ Object
45 46 47 |
# File 'lib/git/submodule.rb', line 45 def repository Git.open(File.join(@base.dir.to_s, self.path)) end |
#status ⇒ Object
18 19 20 |
# File 'lib/git/submodule.rb', line 18 def status @base.lib.submodule_status(@path) end |
#to_s ⇒ Object
14 15 16 |
# File 'lib/git/submodule.rb', line 14 def to_s @path end |
#update ⇒ Object
27 28 29 30 |
# File 'lib/git/submodule.rb', line 27 def update @base.lib.submodule_update(@path) set_with_status(self.status) end |
#updated? ⇒ Boolean
36 37 38 |
# File 'lib/git/submodule.rb', line 36 def updated? @state == ' ' end |
#uri ⇒ Object
40 41 42 43 |
# File 'lib/git/submodule.rb', line 40 def uri self.init unless self.initialized? @base.config("submodule.#{path}.url") end |