merb plugins 101

32
Merb Plugins 101

Upload: matt-aimonetti

Post on 18-May-2015

3.435 views

Category:

Technology


0 download

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 2008

TRANSCRIPT

Page 1: Merb Plugins 101

Merb Plugins

1 0 1

Page 2: Merb Plugins 101

MeMatt

Aimonetti

irc: m a t t e t t i

Page 3: Merb Plugins 101

Merb::Slices

Page 4: Merb Plugins 101

Merb::Slices

reusable

Page 5: Merb Plugins 101

Merb::Slices

reusable

overwritable

Page 6: Merb Plugins 101

Merb::Slices

reusable overwritablemini apps

Page 7: Merb Plugins 101

Merb::Slices

osimer than

generated code

Page 8: Merb Plugins 101

Merb::Slices

login formpassword reminder

blogforum

event registrationadmin interface

tune up...

Page 9: Merb Plugins 101

Merb::Slices

target application content

When?

Page 10: Merb Plugins 101

Merb::Plugins

Page 11: Merb Plugins 101

Merb::Plugins

NOT DataMapper plugins!

Page 12: Merb Plugins 101

Merb::Plugins

When?

Page 13: Merb Plugins 101

Merb::Plugins

target extending the framework

When?

Page 14: Merb Plugins 101

Merb::Plugins

Merb::Plugins !=

Rails Plugins

Page 15: Merb Plugins 101

Merb::Plugins

alias_method_chain=

evil

Page 16: Merb Plugins 101

Merb::Plugins

provides :hooks

Page 17: Merb Plugins 101

Merb::Plugins

Merb::BootLoader

Page 18: Merb Plugins 101

Merb::Plugins

Merb::BootLoader.before_app_loads Merb::BootLoader.after_app_loads

Page 19: Merb Plugins 101

Merb::Plugins

Merb API@private@public@plugin/overridable

Page 20: Merb Plugins 101

Merb::Plugins

Merb APIif it fails your expectations

contact us (srly)

Page 21: Merb Plugins 101

Merb::Plugins

Merb::Plugins.config[:merb_osim]

Page 22: Merb Plugins 101

Merb::Plugins

Merb::Plugins.add_rakefiles "merb_osim/merbtasks"

Page 23: Merb Plugins 101

Merb::Plugins

test through the stack!

Page 24: Merb Plugins 101

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)

Page 25: Merb Plugins 101

Merb::Plugins

¿ORM?

Page 26: Merb Plugins 101

Merb::Plugins

no rulesbut make sure

you develop a clean APIto let other people extend

your plugin

Page 27: Merb Plugins 101

Merb::Plugins

Merb ORM interfaceMerb

1.x

Page 28: Merb Plugins 101

Merb::Plugins

e x t l i bhttp://github.com/sam/extlib

Page 29: Merb Plugins 101

Merb::Plugins

v e r s i o ndependency "merb-core", "= 1.0"

dependency "merb-core", "<= 2.0"

Page 30: Merb Plugins 101

Merb::Plugins

e x a m p l e s

http://github.com/wycats/merb-morehttp://github.com/wycats/merb-plugins

Page 31: Merb Plugins 101

Merb::Plugins

¿ h e l p ?

irc://irc.freenode.net/merbhttp://groups.google.com/group/merb

Page 32: Merb Plugins 101

T h a n k s