module RemoteFiles

This is good for use in development

This is good for use in tests. Be sure to call clear! before each test run.

Constants

CONFIGURATIONS
MockStore
VERSION

Public Class Methods

add_store(store_identifier, options = {}, &block) click to toggle source
# File lib/remote_files.rb, line 43
def self.add_store(store_identifier, options = {}, &block)
  default_configuration.add_store(store_identifier, options, &block)
end
configure(name, hash = {}) click to toggle source
# File lib/remote_files.rb, line 24
def self.configure(name, hash = {})
  if name.is_a?(Hash)
    hash = name
    name = :default
  end

  CONFIGURATIONS[name.to_sym].from_hash(hash)
end
default_configuration() click to toggle source
# File lib/remote_files.rb, line 20
def self.default_configuration
  CONFIGURATIONS[:default]
end
delete_file(file = nil, &block) click to toggle source
# File lib/remote_files.rb, line 73
def self.delete_file(file = nil, &block)
  if file
    if @delete_file
      @delete_file.call(file)
    else
      file.delete_now!
    end
  elsif block_given?
    @delete_file = block
  else
    raise "invalid call to RemoteFiles.delete_file"
  end
end
logger() click to toggle source
# File lib/remote_files.rb, line 37
def self.logger
  return @logger if defined?(@logger)

  @logger ||= defined?(Rails) ? Rails.logger : nil
end
logger=(logger) click to toggle source
# File lib/remote_files.rb, line 33
def self.logger=(logger)
  @logger = logger
end
lookup_store(store_identifier) click to toggle source
# File lib/remote_files.rb, line 51
def self.lookup_store(store_identifier)
  default_configuration.lookup_store(store_identifier)
end
primary_store() click to toggle source
# File lib/remote_files.rb, line 55
def self.primary_store
  default_configuration.primary_store
end
stores() click to toggle source
# File lib/remote_files.rb, line 47
def self.stores
  default_configuration.stores
end
synchronize_stores(file = nil, &block) click to toggle source
# File lib/remote_files.rb, line 59
def self.synchronize_stores(file = nil, &block)
  if file
    if @synchronize_stores
      @synchronize_stores.call(file)
    else
      file.synchronize!
    end
  elsif block_given?
    @synchronize_stores = block
  else
    raise "invalid call to RemoteFiles.synchronize_stores"
  end
end