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
96 97 98 |
# File 'lib/spree/initializer.rb', line 96 def self.run(command = :process, configuration = Configuration.new) super end |
Instance Method Details
#add_plugin_load_paths ⇒ Object
113 114 115 116 117 |
# File 'lib/spree/initializer.rb', line 113 def add_plugin_load_paths # checks for plugins within extensions: extension_loader.add_plugin_paths super end |
#after_initialize ⇒ Object
131 132 133 134 135 |
# File 'lib/spree/initializer.rb', line 131 def after_initialize extension_loader.activate_extensions unless $rails_gem_installer extension_loader.run_initializers #? conds? super end |
#extension_loader ⇒ Object
def admin
configuration.admin
end
176 177 178 |
# File 'lib/spree/initializer.rb', line 176 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
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 |
# File 'lib/spree/initializer.rb', line 144 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
160 161 162 163 164 165 |
# File 'lib/spree/initializer.rb', line 160 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?
167 168 169 170 |
# File 'lib/spree/initializer.rb', line 167 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.
104 105 106 |
# File 'lib/spree/initializer.rb', line 104 def install_gem_spec_stubs #TODO - provide meaningful implementation (commented out for now so we can start server) end |
#load_plugins ⇒ Object
119 120 121 122 123 124 125 126 127 128 129 |
# File 'lib/spree/initializer.rb', line 119 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
108 109 110 111 |
# File 'lib/spree/initializer.rb', line 108 def set_autoload_paths extension_loader.add_extension_paths super end |