class DTK::Client::Operation::ClientModuleDir::GitRepo::Internal::Dtkn
Constants
- GIT_REMOTE
TODO: These constants used in
Internal
; DeprecateGIT_REMOTE
amdLOCAL_BRANCH
forremote_name
andlocal_branch
- GIT_REMOTES
- LOCAL_BRANCH
Public Class Methods
new(info_type, repo_dir)
click to toggle source
# File lib/client/operation/client_module_dir/git_repo/internal/dtkn.rb, line 22 def initialize(info_type, repo_dir) @info_type = validate_info_type(info_type) @repo = Internal.create_empty_git_repo?(repo_dir, :branch => local_branch) end
repo_with_remote(info_type, repo_dir, opts = {})
click to toggle source
returns object of type self opts can have keys
:add_remote - if set has the remote url
# File lib/client/operation/client_module_dir/git_repo/internal/dtkn.rb, line 31 def self.repo_with_remote(info_type, repo_dir, opts = {}) remote_url = opts[:add_remote] repo_with_remote = new(info_type, repo_dir) repo_with_remote.add_remote(remote_url) if remote_url repo_with_remote end
Private Class Methods
local_branch()
click to toggle source
# File lib/client/operation/client_module_dir/git_repo/internal/dtkn.rb, line 78 def self.local_branch LOCAL_BRANCH end
Public Instance Methods
add_remote(remote_url)
click to toggle source
# File lib/client/operation/client_module_dir/git_repo/internal/dtkn.rb, line 39 def add_remote(remote_url) Internal.add_remote(@repo, remote_name, remote_url) end
fetch()
click to toggle source
# File lib/client/operation/client_module_dir/git_repo/internal/dtkn.rb, line 43 def fetch Internal.fetch(@repo, remote_name) end
local_ahead?(remote_branch, opts = {})
click to toggle source
# File lib/client/operation/client_module_dir/git_repo/internal/dtkn.rb, line 54 def local_ahead?(remote_branch, opts = {}) merge_from_ref = "#{remote_name}/#{remote_branch}" Internal.local_ahead?(@repo, merge_from_ref, :no_commit => opts[:no_commit]) end
merge_from_remote(remote_branch, opts = {})
click to toggle source
opts can have keys
:no_commit
# File lib/client/operation/client_module_dir/git_repo/internal/dtkn.rb, line 49 def merge_from_remote(remote_branch, opts = {}) merge_from_ref = "#{remote_name}/#{remote_branch}" Internal.merge(@repo, merge_from_ref, :no_commit => opts[:no_commit], :use_theirs => opts[:use_theirs]) end
reset_hard(remote_branch, opts = {})
click to toggle source
# File lib/client/operation/client_module_dir/git_repo/internal/dtkn.rb, line 59 def reset_hard(remote_branch, opts = {}) merge_from_ref = opts[:branch] || "#{remote_name}/#{remote_branch}" Internal.reset_hard(@repo, merge_from_ref) end
Private Instance Methods
local_branch()
click to toggle source
# File lib/client/operation/client_module_dir/git_repo/internal/dtkn.rb, line 81 def local_branch self.class.local_branch end
remote_name()
click to toggle source
# File lib/client/operation/client_module_dir/git_repo/internal/dtkn.rb, line 74 def remote_name GIT_REMOTES[@info_type] end
validate_info_type(info_type)
click to toggle source
# File lib/client/operation/client_module_dir/git_repo/internal/dtkn.rb, line 85 def validate_info_type(info_type) raise Error, "Bad info_type '#{info_type}'" unless GIT_REMOTES.keys.include?(info_type) info_type end