module MorpheusHeroku::Helper

Public Instance Methods

bash_run(command: "") click to toggle source
# File lib/morpheus-heroku/helper.rb, line 12
def bash_run(command: "")
  generic_run(command)
end
heroku_run(command: "") click to toggle source
# File lib/morpheus-heroku/helper.rb, line 5
def heroku_run(command: "")
  if MorpheusHeroku.configuration.app_name.present?
    command += " --app #{MorpheusHeroku.configuration.app_name}"
  end
  generic_run(command)
end
logger(message = "") click to toggle source
# File lib/morpheus-heroku/helper.rb, line 16
def logger(message = "")
  if MorpheusHeroku.configuration.log_events
    puts "<MORPHEUS>".text_red
    puts "Running: #{message}".text_green
    puts "RAILS_ENV: #{Rails.env}".text_green
    puts "APP_NAME: #{MorpheusHeroku.configuration.app_name}".text_green
    puts "</MORPHEUS>".text_red
  end
end

Private Instance Methods

generic_run(command) click to toggle source
# File lib/morpheus-heroku/helper.rb, line 28
def generic_run(command)
  Helper.logger(command)
  if Bundler.respond_to?(:with_unbundled_env)
    Bundler.with_unbundled_env do
      system(command) || abort("\n== Command #{command} failed ==")
    end
  else
    Bundler.with_clean_env do
      system(command) || abort("\n== Command #{command} failed ==")
    end
  end
end