lib/jumpup/heroku/configuration.rb in jumpup-heroku-0.0.1 vs lib/jumpup/heroku/configuration.rb in jumpup-heroku-0.0.2

- old
+ new

@@ -10,20 +10,32 @@ yield(configuration) end class Configuration - attr_accessor :app, :staging_app, :production_app, :run_database_tasks + attr_accessor :app, :staging_app, :production_app, :run_database_tasks, :host def initialize @run_database_tasks ||= true + @host ||= 'heroku.com' end + def account(account_token) + if account_token == current_account + self.host = "heroku.#{account_token}" + yield(self) + end + end + def valid? boolean_run_database_tasks? && (only_app? || only_production_and_staging_apps?) end private + + def current_account + (ENV["HEROKU_ACCOUNT"] || %x{ git config heroku.account }.chomp).to_sym + end def only_app? app && staging_app.nil? && production_app.nil? end