Class: Spree::Initializer
- Defined in:
- lib/spree/initializer.rb
Class Method Summary collapse
Instance Method Summary collapse
- #add_plugin_load_paths ⇒ Object
- #after_initialize ⇒ Object
-
#extension_loader ⇒ Object
def admin configuration.admin end.
-
#initialize_framework_views ⇒ Object
def initialize_default_admin_tabs admin.tabs.clear admin.tabs.add “Pages”, “/admin/pages” admin.tabs.add “Snippets”, “/admin/snippets” admin.tabs.add “Layouts”, “/admin/layouts”, :visibility => [:admin, :developer] end.
- #initialize_i18n ⇒ Object
-
#initialize_routing ⇒ Object
BQ - Don’t this think method is needed anymore?.
-
#install_gem_spec_stubs ⇒ Object
If Rails is vendored and RubyGems is available, install stub GemSpecs for Rails, Active Support, Active Record, Action Pack, Action Mailer, and Active Resource.
- #load_plugins ⇒ Object
- #set_autoload_paths ⇒ Object
Class Method Details
.run(command = :process, configuration = Configuration.new) ⇒ Object
85 86 87 |
# File 'lib/spree/initializer.rb', line 85 def self.run(command = :process, configuration = Configuration.new) super end |
Instance Method Details
#add_plugin_load_paths ⇒ Object
102 103 104 105 106 |
# File 'lib/spree/initializer.rb', line 102 def add_plugin_load_paths # checks for plugins within extensions: extension_loader.add_plugin_paths super end |
#after_initialize ⇒ Object
120 121 122 123 |
# File 'lib/spree/initializer.rb', line 120 def after_initialize extension_loader.activate_extensions unless $rails_gem_installer super end |
#extension_loader ⇒ Object
def admin
configuration.admin
end
164 165 166 |
# File 'lib/spree/initializer.rb', line 164 def extension_loader ExtensionLoader.instance {|l| l.initializer = self } end |
#initialize_framework_views ⇒ Object
def initialize_default_admin_tabs
admin.tabs.clear
admin.tabs.add "Pages", "/admin/pages"
admin.tabs.add "Snippets", "/admin/snippets"
admin.tabs.add "Layouts", "/admin/layouts", :visibility => [:admin, :developer]
end
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 |
# File 'lib/spree/initializer.rb', line 132 def initialize_framework_views view_paths = returning [] do |arr| # Add the singular view path if it's not in the list arr << configuration.view_path if !configuration.view_paths.include?(configuration.view_path) # Add the default view paths arr.concat configuration.view_paths # Add the extension view paths arr.concat extension_loader.view_paths # Reverse the list so extensions come first arr.reverse! end ActionMailer::Base.template_root = view_paths if configuration.frameworks.include?(:action_mailer) ActionController::Base.view_paths = view_paths if configuration.frameworks.include?(:action_controller) end |
#initialize_i18n ⇒ Object
148 149 150 151 152 153 |
# File 'lib/spree/initializer.rb', line 148 def initialize_i18n extension_loader.add_locale_paths spree_locale_paths = Dir[File.join(SPREE_ROOT, 'config', 'locales', '*.{rb,yml}')] extension_loader.configuration.i18n.load_path = spree_locale_paths + extension_loader.configuration.i18n.load_path super end |
#initialize_routing ⇒ Object
BQ - Don’t this think method is needed anymore?
155 156 157 158 |
# File 'lib/spree/initializer.rb', line 155 def initialize_routing #BQ - Don't this think method is needed anymore? extension_loader.add_controller_paths super end |
#install_gem_spec_stubs ⇒ Object
If Rails is vendored and RubyGems is available, install stub GemSpecs for Rails, Active Support, Active Record, Action Pack, Action Mailer, and Active Resource. This allows Gem plugins to depend on Rails even when the Gem version of Rails shouldn’t be loaded.
93 94 95 |
# File 'lib/spree/initializer.rb', line 93 def install_gem_spec_stubs #TODO - provide meaningful implementation (commented out for now so we can start server) end |
#load_plugins ⇒ Object
108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/spree/initializer.rb', line 108 def load_plugins super extension_loader.load_extensions # Add extension gems. Object.subclasses_of(Spree::Extension).each do |extension_class| if extension_class.respond_to? :require_gems extension_class.require_gems(@configuration) end end end |
#set_autoload_paths ⇒ Object
97 98 99 100 |
# File 'lib/spree/initializer.rb', line 97 def set_autoload_paths extension_loader.add_extension_paths super end |