Class: Vendorise::Arborist
- Inherits:
-
Object
- Object
- Vendorise::Arborist
- Defined in:
- lib/vendorise/arborist.rb
Instance Attribute Summary collapse
-
#branch ⇒ Object
readonly
Returns the value of attribute branch.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(path, url, branch) ⇒ Arborist
constructor
A new instance of Arborist.
- #subtree_already_exists? ⇒ Boolean
- #subtree_command ⇒ Object
Constructor Details
#initialize(path, url, branch) ⇒ Arborist
Returns a new instance of Arborist.
5 6 7 8 9 |
# File 'lib/vendorise/arborist.rb', line 5 def initialize(path, url, branch) @path = path @url = url @branch = branch end |
Instance Attribute Details
#branch ⇒ Object (readonly)
Returns the value of attribute branch.
3 4 5 |
# File 'lib/vendorise/arborist.rb', line 3 def branch @branch end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
3 4 5 |
# File 'lib/vendorise/arborist.rb', line 3 def path @path end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
3 4 5 |
# File 'lib/vendorise/arborist.rb', line 3 def url @url end |
Instance Method Details
#subtree_already_exists? ⇒ Boolean
11 12 13 |
# File 'lib/vendorise/arborist.rb', line 11 def subtree_already_exists? Dir.exist?(path) end |
#subtree_command ⇒ Object
15 16 17 18 |
# File 'lib/vendorise/arborist.rb', line 15 def subtree_command cmd = subtree_already_exists? ? "pull" : "add" "git subtree #{cmd} --prefix #{path} #{url} #{branch} --squash" end |