Module: GitCommands
- Included in:
- GitDownloadStrategy, GitUpdateStrategy, Package
- Defined in:
- lib/lace/download_strategy.rb
Instance Method Summary collapse
- #clone_args ⇒ Object
- #clone_repo ⇒ Object
- #git_dir ⇒ Object
- #repo_valid? ⇒ Boolean
- #reset ⇒ Object
- #submodules? ⇒ Boolean
- #update_repo ⇒ Object
- #update_submodules ⇒ Object
Instance Method Details
#clone_args ⇒ Object
82 83 84 85 |
# File 'lib/lace/download_strategy.rb', line 82 def clone_args args = %w{clone} args << @uri << @target_folder end |
#clone_repo ⇒ Object
87 88 89 90 |
# File 'lib/lace/download_strategy.rb', line 87 def clone_repo safe_system 'git', *clone_args @target_folder.cd { update_submodules } if submodules? end |
#git_dir ⇒ Object
70 71 72 |
# File 'lib/lace/download_strategy.rb', line 70 def git_dir @target_folder.join(".git") end |
#repo_valid? ⇒ Boolean
74 75 76 |
# File 'lib/lace/download_strategy.rb', line 74 def repo_valid? quiet_system "git", "--git-dir", git_dir, "status", "-s" end |
#reset ⇒ Object
66 67 68 |
# File 'lib/lace/download_strategy.rb', line 66 def reset safe_system 'git', "reset" , "--hard", "origin/HEAD" end |
#submodules? ⇒ Boolean
78 79 80 |
# File 'lib/lace/download_strategy.rb', line 78 def submodules? @target_folder.join(".gitmodules").exist? end |
#update_repo ⇒ Object
62 63 64 |
# File 'lib/lace/download_strategy.rb', line 62 def update_repo safe_system 'git', 'fetch', 'origin' end |
#update_submodules ⇒ Object
92 93 94 |
# File 'lib/lace/download_strategy.rb', line 92 def update_submodules safe_system 'git', 'submodule', 'update', '--init' end |