require 'heroku/command/run'
require 'describer'
require 'bootstrapper'

$LOAD_PATH.unshift File.expand_path(File.join(File.dirname(__FILE__), '../../../vendor/json_pure/lib'))
require 'json/pure'

# invoke commands without fucking "run"
class Heroku::Command::Json < Heroku::Command::Run

  def bootstrap
    Heroku::Helpers.display_header("Bootstrapping using heroku.json")
    json = File.read('heroku.json')
    json = JSON.parse(json)
    bootstrapper = Bootstrapper.new(api, app, json)
    Heroku::Helpers.confirm("This will cost you money by installing #{Heroku::Helpers.quantify('addons', json['addons'].count)}")
    bootstrapper.bootstrap
  end

  alias_command 'bootstrap', 'json:bootstrap'

  def describe
    Heroku::Helpers.display_header("Describing #{app} to heroku.json")
    describer = Describer.new(api, app)
    json = describer.describe
    File.write('heroku.json', JSON.pretty_generate(json))
  end

  alias_command 'describe', 'json:describe'

end


require 'heroku/command/run'
require 'describer'
require 'bootstrapper'

$LOAD_PATH.unshift File.expand_path(File.join(File.dirname(__FILE__), '../../../vendor/json_pure/lib'))
require 'json/pure'

# invoke commands without fucking "run"
class Heroku::Command::Json < Heroku::Command::Run

  def bootstrap
    Heroku::Helpers.display_header("Bootstrapping using heroku.json")
    json = File.read('heroku.json')
    json = JSON.parse(json)
    bootstrapper = Bootstrapper.new(api, app, json)
    Heroku::Helpers.confirm_billing
    bootstrapper.bootstrap
  end

  alias_command 'bootstrap', 'json:bootstrap'

  def describe
    Heroku::Helpers.display_header("Describing #{app} to heroku.json")
    describer = Describer.new(api, app)
    json = describer.describe
    File.write('heroku.json', JSON.pretty_generate(json))
  end

  alias_command 'describe', 'json:describe'

end


Switch to the standard heroku billing message
Switch to the standard heroku billing message
