Class: Maglev::GenerateSite
- Inherits:
-
Object
- Object
- Maglev::GenerateSite
- Includes:
- Injectable
- Defined in:
- app/services/maglev/generate_site.rb
Overview
Generate site and its pages in the locales defined by the config file.
Instance Method Summary collapse
Instance Method Details
#call ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'app/services/maglev/generate_site.rb', line 13 def call raise 'A Maglev Site already exists' if Maglev::Site.first Maglev::Site.transaction do Maglev::Site.create(name: 'Default', locales: config.default_site_locales).tap do |site| Maglev::I18n.available_locales = site.locale_prefixes Maglev::I18n.with_locale(site.default_locale_prefix) do setup_pages.call(site: site, theme: theme) if site.errors.empty? end end end end |