Module: GitCli::Push

Includes:
Branch
Included in:
Workspace
Defined in:
lib/git_cli/push.rb

Instance Method Summary collapse

Methods included from Branch

#all_branches, #create_branch, #current_branch, #delete_branch, #download_all_remote_branches_name, #local_branches, #merge_branch, #remote_branches, #switch_branch

Instance Method Details

#push_changes(repos, branch = nil) ⇒ Object Also known as: push



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/git_cli/push.rb', line 24

def push_changes(repos, branch = nil)
  check_vcs
  #check_repos
  raise_if_empty(repos, "Push to repository name cannot be empty", GitCliException)

  raise_if_false(is_repos_exist?(repos), "Given repository name '#{repos}' is not configured for this workspace", GitCliException)
  
  cmd = []
  cmd << "cd"
  cmd << @wsPath
  cmd << "&&"
  cmd << @vcs.exe_path
  cmd << "push"
  cmd << repos
  if is_empty?(branch) 
    branch = current_branch
  end
  cmd << branch

  cmdln = cmd.join " "

  log_debug "Push : #{cmdln}"
  os_exec(cmdln) do |st, res|
    [st.success?, res.strip]
  end
end

#push_changes_with_tags(repos, branch = nil) ⇒ Object Also known as: push_with_tags, push_with_tag, push_changes_with_tag



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/git_cli/push.rb', line 52

def push_changes_with_tags(repos, branch = nil)
  check_vcs
  #check_repos
  raise_if_empty(repos, "Push to repository name cannot be empty", GitCliException)
  
  raise_if_false(is_repos_exist?(repos), "Given repository name '#{repos}' is not configured for this workspace", GitCliException)
  
  cmd = []
  cmd << "cd"
  cmd << @wsPath
  cmd << "&&"
  cmd << @vcs.exe_path
  cmd << "push"
  cmd << repos
  if is_empty?(branch) 
    branch = current_branch
  end
  cmd << branch
  cmd << "--tags"

  cmdln = cmd.join " "

  log_debug "Push with tags : #{cmdln}"
  os_exec(cmdln) do |st, res|
    [st.success?, res.strip]
  end
end