Module: Capistrano::Magento2::Pending

Defined in:
lib/capistrano/magento2/pending.rb

Instance Method Summary collapse

Instance Method Details

#ensure_revision(inform_user = false) ⇒ Object



16
17
18
19
20
21
22
23
24
# File 'lib/capistrano/magento2/pending.rb', line 16

def ensure_revision inform_user = false
  if test "[ -f #{current_path}/REVISION ]"
    yield
  else
    warn "\e[0;31mSkipping pending changes check on #{host} (no REVISION file found)\e[0m" if inform_user
    return false
  end
  return true
end

#from_revObject



26
27
28
29
30
31
32
33
34
# File 'lib/capistrano/magento2/pending.rb', line 26

def from_rev
  within current_path do
    current_revision = capture(:cat, "REVISION")

    run_locally do
      return capture(:git, "name-rev --always --name-only #{current_revision}") # find symbolic name for ref
    end
  end
end

#to_revObject



36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/capistrano/magento2/pending.rb', line 36

def to_rev
  run_locally do
    to = fetch(:branch)

    # get target branch upstream if there is one
    if test(:git, "rev-parse --abbrev-ref --symbolic-full-name #{to}@{u}")
      to = capture(:git, "rev-parse --abbrev-ref --symbolic-full-name #{to}@{u}")
    end

    # find symbolic name for revision
    to = capture(:git, "name-rev --always --name-only #{to}")
  end
end