Module: Locomotive

Extended by:
ActiveSupport::Autoload
Defined in:
lib/locomotive/version.rb,
lib/locomotive.rb,
lib/locomotive/engine.rb,
lib/locomotive/logger.rb,
app/api/locomotive/api.rb,
lib/locomotive/regexps.rb,
lib/locomotive/dragonfly.rb,
app/models/locomotive/page.rb,
lib/locomotive/simple_form.rb,
app/models/locomotive/site.rb,
lib/locomotive/presentable.rb,
lib/locomotive/configuration.rb,
app/models/locomotive/snippet.rb,
app/models/locomotive/account.rb,
lib/locomotive/mongoid/liquid.rb,
app/forms/locomotive/site_form.rb,
app/forms/locomotive/base_form.rb,
app/forms/locomotive/page_form.rb,
app/inputs/locomotive/rte_input.rb,
lib/locomotive/middlewares/site.rb,
lib/locomotive/mongoid/document.rb,
lib/locomotive/mongoid/presenter.rb,
app/inputs/locomotive/file_input.rb,
app/models/locomotive/membership.rb,
app/inputs/locomotive/code_input.rb,
lib/locomotive/carrierwave/asset.rb,
app/forms/locomotive/snippet_form.rb,
app/forms/locomotive/account_form.rb,
app/inputs/locomotive/array_input.rb,
app/models/locomotive/theme_asset.rb,
app/inputs/locomotive/toggle_input.rb,
app/models/locomotive/content_type.rb,
app/helpers/locomotive/base_helper.rb,
app/entities/locomotive/site_entity.rb,
app/helpers/locomotive/sites_helper.rb,
app/entities/locomotive/base_entity.rb,
app/models/locomotive/content_asset.rb,
app/models/locomotive/editable_text.rb,
app/policies/locomotive/site_policy.rb,
app/helpers/locomotive/pages_helper.rb,
app/models/locomotive/content_entry.rb,
app/models/locomotive/editable_file.rb,
app/policies/locomotive/page_policy.rb,
app/inputs/locomotive/locales_input.rb,
app/entities/locomotive/page_entity.rb,
app/inputs/locomotive/api_key_input.rb,
app/api/locomotive/api_params_helper.rb,
app/mailers/locomotive/devise_mailer.rb,
app/mailers/locomotive/notifications.rb,
lib/locomotive/action_controller/ssl.rb,
app/forms/locomotive/membership_form.rb,
lib/locomotive/middlewares/permalink.rb,
app/forms/locomotive/my_account_form.rb,
app/services/locomotive/site_service.rb,
app/services/locomotive/page_service.rb,
app/forms/locomotive/theme_asset_form.rb,
app/forms/locomotive/translation_form.rb,
app/api/locomotive/resources/page_api.rb,
app/api/locomotive/persistence_helper.rb,
app/api/locomotive/resources/site_api.rb,
app/entities/locomotive/snippet_entity.rb,
app/api/locomotive/resources/token_api.rb,
app/models/locomotive/editable_control.rb,
app/models/locomotive/editable_element.rb,
app/helpers/locomotive/accounts_helper.rb,
app/policies/locomotive/account_policy.rb,
app/entities/locomotive/account_entity.rb,
app/policies/locomotive/snippet_policy.rb,
app/helpers/locomotive/my_account_helper.rb,
app/api/locomotive/resources/snippet_api.rb,
app/models/locomotive/editable_long_text.rb,
app/presenters/locomotive/page_presenter.rb,
app/presenters/locomotive/site_presenter.rb,
app/api/locomotive/resources/account_api.rb,
app/api/locomotive/resources/version_api.rb,
app/models/locomotive/concerns/page/tree.rb,
app/policies/locomotive/membership_policy.rb,
app/entities/locomotive/membership_entity.rb,
app/models/locomotive/concerns/shared/seo.rb,
app/models/locomotive/editable_short_text.rb,
app/helpers/locomotive/memberships_helper.rb,
app/uploaders/locomotive/picture_uploader.rb,
app/models/locomotive/concerns/page/listed.rb,
app/models/locomotive/concerns/asset/types.rb,
app/models/locomotive/concerns/shared/slug.rb,
app/models/locomotive/concerns/page/layout.rb,
app/controllers/locomotive/base_controller.rb,
app/helpers/locomotive/installation_helper.rb,
app/policies/locomotive/translation_policy.rb,
app/entities/locomotive/theme_asset_entity.rb,
app/policies/locomotive/application_policy.rb,
app/helpers/locomotive/shared/sites_helper.rb,
app/helpers/locomotive/translations_helper.rb,
app/entities/locomotive/translation_entity.rb,
app/services/locomotive/membership_service.rb,
lib/locomotive/action_controller/responder.rb,
app/policies/locomotive/theme_asset_policy.rb,
app/helpers/locomotive/shared/pages_helper.rb,
app/models/locomotive/concerns/site/locales.rb,
app/controllers/locomotive/sites_controller.rb,
app/api/locomotive/resources/my_account_api.rb,
app/api/locomotive/resources/membership_api.rb,
app/policies/locomotive/content_type_policy.rb,
app/presenters/locomotive/account_presenter.rb,
app/helpers/locomotive/custom_fields_helper.rb,
app/presenters/locomotive/snippet_presenter.rb,
app/inputs/locomotive/editable_select_input.rb,
app/inputs/locomotive/document_picker_input.rb,
app/controllers/locomotive/pages_controller.rb,
app/helpers/locomotive/content_types_helper.rb,
app/policies/locomotive/content_asset_policy.rb,
app/helpers/locomotive/content_assets_helper.rb,
app/models/locomotive/concerns/site/timezone.rb,
app/policies/locomotive/content_entry_policy.rb,
app/models/locomotive/concerns/page/redirect.rb,
app/api/locomotive/resources/translation_api.rb,
app/services/locomotive/custom_field_service.rb,
app/services/locomotive/content_type_service.rb,
app/api/locomotive/resources/theme_asset_api.rb,
app/entities/locomotive/content_entry_entity.rb,
app/api/locomotive/resources/current_site_api.rb,
app/api/locomotive/api_authentication_helpers.rb,
app/helpers/locomotive/content_entries_helper.rb,
app/helpers/locomotive/shared/accounts_helper.rb,
app/services/locomotive/content_entry_service.rb,
app/models/locomotive/concerns/asset/vignette.rb,
app/services/locomotive/content_asset_service.rb,
app/uploaders/locomotive/theme_asset_uploader.rb,
app/controllers/locomotive/accounts_controller.rb,
app/controllers/locomotive/sessions_controller.rb,
app/models/locomotive/concerns/account/api_key.rb,
app/presenters/locomotive/membership_presenter.rb,
app/controllers/locomotive/passwords_controller.rb,
app/presenters/locomotive/theme_asset_presenter.rb,
app/uploaders/locomotive/editable_file_uploader.rb,
app/uploaders/locomotive/content_asset_uploader.rb,
app/entities/locomotive/editable_element_entity.rb,
app/models/locomotive/concerns/page/templatized.rb,
app/controllers/locomotive/dashboard_controller.rb,
app/models/locomotive/concerns/shared/userstamp.rb,
app/presenters/locomotive/translation_presenter.rb,
app/controllers/locomotive/my_account_controller.rb,
app/presenters/locomotive/content_type_presenter.rb,
app/models/locomotive/concerns/content_entry/csv.rb,
app/models/locomotive/concerns/content_type/sync.rb,
app/models/locomotive/concerns/content_entry/slug.rb,
app/models/locomotive/concerns/site/access_points.rb,
app/models/locomotive/concerns/content_type/label.rb,
app/presenters/locomotive/editable_file_presenter.rb,
app/controllers/locomotive/memberships_controller.rb,
app/presenters/locomotive/content_entry_presenter.rb,
app/presenters/locomotive/content_asset_presenter.rb,
app/presenters/locomotive/content_field_presenter.rb,
app/presenters/locomotive/editable_text_presenter.rb,
app/presenters/locomotive/editable_text_presenter.rb,
app/presenters/locomotive/editable_text_presenter.rb,
app/controllers/locomotive/translations_controller.rb,
app/controllers/locomotive/current_site_controller.rb,
lib/generators/locomotive/install/install_generator.rb,
app/models/locomotive/concerns/account/devise_patch.rb,
app/controllers/locomotive/registrations_controller.rb,
app/controllers/locomotive/content_assets_controller.rb,
app/models/locomotive/concerns/content_type/order_by.rb,
app/presenters/locomotive/editable_element_presenter.rb,
app/presenters/locomotive/editable_control_presenter.rb,
app/models/locomotive/concerns/content_entry/counter.rb,
app/models/locomotive/concerns/content_type/group_by.rb,
app/controllers/locomotive/content_entries_controller.rb,
app/models/locomotive/concerns/page/editable_elements.rb,
app/models/locomotive/concerns/content_entry/localized.rb,
app/controllers/locomotive/concerns/account_controller.rb,
app/controllers/locomotive/concerns/timezone_controller.rb,
app/controllers/locomotive/concerns/exception_controller.rb,
app/controllers/locomotive/concerns/membership_controller.rb,
app/models/locomotive/concerns/content_type/item_template.rb,
app/models/locomotive/concerns/content_type/class_helpers.rb,
app/models/locomotive/concerns/content_entry/notifications.rb,
app/models/locomotive/concerns/content_entry/next_previous.rb,
app/controllers/locomotive/concerns/url_helpers_controller.rb,
app/controllers/locomotive/concerns/within_site_controller.rb,
app/models/locomotive/concerns/content_type/default_values.rb,
app/controllers/locomotive/concerns/authorization_controller.rb,
app/controllers/locomotive/concerns/locale_helpers_controller.rb,
app/controllers/locomotive/concerns/store_location_controller.rb,
app/controllers/locomotive/concerns/site_dispatcher_controller.rb,
app/controllers/locomotive/custom_fields/select_options_controller.rb,
app/controllers/locomotive/concerns/token_authentication_controller.rb

Overview

:nodoc

Defined Under Namespace

Modules: APIAuthenticationHelpers, APIParamsHelper, AccountsHelper, ActionController, BaseHelper, CarrierWave, Concerns, ContentAssetsHelper, ContentEntriesHelper, ContentTypesHelper, CustomFields, CustomFieldsHelper, Dragonfly, InstallationHelper, Logger, MembershipsHelper, Middlewares, Mongoid, MyAccountHelper, PagesHelper, PersistenceHelper, Presentable, Regexps, Resources, Shared, SimpleForm, SitesHelper, TranslationsHelper Classes: API, Account, AccountEntity, AccountForm, AccountPolicy, AccountPresenter, AccountsController, ApiKeyInput, ApplicationPolicy, ArrayInput, BaseController, BaseEntity, BaseForm, BasePresenter, CodeInput, Configuration, ConfigurationHash, ContentAsset, ContentAssetPolicy, ContentAssetPresenter, ContentAssetService, ContentAssetUploader, ContentAssetsController, ContentEntriesController, ContentEntry, ContentEntryEntity, ContentEntryPolicy, ContentEntryPresenter, ContentEntryService, ContentFieldPresenter, ContentType, ContentTypePolicy, ContentTypePresenter, ContentTypeService, CurrentSiteController, CustomFieldService, DashboardController, DeviseMailer, DocumentPickerInput, EditableControl, EditableControlPresenter, EditableElement, EditableElementEntity, EditableElementPresenter, EditableFile, EditableFilePresenter, EditableFileUploader, EditableLongText, EditableLongTextPresenter, EditableSelectInput, EditableShortText, EditableShortTextPresenter, EditableText, EditableTextPresenter, Engine, FileInput, FormBuilder, ImageResizeForm, InstallGenerator, LocalesInput, Membership, MembershipEntity, MembershipForm, MembershipPolicy, MembershipPresenter, MembershipService, MembershipsController, MyAccountController, MyAccountForm, Notifications, Page, PageEntity, PageForm, PagePolicy, PagePresenter, PageService, PagesController, PasswordsController, PictureUploader, RegistrationsController, RteInput, SessionsController, Site, SiteEntity, SiteForm, SitePolicy, SitePresenter, SiteService, SitesController, Snippet, SnippetEntity, SnippetForm, SnippetPolicy, SnippetPresenter, ThemeAsset, ThemeAssetEntity, ThemeAssetForm, ThemeAssetPolicy, ThemeAssetPresenter, ThemeAssetUploader, ToggleInput, Translation, TranslationEntity, TranslationForm, TranslationPolicy, TranslationPresenter, TranslationsController

Constant Summary

VERSION =
'3.0.0'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configObject

Returns the value of attribute config



24
25
26
# File 'lib/locomotive.rb', line 24

def config
  @config
end

Class Method Details

.after_configureObject



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/locomotive.rb', line 40

def self.after_configure
  # Devise
  mail_address = self.config.mailer_sender
  ::Devise.mailer_sender = mail_address =~ /.+@.+/ ? mail_address : "#{mail_address}@#{Locomotive.config.domain}"

  # cookies stored in mongodb (mongoid_store)
  Rails.application.config.session_store :mongoid_store, {
    key:    self.config.cookie_key,
    domain: :all
  }

  # Check for outdated Dragonfly config
  if ::Dragonfly::VERSION =~ /^0\.9\.([0-9]+)/
    Locomotive.log :error, "WARNING: Old Dragonfly config detected, image uploads might be broken. Use 'rails g locomotive:install' to get the latest configuration files."
  end

  # avoid I18n warnings
  I18n.enforce_available_locales = false
end

.configure {|self.config| ... } ⇒ Object

Yields:



32
33
34
35
36
37
38
# File 'lib/locomotive.rb', line 32

def self.configure
  self.config ||= Configuration.new

  yield(self.config)

  after_configure
end

.log(*args) ⇒ Object



60
61
62
63
64
65
# File 'lib/locomotive.rb', line 60

def self.log(*args)
  level   = args.size == 1 ? 'info' : args.first
  message = args.size == 1 ? args.first : args.last

  ::Locomotive::Logger.send(level.to_sym, message)
end

.mounted_onObject



67
68
69
# File 'lib/locomotive.rb', line 67

def self.mounted_on
  Rails.application.routes.named_routes[:locomotive].path.spec.to_s
end