module Jumpup module Heroku class << self attr_accessor :configuration end def self.configure self.configuration ||= Configuration.new yield(configuration) end class Configuration attr_accessor :app, :staging_app, :production_app, :run_database_tasks def initialize @run_database_tasks ||= true end def valid? boolean_run_database_tasks? && (only_app? || only_production_and_staging_apps?) end private def only_app? app && staging_app.nil? && production_app.nil? end def only_production_and_staging_apps? staging_app && production_app && app.nil? end def boolean_run_database_tasks? run_database_tasks.is_a?(TrueClass) || run_database_tasks.is_a?(FalseClass) end end end end