Your SlideShare is downloading. ×
Damage Control
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Damage Control

1,628

Published on

MerbCamp 2008 - getting started guide

MerbCamp 2008 - getting started guide

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,628
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
45
Comments
0
Likes
2
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Damage Control Brock Whitten (sintaxi)
  • 2. if rails.is_ghetto? merb = ???? end
  • 3. choice => two kinds 1) pick your tools ORM, JavaScript, Testing, Template Engine, Server 2) size it to fit Cache, Helpers, Mailer, Database?
  • 4. plugins/slices/gems
  • 5. plugins/slices/gems ...are all gems
  • 6. plugins/slices/gems ...are all gems. WTF?
  • 7. freeze > gem install RedCloth -i gems
  • 8. freeze > gem install RedCloth -i gems /gems /bin /cache /doc /gems /RedCloth-4.0.4 /specifications
  • 9. configuration /config database.yml dependencies.rb init.rb rack.rb router.rb
  • 10. dependencies.rb dependency “RedCloth”, “4.0.4” dependency “BlueCloth”, “1.0.0” dependency “coderay”, “0.7.4”
  • 11. init.rb require 'config/dependencies.rb' use_orm :datamapper use_test :rspec use_template_engine :erb Merb::Config.use do |c| c[:use_mutex] = false c[:session_store] = 'datamapper' c[:session_secret_key] = '1205346b9baa87cf8e31ac0971' c[:session_id_key] = '_session_id' end Merb::BootLoader.before_app_loads do # ... end Merb::BootLoader.after_app_loads do # ...
  • 12. an opinionated merb helpers datamapper rspec merb-auth sqlite3 jquery.js
  • 13. merb stack > sudo gem install merb
  • 14. merb stack > sudo gem install merb gems = [   [quot;merb-corequot;, quot;~> #{GEM_VERSION}quot;],   [quot;merb-morequot;, quot;~> #{GEM_VERSION}quot;],   [quot;dm-corequot;, quot;~> 0.9.6quot;],   [quot;do_sqlite3quot;, quot;~> 0.9.6quot;],   [quot;dm-timestampsquot;, quot;~> 0.9.6quot;],   [quot;dm-typesquot;, quot;~> 0.9.6quot;],   [quot;dm-aggregatesquot;, quot;~> 0.9.6quot;],   [quot;dm-migrationsquot;, quot;~> 0.9.6quot;],   [quot;dm-validationsquot;, quot;~> 0.9.6quot;],   [quot;dm-sweatshopquot;, quot;~> 0.9.6quot;] ]
  • 15. merb stack > merb-gen app my_blog > merb-gen resource article > rake db:automigrate > merb
  • 16. config/router.rb Merb::Router.prepare do resources :articles default_routes match('/').to(:controller => 'articles', :action =>'index') end
  • 17. models/user.rb class User include DataMapper::Resource Merb::Authentication.user_class = self property :id, Serial property :login, String end
  • 18. controllers/articles.rb class Article < Application provides :xml, :yaml, :js before :ensure_authenticated def show @article = Article.get(params[:id]) raise NotFound unless @article display @article end end
  • 19. DataMapper # queries Article.all Article.first :order => [:created_at.desc] Article.get(params[:id]) #validations validates_present :title validates_is_number :rating #associations has n, :comments belongs_to :blog has 1, :author
  • 20. deploy > merb -e production -c 4 -p 9000
  • 21. OSIM!
  • 22. tools textmate bundle git://github.com/drnic/merb-tmbundle.git wiki http://wiki.merbivore.com/ irc http://irc.freenode.net/ #merb http://irc.freenode.net/ #datamapper
  • 23. gem install thor http://merbunity.com/tutorials/18
  • 24. questions?

×