class Paratrooper::PendingMigrationCheck

Attributes

deployment_sha[RW]
diff[RW]
heroku[RW]
system_caller[RW]

Public Class Methods

new(deployment_sha, heroku_wrapper, system_caller) click to toggle source
# File lib/paratrooper/pending_migration_check.rb, line 7
def initialize(deployment_sha, heroku_wrapper, system_caller)
  self.heroku         = heroku_wrapper
  self.deployment_sha = deployment_sha
  self.system_caller  = system_caller
end

Public Instance Methods

last_deployed_commit() click to toggle source
# File lib/paratrooper/pending_migration_check.rb, line 18
def last_deployed_commit
  @last_deploy_commit ||= heroku.last_deploy_commit
end
migrations_waiting?() click to toggle source
# File lib/paratrooper/pending_migration_check.rb, line 13
def migrations_waiting?
  defined?(@migrations_waiting) or @migrations_waiting = check_for_pending_migrations
  @migrations_waiting
end

Private Instance Methods

check_for_pending_migrations() click to toggle source
# File lib/paratrooper/pending_migration_check.rb, line 24
def check_for_pending_migrations
  cmd = %Q[git diff --shortstat #{last_deployed_commit} #{deployment_sha} -- db/migrate]
  self.diff = system_caller.execute(cmd)
  !diff.strip.empty?
end