Class: Magica::Command::Git
- Inherits:
-
Magica::Command
- Object
- Magica::Command
- Magica::Command::Git
- Defined in:
- lib/magica/commands/git.rb
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.
6 7 8 9 10 11 12 13 14 |
# File 'lib/magica/commands/git.rb', line 6 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.
4 5 6 |
# File 'lib/magica/commands/git.rb', line 4 def @checkout_options end |
#clone_options ⇒ Object
Returns the value of attribute clone_options.
4 5 6 |
# File 'lib/magica/commands/git.rb', line 4 def @clone_options end |
#flags ⇒ Object
Returns the value of attribute flags.
3 4 5 |
# File 'lib/magica/commands/git.rb', line 3 def flags @flags end |
#pull_options ⇒ Object
Returns the value of attribute pull_options.
4 5 6 |
# File 'lib/magica/commands/git.rb', line 4 def @pull_options end |
Instance Method Details
#checkout(dir, checksum_hash) ⇒ Object
30 31 32 33 34 |
# File 'lib/magica/commands/git.rb', line 30 def checkout(dir, checksum_hash) workin dir do _run @checkout_options % {checksum_hash: checksum_hash, flags: @flags.join(" ")} end end |
#clone(dir, url, _flags = []) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/magica/commands/git.rb', line 16 def clone(dir, url, _flags = []) _run @clone_options % { flags: [@flags, _flags].flatten.join(" "), dir: filename(dir), url: url } end |
#pull(dir, remote = 'origin', branch = 'master') ⇒ Object
24 25 26 27 28 |
# File 'lib/magica/commands/git.rb', line 24 def pull(dir, remote = 'origin', branch = 'master') workin dir do _run @pull_options % {remote: remote, branch: branch, flags: @flags.join(" ")} end end |