Class: Takeoff::Stage::Heroku::DisablePreboot
- Defined in:
- lib/takeoff/stage/heroku/disable_preboot.rb
Instance Method Summary collapse
Methods inherited from Base
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
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/takeoff/stage/heroku/disable_preboot.rb', line 15 def call(env) unless env[:dangerous] log "Skipping disabling preboot because nothing dangerous is going on" return @app.call(env) end return @app.call(env) unless run?(env) log "Disabling preboot" execute "heroku features:disable preboot --remote #{env[:server_remote]}" begin @app.call(env) ensure log "Enabling preboot" execute "heroku features:enable preboot --remote #{env[:server_remote]}" end end |
#run?(env) ⇒ Boolean
7 8 9 10 11 12 13 |
# File 'lib/takeoff/stage/heroku/disable_preboot.rb', line 7 def run?(env) features = `heroku features --remote #{env[:server_remote]}` preboot_line = features.split("\n").find { |feature| feature =~ /\A\[[+ ]\] preboot/ } preboot_enabled = preboot_line.start_with?("[+]") preboot_enabled end |