Sha256: 09315e731fa31f2209ede854a60204e6fa973e3aee843663d9a1073b601e280d

Contents?: true

Size: 1.34 KB

Versions: 1

Compression:

Stored size: 1.34 KB

Contents

module Superhosting
  module Controller
    class Site
      include Helper::States

      def install_data(name:, container_name:)
        container_mapper = @container_controller.index[container_name][:mapper]
        container_mapper.sites.f(name).create!
        site_lib_mapper = container_mapper.lib.web.f(name).create!

        chown_r!(container_name, container_name, site_lib_mapper.path)

        self.reindex_site(name: name, container_name: container_name)
        {}
      end

      def uninstall_data(name:)
        if self.index.include? name
          container_mapper = self.index[name][:container_mapper]
          container_mapper.sites.f(name).delete!
          container_mapper.lib.web.f(name).delete!
          container_mapper.lib.sites.f(name).aliases.delete!

          self.reindex_site(name: name, container_name: container_mapper.name)
        end
        {}
      end

      def _config_options(name:, on_reconfig:, on_config:)
        mapper = self.index[name][:mapper]
        container_mapper = self.index[name][:container_mapper]
        registry_mapper = container_mapper.lib.registry.sites.f(name)

        @container_controller._config_options(name: container_mapper.name, on_reconfig: on_reconfig, on_config: on_config).merge! ({
            site: mapper,
            registry_mapper: registry_mapper
        })
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
superhosting-0.0.2 lib/superhosting/controller/site/states.rb