Sha256: 594db72eb1178c3aafe7edf02a9d511376c67d5530fda0cd47a31a3007ed85d4

Contents?: true

Size: 1.41 KB

Versions: 8

Compression:

Stored size: 1.41 KB

Contents

require 'rails'
require 'browse_everything/version'
require 'browse_everything/engine'
require 'browse_everything/retriever'

module BrowseEverything
  class InitializationError < RuntimeError; end

  autoload :Browser,   'browse_everything/browser'
  autoload :FileEntry, 'browse_everything/file_entry'
  module Driver
    autoload :Base,        'browse_everything/driver/base'
    autoload :FileSystem,  'browse_everything/driver/file_system'
    autoload :Dropbox,     'browse_everything/driver/dropbox'
    autoload :SkyDrive,    'browse_everything/driver/sky_drive'
    autoload :Box,         'browse_everything/driver/box'
    autoload :GoogleDrive, 'browse_everything/driver/google_drive'
    autoload :S3,          'browse_everything/driver/s3'
  end

  class << self
    def configure(value)
      if value.nil? || value.is_a?(Hash)
        @config = value
      elsif value.is_a?(String)
        @config = YAML.load(ERB.new(File.read(value)).result)

        if @config.include? 'drop_box'
          warn '[DEPRECATION] `drop_box` is deprecated.  Please use `dropbox` instead.'
          @config['dropbox'] = @config.delete('drop_box')
        end

      else
        raise InitializationError, "Unrecognized configuration: #{value.inspect}"
      end
    end

    def config
      if @config.nil?
        configure(File.join(Rails.root.to_s, 'config', 'browse_everything_providers.yml'))
      end
      @config
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
browse-everything-0.14.2 lib/browse_everything.rb
browse-everything-0.14.1 lib/browse_everything.rb
browse-everything-0.14.0 lib/browse_everything.rb
browse-everything-0.13.1 lib/browse_everything.rb
browse-everything-0.13.0 lib/browse_everything.rb
browse-everything-0.12.0 lib/browse_everything.rb
browse-everything-0.11.1 lib/browse_everything.rb
browse-everything-0.11.0 lib/browse_everything.rb