Class: Magica::Command::Git
- Inherits:
-
Magica::Command
- Object
- Magica::Command
- Magica::Command::Git
- Defined in:
- lib/magica/commands/git.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#checkout_options ⇒ Object
Returns the value of attribute checkout_options.
-
#clone_options ⇒ Object
Returns the value of attribute clone_options.
-
#flags ⇒ Object
Returns the value of attribute flags.
-
#pull_options ⇒ Object
Returns the value of attribute pull_options.
Attributes inherited from Magica::Command
Instance Method Summary collapse
- #checkout(dir, checksum_hash) ⇒ Object
- #clone(dir, url, flags = []) ⇒ Object
-
#initialize(build) ⇒ Git
constructor
A new instance of Git.
- #pull(dir, remote = 'origin', branch = 'master') ⇒ Object
Constructor Details
#initialize(build) ⇒ Git
Returns a new instance of Git.
9 10 11 12 13 14 15 16 17 |
# File 'lib/magica/commands/git.rb', line 9 def initialize(build) super @command = 'git' @flags = %w[] @clone_options = 'clone %{flags} %{url} %{dir}' @pull_options = 'pull %{flags} %{remote} %{branch}' @checkout_options = 'checkout %{flags} %{checksum_hash}' end |
Instance Attribute Details
#checkout_options ⇒ Object
Returns the value of attribute checkout_options.
7 8 9 |
# File 'lib/magica/commands/git.rb', line 7 def @checkout_options end |
#clone_options ⇒ Object
Returns the value of attribute clone_options.
7 8 9 |
# File 'lib/magica/commands/git.rb', line 7 def @clone_options end |
#flags ⇒ Object
Returns the value of attribute flags.
6 7 8 |
# File 'lib/magica/commands/git.rb', line 6 def flags @flags end |
#pull_options ⇒ Object
Returns the value of attribute pull_options.
7 8 9 |
# File 'lib/magica/commands/git.rb', line 7 def @pull_options end |
Instance Method Details
#checkout(dir, checksum_hash) ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/magica/commands/git.rb', line 35 def checkout(dir, checksum_hash) workin dir do _run format(@checkout_options, checksum_hash: checksum_hash, flags: @flags.join(' ')) end end |
#clone(dir, url, flags = []) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/magica/commands/git.rb', line 19 def clone(dir, url, flags = []) _run format(@clone_options, flags: [@flags, flags].flatten.join(' '), dir: filename(dir), url: url) end |
#pull(dir, remote = 'origin', branch = 'master') ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'lib/magica/commands/git.rb', line 26 def pull(dir, remote = 'origin', branch = 'master') workin dir do _run format(@pull_options, remote: remote, branch: branch, flags: @flags.join(' ')) end end |