Class: Takeoff::Stage::PointCheckpointToDevelopment

Inherits:
Base
  • Object
show all
Defined in:
lib/takeoff/stage/point_checkpoint_to_development.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize

Methods included from Helpers

#branches_up_to_date?, #diff, #execute, #file_has_changed_locally?, #files_have_changed?, #latest_commit, #log

Constructor Details

This class inherits a constructor from Takeoff::Stage::Base

Instance Method Details

#call(env) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/takeoff/stage/point_checkpoint_to_development.rb', line 6

def call(env)
  return @app.call(env) if env[:development_branch] == env[:checkpoint_branch]

  log     "Pointing checkpoint branch to development branch"
  execute "git checkout #{env[:checkpoint_branch]}"

  begin
    execute "git reset --hard #{env[:development_branch]}"
  ensure
    execute "git checkout #{env[:development_branch]}"
  end

  @app.call(env)
end