Class: Chamber::Commands::ContextResolver
- Inherits:
-
Object
- Object
- Chamber::Commands::ContextResolver
- Defined in:
- lib/chamber/commands/context_resolver.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ ContextResolver
constructor
A new instance of ContextResolver.
- #resolve ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ ContextResolver
Returns a new instance of ContextResolver.
5 6 7 |
# File 'lib/chamber/commands/context_resolver.rb', line 5 def initialize( = {}) self. = .dup end |
Class Method Details
.resolve(options = {}) ⇒ Object
34 35 36 |
# File 'lib/chamber/commands/context_resolver.rb', line 34 def self.resolve( = {}) self.new().resolve end |
Instance Method Details
#resolve ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/chamber/commands/context_resolver.rb', line 9 def resolve [:rootpath] ||= Pathname.pwd [:rootpath] = Pathname.new([:rootpath]) [:encryption_key] = resolve_encryption_key([:encryption_key]) [:decryption_key] = resolve_decryption_key([:decryption_key]) [:namespaces] ||= [] [:preset] ||= resolve_preset if [:preset] == 'rails' [:basepath] ||= [:rootpath] + 'config' if [:namespaces] == [] require [:rootpath].join('config', 'application') [:namespaces] = [::Rails.env] end else [:basepath] ||= [:rootpath] end rescue LoadError end |