class Hasta::Configuration

Global configuration settings

Attributes

cache_storage_root[W]
filters[W]
local_storage_root[W]
logger[W]
project_root[RW]
project_steps[W]

Public Instance Methods

cache_storage_root() click to toggle source
# File lib/hasta/configuration.rb, line 23
def cache_storage_root
  @cache_storage_root ||= '~/.hasta'
end
combined_storage() click to toggle source
# File lib/hasta/configuration.rb, line 39
def combined_storage
  @combined_storage ||= CombinedStorage.new(
    S3Storage.new(fog_s3_storage, resolver),
    LocalStorage.new(fog_local_storage, resolver)
  )
end
filters() click to toggle source
# File lib/hasta/configuration.rb, line 46
def filters
  unless @filters || ENV['HASTA_DATA_FILTERING'] == 'OFF'
    filter_file = ENV['HASTA_DATA_FILTER_FILE'] || 'filter_config.yml'
    @filters ||= Filters.from_file(filter_file)
  end

  @filters
end
local_storage_root() click to toggle source
# File lib/hasta/configuration.rb, line 19
def local_storage_root
  @local_storage_root ||= '~/fog'
end
logger() click to toggle source
# File lib/hasta/configuration.rb, line 31
def logger
  @logger ||= Logger.new(STDOUT)
end
project_steps() click to toggle source
# File lib/hasta/configuration.rb, line 27
def project_steps
  @project_steps ||= 'steps'
end
project_steps_dir() click to toggle source
# File lib/hasta/configuration.rb, line 35
def project_steps_dir
  File.join(project_root, project_steps)
end

Private Instance Methods

fog_cache_storage() click to toggle source
# File lib/hasta/configuration.rb, line 66
def fog_cache_storage
  @fog_cache_storage ||= local_fog(cache_storage_root)
end
fog_local_storage() click to toggle source
# File lib/hasta/configuration.rb, line 62
def fog_local_storage
  @fog_local_storage ||= local_fog(local_storage_root)
end
fog_s3_storage() click to toggle source
# File lib/hasta/configuration.rb, line 57
def fog_s3_storage
  # Use FOG_CREDENTIAL env variable to control AWS credentials
  @fog_s3_storage ||= Fog::Storage::AWS.new
end
local_fog(local_root) click to toggle source
# File lib/hasta/configuration.rb, line 70
def local_fog(local_root)
  Fog::Storage.new(
    :provider => 'Local',
    :local_root => local_root,
    :endpoint => 'http://example.com'
  )
end
resolver() click to toggle source
# File lib/hasta/configuration.rb, line 78
def resolver
  if filters
    ResolveCachedS3File.new(
      S3FileCache.new(fog_cache_storage), ResolveFilteredS3File.new(filters)
    )
  else
    Hasta::Storage::ResolveS3File
  end
end