Class: Give::Repo
Overview
Give::Repo
The local repository
Instance Attribute Summary collapse
-
#branch ⇒ Object
Returns the value of attribute branch.
-
#upstream_branch ⇒ Object
Returns the value of attribute upstream_branch.
Instance Method Summary collapse
- #checkout_branch ⇒ Object
-
#initialize(opts = {}) ⇒ Repo
constructor
A new instance of Repo.
- #push ⇒ Object
- #update ⇒ Object
Methods included from Commands
Constructor Details
#initialize(opts = {}) ⇒ Repo
Returns a new instance of Repo.
150 151 152 153 |
# File 'lib/give.rb', line 150 def initialize(opts={}) @branch = opts.fetch(:branch, :master) @upstream_branch = opts.fetch(:upstream_branch, :master) end |
Instance Attribute Details
#branch ⇒ Object
Returns the value of attribute branch.
149 150 151 |
# File 'lib/give.rb', line 149 def branch @branch end |
#upstream_branch ⇒ Object
Returns the value of attribute upstream_branch.
149 150 151 |
# File 'lib/give.rb', line 149 def upstream_branch @upstream_branch end |
Instance Method Details
#checkout_branch ⇒ Object
167 168 169 |
# File 'lib/give.rb', line 167 def checkout_branch git("checkout -b #{branch}") end |
#push ⇒ Object
155 156 157 |
# File 'lib/give.rb', line 155 def push git("push origin #{branch}") end |
#update ⇒ Object
159 160 161 162 163 164 165 |
# File 'lib/give.rb', line 159 def update git('fetch upstream') git("checkout #{upstream_branch}") git("pull upstream #{upstream_branch}") git("checkout #{branch}") git("rebase #{upstream_branch}") end |