Class: Sneaql::RepoManagers::GitRepoManager
- Inherits:
-
Core::RepoDownloadManager
- Object
- Core::RepoDownloadManager
- Sneaql::RepoManagers::GitRepoManager
- Defined in:
- lib/sneaql_lib/repo_manager.rb
Overview
pulls a branch from a remote git repo
Instance Attribute Summary
Attributes inherited from Core::RepoDownloadManager
Instance Method Summary collapse
-
#checkout_branch(branch) ⇒ Object
Checks out specified branch/commit from local repo.
-
#clone_repo(repo_uri) ⇒ Object
Clones a git repo to the local file system.
-
#manage_repo ⇒ Object
Pulls down the repo and checks out the branch.
Methods inherited from Core::RepoDownloadManager
#drop_and_rebuild_directory, #initialize, #unzip_file
Constructor Details
This class inherits a constructor from Sneaql::Core::RepoDownloadManager
Instance Method Details
#checkout_branch(branch) ⇒ Object
Checks out specified branch/commit from local repo.
44 45 46 47 48 49 |
# File 'lib/sneaql_lib/repo_manager.rb', line 44 def checkout_branch(branch) Dir.chdir(@repo_base_dir) do @logger.info("checking out branch #{branch}") @local_repo.checkout(branch.to_s) end end |
#clone_repo(repo_uri) ⇒ Object
Clones a git repo to the local file system.
35 36 37 38 39 40 |
# File 'lib/sneaql_lib/repo_manager.rb', line 35 def clone_repo(repo_uri) Dir.chdir(@repo_base_dir) do @logger.info("cloning git repo #{repo_uri}") @local_repo = Git.clone(repo_uri, @repo_base_dir) end end |
#manage_repo ⇒ Object
Pulls down the repo and checks out the branch.
27 28 29 30 31 |
# File 'lib/sneaql_lib/repo_manager.rb', line 27 def manage_repo drop_and_rebuild_directory(@repo_base_dir) clone_repo(@params[:repo_url]) checkout_branch(@params[:git_branch]) end |