Class: Toolshed::Git::Base
- Inherits:
-
Object
- Object
- Toolshed::Git::Base
- Extended by:
- Toolshed::Git
- Defined in:
- lib/toolshed/git/git.rb
Direct Known Subclasses
Constant Summary
Constants included from Toolshed::Git
DEFAULT_BRANCH_FROM, DEFAULT_GIT_TOOL
Instance Attribute Summary collapse
-
#from_remote_branch_name ⇒ Object
Returns the value of attribute from_remote_branch_name.
-
#from_remote_name ⇒ Object
Returns the value of attribute from_remote_name.
-
#to_remote_branch_name ⇒ Object
Returns the value of attribute to_remote_branch_name.
-
#to_remote_name ⇒ Object
Returns the value of attribute to_remote_name.
-
#validator ⇒ Object
Returns the value of attribute validator.
Instance Method Summary collapse
- #create_branch ⇒ Object
-
#initialize(options = {}) ⇒ Base
constructor
A new instance of Base.
Methods included from Toolshed::Git
branch_name, branch_name_from_id, branched_from, checkout, clean_branch_name, delete, git_submodule_command, push
Constructor Details
#initialize(options = {}) ⇒ Base
Returns a new instance of Base.
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/toolshed/git/git.rb', line 79 def initialize(={}) # options with defaults self.from_remote_name = Toolshed::Client.pull_from_remote_name unless ([:from_remote_name].nil?) self.from_remote_name = [:from_remote_name] end self.to_remote_name = Toolshed::Client.push_to_remote_name unless ([:to_remote_name].nil?) self.to_remote_name = [:to_remote_name] end # options that do not have a default unless ([:from_remote_branch_name].nil?) self.from_remote_branch_name = [:from_remote_branch_name] end unless ([:to_remote_branch_name].nil?) self.to_remote_branch_name = [:to_remote_branch_name] end self.validator = ::Toolshed::Git::GitValidator.new end |
Instance Attribute Details
#from_remote_branch_name ⇒ Object
Returns the value of attribute from_remote_branch_name.
77 78 79 |
# File 'lib/toolshed/git/git.rb', line 77 def from_remote_branch_name @from_remote_branch_name end |
#from_remote_name ⇒ Object
Returns the value of attribute from_remote_name.
77 78 79 |
# File 'lib/toolshed/git/git.rb', line 77 def from_remote_name @from_remote_name end |
#to_remote_branch_name ⇒ Object
Returns the value of attribute to_remote_branch_name.
77 78 79 |
# File 'lib/toolshed/git/git.rb', line 77 def to_remote_branch_name @to_remote_branch_name end |
#to_remote_name ⇒ Object
Returns the value of attribute to_remote_name.
77 78 79 |
# File 'lib/toolshed/git/git.rb', line 77 def to_remote_name @to_remote_name end |
#validator ⇒ Object
Returns the value of attribute validator.
77 78 79 |
# File 'lib/toolshed/git/git.rb', line 77 def validator @validator end |
Instance Method Details
#create_branch ⇒ Object
103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/toolshed/git/git.rb', line 103 def create_branch self.validator.validate!(self) new_branch_name = Toolshed::Git::Base.clean_branch_name(self.to_remote_branch_name) Toolshed::Base.wait_for_command("git remote update #{Toolshed::Client.git_quiet}") Toolshed::Base.wait_for_command("git checkout -b #{new_branch_name} #{self.from_remote_name}/#{self.from_remote_branch_name} #{Toolshed::Client.git_quiet}") unless (Toolshed::Git::Base.git_submodule_command.empty?) Toolshed::Base.wait_for_command(Toolshed::Git::Base.git_submodule_command) end Toolshed::Base.wait_for_command("git push #{self.to_remote_name} #{new_branch_name} #{Toolshed::Client.git_quiet}") end |