Update to the new version of bushido gem
This commit is contained in:
parent
d2e7c7ef9e
commit
fc53a5acf4
@ -25,7 +25,7 @@ require 'locomotive/session_store'
|
||||
module Locomotive
|
||||
|
||||
include Locomotive::Heroku
|
||||
include Locomotive::Bushido
|
||||
include Locomotive::BushidoSupport
|
||||
|
||||
class << self
|
||||
attr_accessor :config
|
||||
|
@ -2,13 +2,16 @@ require 'bushido'
|
||||
require 'locomotive/bushido/custom_domain'
|
||||
|
||||
module Locomotive
|
||||
module Bushido
|
||||
module BushidoSupport
|
||||
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
class << self
|
||||
attr_accessor :bushido_domains
|
||||
class << self
|
||||
attr_accessor :bushido_domains
|
||||
attr_accessor :bushido_subdomain
|
||||
|
||||
puts @bushido_domains
|
||||
end
|
||||
end
|
||||
|
||||
@ -18,29 +21,49 @@ module Locomotive
|
||||
ENV["HOSTING_PLATFORM"] == "bushido"
|
||||
end
|
||||
|
||||
|
||||
def enable_bushido
|
||||
self.enhance_site_model
|
||||
|
||||
self.bushido_domains = Bushido::App.domains
|
||||
self.bushido_subdomain = Bushido::App.subdomain
|
||||
end
|
||||
|
||||
|
||||
def enhance_site_model
|
||||
Site.send :include, Locomotive::Bushido::CustomDomain
|
||||
Site.send :include, Locomotive::BushidoSupport::CustomDomain
|
||||
end
|
||||
|
||||
# manage domains
|
||||
|
||||
def add_bushido_domain(name)
|
||||
Locomotive.logger "[add bushido domain] #{name}"
|
||||
Bushido::Domains.add_subdomain(name)
|
||||
self.bushido_domains << name
|
||||
Bushido::App.add_domain(name)
|
||||
|
||||
if Bushido::Command.last_command_successful?
|
||||
self.bushido_domains << name
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def remove_bushido_domain(name)
|
||||
Locomotive.logger "[remove bushido domain] #{name}"
|
||||
Bushido::Domains.remove_subdomain(name)
|
||||
self.bushido_domains.delete(name)
|
||||
Bushido::App.remove_domain(name)
|
||||
|
||||
if Bushido::Command.last_command_successful?
|
||||
self.bushido_domains.delete(name)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def set_bushido_subdomain(name)
|
||||
Locomotive.logger "[set bushido subdomain] #{name}.bushi.do"
|
||||
Bushido::App.set_subdomain(name)
|
||||
|
||||
if Bushido::Command.last_command_successful?
|
||||
self.bushido_subdomain = name
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -1,5 +1,5 @@
|
||||
module Locomotive
|
||||
module Bushido
|
||||
module BushidoSupport
|
||||
module CustomDomain
|
||||
|
||||
extend ActiveSupport::Concern
|
||||
|
Loading…
Reference in New Issue
Block a user