Class: Util

Inherits:
Object
  • Object
show all
Defined in:
lib/push2heroku/util.rb

Class Method Summary collapse

Class Method Details

.hard_push?(base) ⇒ Boolean

Returns:

  • (Boolean)


3
4
5
6
7
8
9
# File 'lib/push2heroku/util.rb', line 3

def self.hard_push?(base)
  remote_branch_name = "h#{base.branch_name}"

  # do hard push only when expicitly asked
  # base.hard || !remote_branch_exists?(remote_branch_name)
  base.hard
end

.new_install?(base) ⇒ Boolean

Returns:

  • (Boolean)


11
12
13
14
# File 'lib/push2heroku/util.rb', line 11

def self.new_install?(base)
  remote_branch_name = "h#{base.branch_name}"
  !remote_branch_exists?(remote_branch_name)
end

.remote_branch_exists?(remote_branch_name) ⇒ Boolean

Returns:

  • (Boolean)


16
17
18
19
# File 'lib/push2heroku/util.rb', line 16

def self.remote_branch_exists?(remote_branch_name)
 out = `cd #{Rails.root.expand_path} && git branch -r`
 out.include?(remote_branch_name)
end