1 if defined?(Merb::Plugins)
5 require 'dm-validations'
8 require 'lib/merb-E-mart/exceptions/mixin_missing'
9 Merb::Plugins.add_rakefiles "merb-E-mart/merbtasks"
11 # Register the Slice for the current host application
12 Merb::Slices::register(__FILE__)
14 # Slice configuration - set this in a before_app_loads callback.
15 # By default a Slice uses its own layout, so you can swicht to
16 # the main application layout or no layout at all if needed.
18 # Configuration options:
19 # :layout - the layout to use; defaults to :merb_E_mart
20 # :mirror - which path component types to use on copy operations; defaults to all
21 Merb::Slices::config[:merb_E_mart] = { :layout => :merb_E_mart }
23 # All Slice code is expected to be namespaced inside a module
27 self.description = "MerbEMart is a chunky Merb slice!"
28 self.version = "0.0.1"
29 self.author = "YOUR NAME"
31 # Initialization hook - runs before AfterAppLoads BootLoader
35 # Activation hook - runs after AfterAppLoads BootLoader
39 # Deactivation hook - triggered by Merb::Slices#deactivate
43 # Setup routes inside the host application
45 # @param scope<Merb::Router::Behaviour>
46 # Routes will be added within this scope (namespace). In fact, any
47 # router behaviour is a valid namespace, so you can attach
48 # routes at any level of your router setup.
49 def self.setup_router(scope)
50 scope.namespace(:admin) do |admin|
51 admin.to(:controller => 'products') do |products|
52 products.match('/products').to.name(:products)
59 # Setup the slice layout for MerbEMart
61 # Use MerbEMart.push_path and MerbEMart.push_app_path
62 # to set paths to merb-E-mart-level and app-level paths. Example:
64 MerbEMart.push_path(:application, MerbEMart.root)
65 MerbEMart.push_app_path(:application, Merb.root / 'slices' / 'merb-E-mart')
68 # Any component path that hasn't been set will default to MerbEMart.root
70 # Or just call setup_default_structure! to setup a basic Merb MVC structure.
71 MerbEMart.setup_default_structure!