Module: Valkyrie

Defined in:
lib/valkyrie/engine.rb,
lib/valkyrie.rb,
lib/valkyrie/id.rb,
lib/valkyrie/types.rb,
lib/valkyrie/logging.rb,
lib/valkyrie/storage.rb,
lib/valkyrie/version.rb,
lib/valkyrie/resource.rb,
lib/valkyrie/change_set.rb,
lib/valkyrie/persistence.rb,
lib/valkyrie/value_mapper.rb,
lib/valkyrie/storage_adapter.rb,
lib/valkyrie/metadata_adapter.rb,
lib/valkyrie/adapter_container.rb,
lib/valkyrie/specs/shared_specs.rb,
lib/valkyrie/resource/access_controls.rb

Overview

This engine exists for the sole purpose of enabling the

`valkyrie_engine:install:migrations` rake task from an including Rails
application. It technically enables a whole host of other functionality -
don't use it, please.

Defined Under Namespace

Modules: Indexers, Persistence, Specs, Storage, Types, Vocab Classes: AdapterContainer, ChangeSet, Config, Engine, ID, Logging, MetadataAdapter, Resource, ResourceGenerator, StorageAdapter, ValueMapper

Constant Summary collapse

VERSION =
"2.2.0"

Class Method Summary collapse

Class Method Details

.configObject


33
34
35
36
37
# File 'lib/valkyrie.rb', line 33

def config
  @config ||= Config.new(
    config_hash
  )
end

.config_fileObject


39
40
41
42
# File 'lib/valkyrie.rb', line 39

def config_file
  return unless File.exist?(config_root_path.join("config", "valkyrie.yml"))
  File.read(config_root_path.join("config", "valkyrie.yml"))
end

.config_hashObject


44
45
46
47
# File 'lib/valkyrie.rb', line 44

def config_hash
  return {} unless config_file
  YAML.safe_load(ERB.new(config_file).result)[environment]
end

.config_root_pathObject


57
58
59
60
61
62
63
# File 'lib/valkyrie.rb', line 57

def config_root_path
  if const_defined?(:Rails) && Rails.respond_to?(:root)
    Rails.root
  else
    Pathname.new(Dir.pwd)
  end
end

.environmentObject


49
50
51
52
53
54
55
# File 'lib/valkyrie.rb', line 49

def environment
  if const_defined?(:Rails) && Rails.respond_to?(:env)
    Rails.env
  else
    ENV["RAILS_ENV"] || ENV["RACK_ENV"] || "development"
  end
end

.loggerValkyrie::Logging

Returns:


66
67
68
# File 'lib/valkyrie.rb', line 66

def logger
  @logger ||= Valkyrie::Logging.new(logger: Logger.new(STDOUT))
end

.logger=(logger) ⇒ Object

Wraps the given logger in an instance of Valkyrie::Logging

Parameters:

  • logger (Logger)

73
74
75
# File 'lib/valkyrie.rb', line 73

def logger=(logger)
  @logger = Valkyrie::Logging.new(logger: logger)
end