Sha256: 56a6f4381adb0f4ffaddfa8b7c25c9d2ff6191fcc6eeaf5316b86fd97a0924e7

Contents?: true

Size: 967 Bytes

Versions: 14

Compression:

Stored size: 967 Bytes

Contents

module Dandelion
  module Adapter
    class InvalidAdapterError < StandardError; end

    class MissingDependencyError < StandardError
      attr_reader :gems

      def initialize(gems)
        @gems = gems
      end
    end

    class Base
      class << self
        @@adapters = {}

        def adapter(name)
          @@adapters[name] = self
        end

        def create_adapter(name, options = {})
          klass = @@adapters[name]
          raise InvalidAdapterError if klass.nil?
          klass.new(options)
        rescue LoadError
          raise MissingDependencyError.new(klass.required_gems)
        end

        attr_reader :required_gems

        def requires_gems(*gems)
          @required_gems = gems
        end
      end

      def initialize(options)
      end
    end
  end
end

require 'dandelion/adapter/noop'
require 'dandelion/adapter/ftp'
require 'dandelion/adapter/sftp'
require 'dandelion/adapter/ftps'
require 'dandelion/adapter/s3'

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
dandelion-0.6.0 lib/dandelion/adapter.rb
dandelion-0.5.4 lib/dandelion/adapter.rb
dandelion-0.5.3 lib/dandelion/adapter.rb
dandelion-0.5.2 lib/dandelion/adapter.rb
dandelion-0.5.1 lib/dandelion/adapter.rb
dandelion-0.5.0 lib/dandelion/adapter.rb
dandelion-0.4.17 lib/dandelion/adapter.rb
dandelion-0.4.16 lib/dandelion/adapter.rb
dandelion-0.4.15 lib/dandelion/adapter.rb
dandelion-0.4.14 lib/dandelion/adapter.rb
dandelion-0.4.10 lib/dandelion/adapter.rb
dandelion-0.4.9 lib/dandelion/adapter.rb
dandelion-0.4.8 lib/dandelion/adapter.rb
dandelion-0.4.7 lib/dandelion/adapter.rb