• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Damage Control
 

Damage Control

on

  • 2,341 views

MerbCamp 2008 - getting started guide

MerbCamp 2008 - getting started guide

Statistics

Views

Total Views
2,341
Views on SlideShare
2,341
Embed Views
0

Actions

Likes
2
Downloads
44
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Damage Control Damage Control Presentation Transcript

    • Damage Control Brock Whitten (sintaxi)
    • if rails.is_ghetto? merb = ???? end
    • choice => two kinds 1) pick your tools ORM, JavaScript, Testing, Template Engine, Server 2) size it to fit Cache, Helpers, Mailer, Database?
    • plugins/slices/gems
    • plugins/slices/gems ...are all gems
    • plugins/slices/gems ...are all gems. WTF?
    • freeze > gem install RedCloth -i gems
    • freeze > gem install RedCloth -i gems /gems /bin /cache /doc /gems /RedCloth-4.0.4 /specifications
    • configuration /config database.yml dependencies.rb init.rb rack.rb router.rb
    • dependencies.rb dependency “RedCloth”, “4.0.4” dependency “BlueCloth”, “1.0.0” dependency “coderay”, “0.7.4”
    • 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 # ...
    • an opinionated merb helpers datamapper rspec merb-auth sqlite3 jquery.js
    • merb stack > sudo gem install merb
    • 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;] ]
    • merb stack > merb-gen app my_blog > merb-gen resource article > rake db:automigrate > merb
    • config/router.rb Merb::Router.prepare do resources :articles default_routes match('/').to(:controller => 'articles', :action =>'index') end
    • models/user.rb class User include DataMapper::Resource Merb::Authentication.user_class = self property :id, Serial property :login, String end
    • 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
    • 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
    • deploy > merb -e production -c 4 -p 9000
    • OSIM!
    • 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
    • gem install thor http://merbunity.com/tutorials/18
    • questions?