better way of declaring a hosting env
This commit is contained in:
parent
ffee024a96
commit
8f1ac5968f
@ -93,9 +93,16 @@ module Locomotive
|
||||
end
|
||||
|
||||
def self.enable_hosting
|
||||
if (!Rails.env.test? && !Rails.env.development?) && !self.config.hosting.blank? && self.respond_to?(:"enable_#{self.config.hosting}")
|
||||
self.send(:"enable_#{self.config.hosting}")
|
||||
end
|
||||
return if Rails.env.test? || Rails.env.development? || self.config.hosting.blank?
|
||||
|
||||
target = self.config.hosting[:target]
|
||||
method = :"enable_#{target}"
|
||||
|
||||
self.send(method) if self.respond_to?(method)
|
||||
|
||||
# if (!Rails.env.test? && !Rails.env.development?) && !self.config.hosting.blank? && self.respond_to?(:"enable_#{self.config.hosting}")
|
||||
# self.send(:"enable_#{self.config.hosting}")
|
||||
# end
|
||||
end
|
||||
|
||||
def self.define_subdomain_and_domains_options
|
||||
|
@ -15,7 +15,7 @@ describe Locomotive::Configuration do
|
||||
it 'calls the hosting enabler if provided' do
|
||||
Rails.env.stubs(:test?).returns(false)
|
||||
Locomotive.expects(:enable_bushido).once
|
||||
Locomotive.config.hosting = :bushido
|
||||
Locomotive.config.hosting = { :target => :bushido }
|
||||
Locomotive.enable_hosting
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user