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
# File 'lib/push2heroku/util.rb', line 3

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

.remote_branch_exists?(remote_branch_name) ⇒ Boolean

Returns:

  • (Boolean)


8
9
10
11
# File 'lib/push2heroku/util.rb', line 8

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