Module: Gity::PushWorkspace

Includes:
TR::CondUtils
Included in:
Landing
Defined in:
lib/gity/push_workspace.rb

Instance Method Summary collapse

Instance Method Details

#push_workspace(ws, opts = {}) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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
# File 'lib/gity/push_workspace.rb', line 8

def push_workspace(ws, opts = {})

  _prmt.puts
  if not ws.has_remote_repos?
    _prmt.puts(_fmt("There is no remote repository defined."))
    add = _prmt.yes?(_fmt("Add new repository? "))

    while(add) 

      return if not add

      name = _prmt.ask("Name of the repository : ", required: true, value: "origin")
      path = _prmt.ask("Path to the repository : ", required: true)

      ws.add_remote(name, path)

      add = _prmt.yes?("Done adding remote? ")

    end

  end


  selRepos = _prmt.select(_fmt("Please select a repository to push : "), filter: true) do |m|
    
    ws.repos.each do |re|
      m.choice "#{re.name} - #{re.url}", re
    end

    m.choice "Abort", :abort

  end

  if selRepos != :abort
    ws.push_changes_with_tags(selRepos.name)
    _prmt.puts _fmt("\nChanges push to remote repository '#{selRepos.name}'.\n Have a good day.\n", :bright_green)
  else
    _prmt.puts _fmt("\nPush aborted\n", :bright_yellow)
  end

end