Sha256: b1e8d5a249bd05e86191f1c533b2d27d8e009ed279bb25d1cf10b05a83666e16

Contents?: true

Size: 861 Bytes

Versions: 1

Compression:

Stored size: 861 Bytes

Contents

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jumpup-heroku-0.0.1 lib/jumpup/heroku/configuration.rb