merb plugins 101
DESCRIPTION
Best practices to write a Merb Plugin. Learn when you should use Plugins and when you should use Slices. Presentation given by Matt Aimonetti during MerbCamp 2008TRANSCRIPT
Merb Plugins
1 0 1
MeMatt
Aimonetti
irc: m a t t e t t i
Merb::Slices
Merb::Slices
reusable
Merb::Slices
reusable
overwritable
Merb::Slices
reusable overwritablemini apps
Merb::Slices
osimer than
generated code
Merb::Slices
login formpassword reminder
blogforum
event registrationadmin interface
tune up...
Merb::Slices
target application content
When?
Merb::Plugins
Merb::Plugins
NOT DataMapper plugins!
Merb::Plugins
When?
Merb::Plugins
target extending the framework
When?
Merb::Plugins
Merb::Plugins !=
Rails Plugins
Merb::Plugins
alias_method_chain=
evil
Merb::Plugins
provides :hooks
Merb::Plugins
Merb::BootLoader
Merb::Plugins
Merb::BootLoader.before_app_loads Merb::BootLoader.after_app_loads
Merb::Plugins
Merb API@private@public@plugin/overridable
Merb::Plugins
Merb APIif it fails your expectations
contact us (srly)
Merb::Plugins
Merb::Plugins.config[:merb_osim]
Merb::Plugins
Merb::Plugins.add_rakefiles "merb_osim/merbtasks"
Merb::Plugins
test through the stack!
default_options = { :environment => 'test', :adapter => 'runner', :merb_root => File.dirname(__FILE__) / 'full-stack', :log_file => File.dirname(__FILE__) / "merb_test.log"}options = default_options.merge($START_OPTIONS || {}) Merb.disable(:initfile)Merb.start_environment(options)
Merb::Plugins
¿ORM?
Merb::Plugins
no rulesbut make sure
you develop a clean APIto let other people extend
your plugin
Merb::Plugins
Merb ORM interfaceMerb
1.x
Merb::Plugins
e x t l i bhttp://github.com/sam/extlib
Merb::Plugins
v e r s i o ndependency "merb-core", "= 1.0"
dependency "merb-core", "<= 2.0"
Merb::Plugins
e x a m p l e s
http://github.com/wycats/merb-morehttp://github.com/wycats/merb-plugins
Merb::Plugins
¿ h e l p ?
irc://irc.freenode.net/merbhttp://groups.google.com/group/merb
T h a n k s