Class: DTK::Network::Client::GitClient
- Inherits:
-
Object
- Object
- DTK::Network::Client::GitClient
- Defined in:
- lib/client/git_client.rb
Instance Attribute Summary collapse
-
#repo_dir ⇒ Object
readonly
Returns the value of attribute repo_dir.
Class Method Summary collapse
Instance Method Summary collapse
- #add_all ⇒ Object
- #add_remote(name, url) ⇒ Object
- #all_branches ⇒ Object
- #changed? ⇒ Boolean
-
#checkout(branch, opts = {}) ⇒ Object
opts can have keys :new_branch - Boolean.
- #commit(commit_msg = "", opts = {}) ⇒ Object
- #current_branch ⇒ Object
- #diff ⇒ Object
- #diff_name_status(branch_or_sha_1 = nil, branch_or_sha_2 = nil, opts = {}) ⇒ Object
- #empty_commit(commit_msg = nil) ⇒ Object
- #fetch(remote = 'origin') ⇒ Object
- #head_commit_sha ⇒ Object
-
#initialize(repo_dir, opts = {}) ⇒ GitClient
constructor
opts can have keys :branch.
- #is_there_remote?(remote_name) ⇒ Boolean
- #local_ahead(base_sha, remote_sha) ⇒ Object
- #merge(branch_to_merge_from, opts = {}) ⇒ Object
- #pull(remote, branch) ⇒ Object
- #push(remote, branch, opts = {}) ⇒ Object
- #push_from_cached_branch(remote, branch, opts = {}) ⇒ Object
- #remotes ⇒ Object
- #remove_remote(name) ⇒ Object
- #reset_hard(sha) ⇒ Object
- #reset_soft(sha) ⇒ Object
- #rev_list(base_sha) ⇒ Object
- #revparse(string) ⇒ Object
- #stage_and_commit(commit_msg = nil) ⇒ Object
Constructor Details
#initialize(repo_dir, opts = {}) ⇒ GitClient
opts can have keys
:branch
8 9 10 11 |
# File 'lib/client/git_client.rb', line 8 def initialize(repo_dir, opts = {}) @repo_dir = repo_dir @git_adapter = git_adapter_class.new(repo_dir, opts) end |
Instance Attribute Details
#repo_dir ⇒ Object (readonly)
Returns the value of attribute repo_dir.
13 14 15 |
# File 'lib/client/git_client.rb', line 13 def repo_dir @repo_dir end |
Class Method Details
.clone(repo_url, target_path, branch) ⇒ Object
15 16 17 |
# File 'lib/client/git_client.rb', line 15 def self.clone(repo_url, target_path, branch) git_adapter_class.clone(repo_url, target_path, branch) end |
.is_git_repo?(dir) ⇒ Boolean
19 20 21 |
# File 'lib/client/git_client.rb', line 19 def self.is_git_repo?(dir) File.directory?("#{dir}/.git") end |
Instance Method Details
#add_all ⇒ Object
117 118 119 |
# File 'lib/client/git_client.rb', line 117 def add_all @git_adapter.add_all end |
#add_remote(name, url) ⇒ Object
23 24 25 |
# File 'lib/client/git_client.rb', line 23 def add_remote(name, url) @git_adapter.add_remote(name, url) end |
#all_branches ⇒ Object
121 122 123 |
# File 'lib/client/git_client.rb', line 121 def all_branches @git_adapter.all_branches end |
#changed? ⇒ Boolean
27 28 29 |
# File 'lib/client/git_client.rb', line 27 def changed? @git_adapter.changed? end |
#checkout(branch, opts = {}) ⇒ Object
opts can have keys
:new_branch - Boolean
33 34 35 |
# File 'lib/client/git_client.rb', line 33 def checkout(branch, opts = {}) @git_adapter.checkout(branch, opts) end |
#commit(commit_msg = "", opts = {}) ⇒ Object
93 94 95 |
# File 'lib/client/git_client.rb', line 93 def commit(commit_msg = "", opts = {}) @git_adapter.commit(commit_msg, opts) end |
#current_branch ⇒ Object
37 38 39 |
# File 'lib/client/git_client.rb', line 37 def current_branch @git_adapter.current_branch end |
#diff ⇒ Object
41 42 43 |
# File 'lib/client/git_client.rb', line 41 def diff @git_adapter.diff end |
#diff_name_status(branch_or_sha_1 = nil, branch_or_sha_2 = nil, opts = {}) ⇒ Object
45 46 47 |
# File 'lib/client/git_client.rb', line 45 def diff_name_status(branch_or_sha_1 = nil, branch_or_sha_2 = nil, opts = {}) @git_adapter.diff_name_status(branch_or_sha_1, branch_or_sha_2, opts) end |
#empty_commit(commit_msg = nil) ⇒ Object
89 90 91 |
# File 'lib/client/git_client.rb', line 89 def empty_commit(commit_msg = nil) @git_adapter.empty_commit(commit_msg) end |
#fetch(remote = 'origin') ⇒ Object
49 50 51 |
# File 'lib/client/git_client.rb', line 49 def fetch(remote = 'origin') @git_adapter.fetch(remote) end |
#head_commit_sha ⇒ Object
53 54 55 |
# File 'lib/client/git_client.rb', line 53 def head_commit_sha @git_adapter.head_commit_sha end |
#is_there_remote?(remote_name) ⇒ Boolean
57 58 59 |
# File 'lib/client/git_client.rb', line 57 def is_there_remote?(remote_name) @git_adapter.is_there_remote?(remote_name) end |
#local_ahead(base_sha, remote_sha) ⇒ Object
113 114 115 |
# File 'lib/client/git_client.rb', line 113 def local_ahead(base_sha, remote_sha) @git_adapter.local_ahead(base_sha, remote_sha) end |
#merge(branch_to_merge_from, opts = {}) ⇒ Object
61 62 63 |
# File 'lib/client/git_client.rb', line 61 def merge(branch_to_merge_from, opts = {}) @git_adapter.merge(branch_to_merge_from, opts) end |
#pull(remote, branch) ⇒ Object
73 74 75 |
# File 'lib/client/git_client.rb', line 73 def pull(remote, branch) @git_adapter.pull(remote, branch) end |
#push(remote, branch, opts = {}) ⇒ Object
65 66 67 |
# File 'lib/client/git_client.rb', line 65 def push(remote, branch, opts = {}) @git_adapter.push(remote, branch, opts) end |
#push_from_cached_branch(remote, branch, opts = {}) ⇒ Object
69 70 71 |
# File 'lib/client/git_client.rb', line 69 def push_from_cached_branch(remote, branch, opts = {}) @git_adapter.push_from_cached_branch(remote, branch, opts) end |
#remotes ⇒ Object
77 78 79 |
# File 'lib/client/git_client.rb', line 77 def remotes @git_adapter.remotes end |
#remove_remote(name) ⇒ Object
81 82 83 |
# File 'lib/client/git_client.rb', line 81 def remove_remote(name) @git_adapter.remove_remote(name) end |
#reset_hard(sha) ⇒ Object
101 102 103 |
# File 'lib/client/git_client.rb', line 101 def reset_hard(sha) @git_adapter.reset_hard(sha) end |
#reset_soft(sha) ⇒ Object
97 98 99 |
# File 'lib/client/git_client.rb', line 97 def reset_soft(sha) @git_adapter.reset_soft(sha) end |
#rev_list(base_sha) ⇒ Object
109 110 111 |
# File 'lib/client/git_client.rb', line 109 def rev_list(base_sha) @git_adapter.rev_list(base_sha) end |
#revparse(string) ⇒ Object
105 106 107 |
# File 'lib/client/git_client.rb', line 105 def revparse(string) @git_adapter.revparse(string) end |
#stage_and_commit(commit_msg = nil) ⇒ Object
85 86 87 |
# File 'lib/client/git_client.rb', line 85 def stage_and_commit(commit_msg = nil) @git_adapter.stage_and_commit(commit_msg) end |