All Slice code is expected to be namespaced inside a module
All Slice code is expected to be namespaced inside a module
All Slice code is expected to be namespaced inside a module
Activation hook - runs after AfterAppLoads BootLoader
# File lib/generators/templates/very_thin/lib/%base_name%.rb, line 32 def self.activate end
Deactivation hook - triggered by Merb::Slices.deactivate(<%= module_name %>)
# File lib/generators/templates/very_thin/lib/%base_name%.rb, line 36 def self.deactivate end
Initialization hook - runs before AfterAppLoads BootLoader
# File lib/generators/templates/very_thin/lib/%base_name%.rb, line 28 def self.init end
Stub classes loaded hook - runs before LoadClasses BootLoader right after a slice’s classes have been loaded internally.
# File lib/generators/templates/very_thin/lib/%base_name%.rb, line 24 def self.loaded end
This sets up a very thin slice’s structure.
# File lib/generators/templates/very_thin/lib/%base_name%.rb, line 54 def self.setup_default_structure! self.push_app_path(:root, Merb.root / 'slices' / self.identifier, nil) self.push_path(:stub, root_path('stubs'), nil) self.push_app_path(:stub, app_dir_for(:root), nil) self.push_path(:application, root, 'application.rb') self.push_app_path(:application, app_dir_for(:root), 'application.rb') self.push_path(:public, root_path('public'), nil) self.push_app_path(:public, Merb.root / 'public' / 'slices' / self.identifier, nil) public_components.each do |component| self.push_path(component, dir_for(:public) / "#{component}s", nil) self.push_app_path(component, app_dir_for(:public) / "#{component}s", nil) end end
Setup routes inside the host application
@param scope<Merb::Router::Behaviour>
Routes will be added within this scope (namespace). In fact, any router behaviour is a valid namespace, so you can attach routes at any level of your router setup.
@note prefix your named routes with :<%= symbol_name %>_
to avoid potential conflicts with global named routes.
# File lib/generators/templates/very_thin/lib/%base_name%.rb, line 48 def self.setup_router(scope) # enable slice-level default routes by default scope.default_routes end
Generated with the Darkfish Rdoc Generator 2.