Class: BigKeeper::StashService

Inherits:
Object
  • Object
show all
Defined in:
lib/big_keeper/service/stash_service.rb

Overview

Operator for got

Instance Method Summary collapse

Instance Method Details

#pop_stash(path, branch_name, name) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/big_keeper/service/stash_service.rb', line 9

def pop_stash(path, branch_name, name)
  # pop stash
  if BigStash::StashOperator.new(path).stash_for_name(branch_name)
    Logger.highlight(%Q(Branch '#{branch_name}' of '#{name}' has stash , start to pop...))
    BigStash::StashOperator.new(path).pop_stash(branch_name)
  end
end

#stash(path, branch_name, name) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/big_keeper/service/stash_service.rb', line 17

def stash(path, branch_name, name)
  # stash
  if GitOperator.new.has_changes(path)
    Logger.highlight(%Q(Branch '#{branch_name}' of '#{name}' needs stash , start to stash...))
    BigStash::StashOperator.new(path).stash(branch_name)
  end
end

#stash_all(path, new_branch_name, user, modules, version) ⇒ Object



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
50
51
52
53
54
55
56
# File 'lib/big_keeper/service/stash_service.rb', line 25

def stash_all(path, new_branch_name, user, modules,version)
  # Stash modules
  Logger.highlight('Stash for current workspace...')
  p "--------------------9.1.Stash modules----------"
  modules.each do |module_name|
    module_path = BigkeeperParser.module_full_path(path, user, module_name)
    branch_name = GitOperator.new.current_branch(module_path)

    p "------------------------------module_path:#{module_path}"
    p "------------------------------branch_name:#{branch_name}"
    p "------------------------------new_branch_name:#{new_branch_name}"
    if branch_name != new_branch_name
      stash(module_path, branch_name, module_name)
    end
  end
  p "--------------------end Stash modules----------"
  # Stash home
  branch_name = GitOperator.new.current_branch(path)
  p "--------------------9.2.Stash home----------"


  home_branch_name = "release/#{version}"

  p "------------------------------branch_name:#{branch_name}"
  p "------------------------------home_branch_name:#{home_branch_name}"

  if branch_name != home_branch_name
    stash(path, branch_name, 'Home')
  end

  p "--------------------end Stash home----------"
end