class Takeoff::Stage::Heroku::VerifyStagingUpToDate

Public Instance Methods

call(env) click to toggle source
# File lib/takeoff/stage/heroku/verify_staging_up_to_date.rb, line 7
def call(env)
  unless Takeoff.plan?("staging")
    log "WARNING: Skipping verification that the staging server is up to date because a launch plan for the staging environment has not been set up"
    
    return @app.call(env)
  end

  staging_takeoff = Takeoff[:staging]

  log     "Fetching from staging server"
  execute "git fetch #{staging_takeoff.env[:server_remote]}"

  unless branches_up_to_date?("#{staging_takeoff.env[:server_remote]}/master", env[:development_branch])
    raise "The staging server is not up to date with branch '#{env[:development_branch]}'. Deploy to staging first."
  end

  @app.call(env)
end