Module: TrustyCms
- Defined in:
- lib/trusty_cms/pagination/link_renderer.rb,
lib/trusty_cms.rb,
lib/trusty_cms/setup.rb,
lib/trusty_cms/engine.rb,
lib/trusty_cms/version.rb,
lib/trusty_cms/admin_ui.rb,
lib/trusty_cms/extension.rb,
lib/trusty_cms/initializer.rb,
lib/trusty_cms/task_support.rb,
app/models/trusty_cms/config.rb,
lib/trusty_cms/extension_path.rb,
lib/trusty_cms/extension_loader.rb,
lib/trusty_cms/config/definition.rb,
lib/trusty_cms/extension_migrator.rb,
lib/trusty_cms/resource_responses.rb,
lib/trusty_cms/pagination/controller.rb,
lib/generators/generator_base_extension.rb,
lib/generators/instance/templates/instance_boot.rb,
app/models/trusty_cms/page_response_cache_director.rb,
lib/configuration_extensions/configuration_extensions.rb
Overview
This handy simplification is adapted from SphinxSearch (thanks) and originally came from Ultrasphinx it saves us a lot of including and bodging to make will_paginate’s template calls work in the Page model
Defined Under Namespace
Modules: AvailableLocales, GeneratorBaseExtension, Initializer, Pagination, ResourceResponses, Taggable
Classes: AdminUI, AppBoot, Boot, Config, Engine, Extension, ExtensionLoader, ExtensionMigrator, ExtensionPath, GemBoot, PageResponseCacheDirector, Setup, TaskSupport, VendorBoot
Constant Summary
collapse
- VERSION =
'7.0.3'.freeze
Class Method Summary
collapse
Class Method Details
.app? ⇒ Boolean
43
44
45
|
# File 'lib/generators/instance/templates/instance_boot.rb', line 43
def app?
File.exist?("#{Rails.root}/lib/radiant.rb")
end
|
.boot! ⇒ Object
17
18
19
20
21
22
|
# File 'lib/generators/instance/templates/instance_boot.rb', line 17
def boot!
unless booted?
preinitialize
pick_boot.run
end
end
|
.booted? ⇒ Boolean
24
25
26
|
# File 'lib/generators/instance/templates/instance_boot.rb', line 24
def booted?
defined? TrustyCms::Initializer
end
|
.config {|TrustyCms::Config| ... } ⇒ Object
Returns the TrustyCms::Config eigenclass object, so it can be used wherever you would use TrustyCms::Config.
TrustyCms.config['site.title']
TrustyCms.config['site.url'] = 'example.com'
but it will also yield itself to a block:
TrustyCms.config do |config|
config.define 'something', default => 'something'
config['other.thing'] = 'nothing'
end
17
18
19
20
|
# File 'lib/configuration_extensions/configuration_extensions.rb', line 17
def config yield TrustyCms::Config if block_given?
TrustyCms::Config
end
|
.config_definitions ⇒ Object
3
4
5
|
# File 'app/models/trusty_cms/config.rb', line 3
def config_definitions
@config_definitions ||= {}
end
|
.config_definitions=(definitions) ⇒ Object
7
8
9
|
# File 'app/models/trusty_cms/config.rb', line 7
def config_definitions=(definitions)
@config_definitions = definitions
end
|
.configuration {|Rails.configuration| ... } ⇒ Object
Returns the configuration object with which this application was initialized. For now it’s exactly the same as calling Rails.configuration except that it will also yield itself to a block.
25
26
27
28
|
# File 'lib/configuration_extensions/configuration_extensions.rb', line 25
def configuration
yield Rails.configuration if block_given?
Rails.configuration
end
|
.loaded_via_gem? ⇒ Boolean
51
52
53
|
# File 'lib/generators/instance/templates/instance_boot.rb', line 51
def loaded_via_gem?
pick_boot.is_a? GemBoot
end
|
.pick_boot ⇒ Object
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/generators/instance/templates/instance_boot.rb', line 28
def pick_boot
case
when app?
AppBoot.new
when vendor?
VendorBoot.new
else
GemBoot.new
end
end
|
.preinitialize ⇒ Object
47
48
49
|
# File 'lib/generators/instance/templates/instance_boot.rb', line 47
def preinitialize
load(preinitializer_path) if File.exist?(preinitializer_path)
end
|
.preinitializer_path ⇒ Object
55
56
57
|
# File 'lib/generators/instance/templates/instance_boot.rb', line 55
def preinitializer_path
"#{Rails.root}/config/preinitializer.rb"
end
|
.root ⇒ Object
Returns the root directory of this installation (which is usually the gem directory). This is not the same as Rails.root, which is the instance directory and tends to contain only site-delivery material.
.vendor? ⇒ Boolean
39
40
41
|
# File 'lib/generators/instance/templates/instance_boot.rb', line 39
def vendor?
File.exist?("#{Rails.root}/vendor/radiant")
end
|