lib/valkyrie.rb in valkyrie-1.5.1 vs lib/valkyrie.rb in valkyrie-1.6.0
- old
+ new
@@ -12,11 +12,10 @@
require 'rdf'
require 'valkyrie/rdf_patches'
require 'json/ld'
require 'logger'
require 'rdf/vocab'
-require 'rails'
module Valkyrie
require 'valkyrie/id'
require 'valkyrie/change_set'
require 'valkyrie/value_mapper'
@@ -47,14 +46,18 @@
return {} unless config_file
YAML.safe_load(ERB.new(config_file).result)[environment]
end
def environment
- Rails.env
+ if const_defined?(:Rails) && Rails.respond_to?(:env)
+ Rails.env
+ else
+ ENV["RAILS_ENV"] || ENV["RACK_ENV"] || "development"
+ end
end
def config_root_path
- if const_defined?(:Rails) && Rails.root
+ if const_defined?(:Rails) && Rails.respond_to?(:root)
Rails.root
else
Pathname.new(Dir.pwd)
end
end