mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-16 18:46:22 +00:00
método genérico para instanciar el servicio
This commit is contained in:
parent
15e978c877
commit
7f6063475b
2 changed files with 8 additions and 4 deletions
|
@ -12,6 +12,13 @@ module ActiveStorage
|
|||
class JekyllService < Service::DiskService
|
||||
BLOB_NAME = 'blob'
|
||||
|
||||
# Genera un servicio para un sitio determinado
|
||||
def self.build_for_site(site:)
|
||||
new(root: File.join(site.path, 'public'), public: true).tap do |js|
|
||||
js.name = site.name.to_sym
|
||||
end
|
||||
end
|
||||
|
||||
# Para poder guardar el archivo con el nombre original pero poder
|
||||
# recuperarlo durante el download, luego de subirlo le cambiamos el
|
||||
# nombre y creamos un link simbólico a un nombre conocido.
|
||||
|
|
|
@ -14,10 +14,7 @@ module ActiveStorage
|
|||
if configurations.include?(key)
|
||||
services[key] = configurator.build(key)
|
||||
elsif (site = Site.find_by_name(key))
|
||||
root = File.join(site.path, 'public')
|
||||
services[key] = ActiveStorage::Service::JekyllService.new(root: root, public: true).tap do |s|
|
||||
s.name = key.to_sym
|
||||
end
|
||||
services[key] = ActiveStorage::Service::JekyllService.build_for_site(site: site)
|
||||
elsif block_given?
|
||||
yield key
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue