Sha256: 5ee3491228c41adad503d3d3e18069cf0242e426d4b479b07604217ce1439db9

Contents?: true

Size: 981 Bytes

Versions: 1

Compression:

Stored size: 981 Bytes

Contents

require 'virtus'
require 'fog'
require 'celluloid'

module MultiSync
  class Configuration
    include Virtus

    attribute :verbose, Boolean, default: false
    attribute :force, Boolean, default: false
    attribute :run_on_build, Boolean, default: true
    attribute :delete_abandoned_files, Boolean, default: true
    attribute :upload_missing_files, Boolean, default: true
    attribute :target_pool_size, Integer, default: :celluloid_cores
    attribute :max_sync_attempts, Integer, default: 3
    attribute :credentials, Hash, default: :fog_credentials

    # Initialize a new Configuration object
    #
    # @param options [Hash]
    def initialize(options = {})
      Celluloid.logger = MultiSync.test? ? nil : MultiSync.logger
      options.each_pair do |key, value|
        send("#{key}=", value) if attributes.keys.include?(key)
      end
    end

    def celluloid_cores
      Celluloid.cores
    end

    def fog_credentials
      Fog.credentials
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
multi_sync-0.0.1 lib/multi_sync/configuration.rb