Sha256: f8d76f49a61cfaa2ecc74d473036e9ba5b34cc976f7d5367efc0e9e7e1790eb5

Contents?: true

Size: 1.16 KB

Versions: 6

Compression:

Stored size: 1.16 KB

Contents

require "putter/configuration"
require "putter/errors"
require "putter/follower_data"
require "putter/instance_follower"
require "putter/method_creator"
require "putter/method_proxy"
require "putter/print_strategy"
require "putter/proxy_method_data"
require "putter/version"
require "putter/watcher_data"

require "putter/follower"
require "putter/watcher"

module Putter
  include Errors

  class << self
    attr_writer :configuration

    def follow(obj, options={})
      with_production_check do
        Putter::Follower.new(obj, options)
      end
    end

    def watch(obj, options={})
      with_production_check do
        Putter::Watcher.watch(obj, options)
      end
    end

    def configuration
      @configuration ||= Configuration.new
    end

    def configure
      yield configuration
    end

    def reset_configuration
      @configuration = Configuration.new
    end

    def with_production_check
      if !configuration.allow_production && defined?(Rails) && Rails.env == "production"
        puts "Putter cannot be run in production unless the 'allow_production' option is configured to true".colorize(:red)
      else
        yield
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
putter-0.7.0 lib/putter.rb
putter-0.6.1 lib/putter.rb
putter-0.6.0 lib/putter.rb
putter-0.5.1 lib/putter.rb
putter-0.5.0 lib/putter.rb
putter-0.4.1 lib/putter.rb