SlideShare una empresa de Scribd logo
1 de 32
Descargar para leer sin conexión
Introduction to Rango
Jakub Stastny aka @botanicus
About me
• Ruby & JavaScript
developer.
• Currently based in
London.
• Working as a
freelancer.
• botanicus.github.com
What is Rango?
• Rack-based light-weight web framework.
• As agnostic and flexible as possible.
• Ruby 1.9 only.
• Provides generators, but doesn’t insist on
any certain structure.
• Inspired by Django & Merb.
• Django terminology: View is called template and
view means an action in controller.
• You can use just whichever subset of Rango
you want and it will work.
• No strict conventions, just recommendations,
often use hooks or strategies.
Boot Process
• Script init.rb should setup environment.
• Work as a runner: ./init.rb myscript.rb
• And as a console: ./init.rb -i
• Or both altogether: ./init.rb -i myscript.rb
• Start web server: ./config.ru
• Rewrite arguments: ./config.ru -s thin
Routers
• Every router based on Rack (via env
[“rango.router.params”]).
• Rango::UrlHelper for url(:post, id)
Rendering
• You don’t need controllers for it:
RenderMixin
• The most low-level rendering layer.
• Template will be evaluated in context of the
third argument which defaults to
Object.new.
• post is defined as a local variable.
ExplicitRendering
• Template will be evaluated in context of
self.scope which you can redefine.
• Data from self.context hash will be available
as local variables.
• Context defaults to {request: self.request}.
ImplicitRendering
• Standard Rails-like rendering.
• Template will be evaluated in context of self,
so you can use.
• Methods as self.request or instance variables
as @post are evaluated on self directly, no
context required.
Template Inheritance
• Much more flexible and cleaner than layout/
view, no hacking around with content_for and a
bunch of partials.
• Just an inheritance: (admin/posts.html => admin/
base.html => base.html).
• The only implementation in Ruby(?)
• Haml-only, because there's no such thing as <%=
method(&block) %> in Erb.
• I recently extracted it to template-inheritance
gem (see my GitHub).
Basic Example
#8 Default value for block
• render “index.html”
• extends “base.html”
will parse base.html
and replace its
blocks by blocks in
index.html
Returning values
• Block can return whichever value via arguments.
• Block returns captured string from &block.
AJAX
• It will render normal page with layout if the
request isn’t AJAX.
• If request is AJAX it will just render index.html.
Haml render everything starting with =, it will
render content block which we can use for
updating part of site via JS.
GenericViews (GV)
• Borrowed from Django.
• Just a reusable Rack apps.
• Can extend router (redirect, defer).
• Just render template Rango::GV.static.
GV: Router Extensions
• Deferred routes: check request and decide
where to route (different actions for
desktop/mobile, for registered/unregistered
users etc).
• Rango::GV.redirect may be useful if your
router doesn’t support it.
HTTP Errors Handling
• Based on exceptions inherited from
Rango::HttpError.
• Error404 resp. NotFound.
• Has status, content_type and headers.
Rango::Controller#rescue_http_error
Rango::Controller#render_http_error 1
Rango::Controller#render_http_error 2
Other useful tools
• Pupu: package manager for assets from GitHub
(pupu install mootools).
• Formidable: because helpers is welcome-back-
to-PHP-mess. Again inspired by Django. Includes
validations (server-side & HTML 5), coercions etc.
• Git-deployer let you deploy via Git (git push
staging-server staging-branch). Similar as
what Heroku use, but this is more generic and you
can use it with your own server.
Links
• Wiki: http://wiki.github.com/botanicus/rango
• Issues: http://github.com/botanicus/rango/issues
• Twitter: http://twitter.com/RangoProject
• http://groups.google.com/group/rango-project
• http://github.com/botanicus/ruby-manor-rango
Thank you for your
attention!

Más contenido relacionado

La actualidad más candente

Automating Your Daily Tasks with Scripting - RubyConf 2015 Taiwan
Automating Your Daily Tasks with Scripting - RubyConf 2015 TaiwanAutomating Your Daily Tasks with Scripting - RubyConf 2015 Taiwan
Automating Your Daily Tasks with Scripting - RubyConf 2015 TaiwanAdler Hsieh
 
ruby + websocket + haproxy
ruby + websocket + haproxyruby + websocket + haproxy
ruby + websocket + haproxyMathieu Elie
 
Web development basics (Part-5)
Web development basics (Part-5)Web development basics (Part-5)
Web development basics (Part-5)Rajat Pratap Singh
 
Applet Vs Servlet
Applet Vs ServletApplet Vs Servlet
Applet Vs ServletBharat Sahu
 
Web development basics (Part-7)
Web development basics (Part-7)Web development basics (Part-7)
Web development basics (Part-7)Rajat Pratap Singh
 
FITC - Here Be Dragons: Advanced JavaScript Debugging
FITC - Here Be Dragons: Advanced JavaScript DebuggingFITC - Here Be Dragons: Advanced JavaScript Debugging
FITC - Here Be Dragons: Advanced JavaScript DebuggingRami Sayar
 
Fighting Ruby code smell
Fighting Ruby code smellFighting Ruby code smell
Fighting Ruby code smellolegshpynov
 
Ruby projects of interest for DevOps
Ruby projects of interest for DevOpsRuby projects of interest for DevOps
Ruby projects of interest for DevOpsRicardo Sanchez
 
Node.js Patterns and Opinions
Node.js Patterns and OpinionsNode.js Patterns and Opinions
Node.js Patterns and OpinionsIsaacSchlueter
 
Ruby Isn't Just About Rails
Ruby Isn't Just About RailsRuby Isn't Just About Rails
Ruby Isn't Just About RailsAdam Wiggins
 
I18nize Scala programs à la gettext
I18nize Scala programs à la gettextI18nize Scala programs à la gettext
I18nize Scala programs à la gettextNgoc Dao
 
Byte code engineering 21st May Saturday 2016
Byte code engineering   21st May Saturday 2016Byte code engineering   21st May Saturday 2016
Byte code engineering 21st May Saturday 2016Sarath Soman
 

La actualidad más candente (17)

Ajaxworld07
Ajaxworld07Ajaxworld07
Ajaxworld07
 
Automating Your Daily Tasks with Scripting - RubyConf 2015 Taiwan
Automating Your Daily Tasks with Scripting - RubyConf 2015 TaiwanAutomating Your Daily Tasks with Scripting - RubyConf 2015 Taiwan
Automating Your Daily Tasks with Scripting - RubyConf 2015 Taiwan
 
ruby + websocket + haproxy
ruby + websocket + haproxyruby + websocket + haproxy
ruby + websocket + haproxy
 
Web development basics (Part-5)
Web development basics (Part-5)Web development basics (Part-5)
Web development basics (Part-5)
 
Applet Vs Servlet
Applet Vs ServletApplet Vs Servlet
Applet Vs Servlet
 
How to-node-core
How to-node-coreHow to-node-core
How to-node-core
 
Rubyhosting
RubyhostingRubyhosting
Rubyhosting
 
Ruby on the JVM
Ruby on the JVMRuby on the JVM
Ruby on the JVM
 
Web development basics (Part-7)
Web development basics (Part-7)Web development basics (Part-7)
Web development basics (Part-7)
 
FITC - Here Be Dragons: Advanced JavaScript Debugging
FITC - Here Be Dragons: Advanced JavaScript DebuggingFITC - Here Be Dragons: Advanced JavaScript Debugging
FITC - Here Be Dragons: Advanced JavaScript Debugging
 
Fighting Ruby code smell
Fighting Ruby code smellFighting Ruby code smell
Fighting Ruby code smell
 
Ruby projects of interest for DevOps
Ruby projects of interest for DevOpsRuby projects of interest for DevOps
Ruby projects of interest for DevOps
 
Node.js Patterns and Opinions
Node.js Patterns and OpinionsNode.js Patterns and Opinions
Node.js Patterns and Opinions
 
RubyMotion #jbday
RubyMotion #jbdayRubyMotion #jbday
RubyMotion #jbday
 
Ruby Isn't Just About Rails
Ruby Isn't Just About RailsRuby Isn't Just About Rails
Ruby Isn't Just About Rails
 
I18nize Scala programs à la gettext
I18nize Scala programs à la gettextI18nize Scala programs à la gettext
I18nize Scala programs à la gettext
 
Byte code engineering 21st May Saturday 2016
Byte code engineering   21st May Saturday 2016Byte code engineering   21st May Saturday 2016
Byte code engineering 21st May Saturday 2016
 

Destacado

B2 b marketing agency
B2 b marketing agencyB2 b marketing agency
B2 b marketing agencySMEsOnline
 
Presentation For 572
Presentation For 572Presentation For 572
Presentation For 572lnettels
 
You should brew your own beer
You should brew your own beerYou should brew your own beer
You should brew your own beerSigafoos
 
Volume 3 issue 4 - fall 2011
Volume 3   issue 4 - fall 2011Volume 3   issue 4 - fall 2011
Volume 3 issue 4 - fall 2011NJCRI
 
Ultrasound technician courses
Ultrasound technician coursesUltrasound technician courses
Ultrasound technician coursesultrasc2011
 
אתגר 62 יום לשינוי מערכת היחסים עם האוכל ועם עצמך - 7 תרגילים
אתגר 62 יום לשינוי מערכת היחסים עם האוכל ועם עצמך - 7 תרגיליםאתגר 62 יום לשינוי מערכת היחסים עם האוכל ועם עצמך - 7 תרגילים
אתגר 62 יום לשינוי מערכת היחסים עם האוכל ועם עצמך - 7 תרגיליםאורנה צפריר
 
Osher lifelong learning institute
Osher lifelong learning instituteOsher lifelong learning institute
Osher lifelong learning institutekbyrd1962
 
Saints Sponsor Proposal
Saints Sponsor ProposalSaints Sponsor Proposal
Saints Sponsor Proposalgrantcullen
 
Advanced Social Networking
Advanced Social NetworkingAdvanced Social Networking
Advanced Social NetworkingJessica Levin
 
Hbitosdeestudio 100713121008-phpapp02
Hbitosdeestudio 100713121008-phpapp02Hbitosdeestudio 100713121008-phpapp02
Hbitosdeestudio 100713121008-phpapp02Ernesto Fernandez
 
Twitter for Media Pros Panel
Twitter for Media Pros PanelTwitter for Media Pros Panel
Twitter for Media Pros PanelShawn Graham
 
Trucos del movil
Trucos del movilTrucos del movil
Trucos del moviltodocurioso
 
Intro To Travel Lake Tahoe
Intro To Travel Lake TahoeIntro To Travel Lake Tahoe
Intro To Travel Lake TahoeCory Plough
 
Medienprojekt: Plenum (Einführung) WiSe 2014/15
Medienprojekt: Plenum (Einführung) WiSe 2014/15Medienprojekt: Plenum (Einführung) WiSe 2014/15
Medienprojekt: Plenum (Einführung) WiSe 2014/15Martin Rehm
 

Destacado (20)

Festival of Marketing
Festival of MarketingFestival of Marketing
Festival of Marketing
 
1rubias
1rubias1rubias
1rubias
 
B2 b marketing agency
B2 b marketing agencyB2 b marketing agency
B2 b marketing agency
 
Presentation For 572
Presentation For 572Presentation For 572
Presentation For 572
 
You should brew your own beer
You should brew your own beerYou should brew your own beer
You should brew your own beer
 
Volume 3 issue 4 - fall 2011
Volume 3   issue 4 - fall 2011Volume 3   issue 4 - fall 2011
Volume 3 issue 4 - fall 2011
 
Las redes sociales & moodle
Las redes sociales & moodleLas redes sociales & moodle
Las redes sociales & moodle
 
Con un-boli-bic
Con un-boli-bicCon un-boli-bic
Con un-boli-bic
 
Ultrasound technician courses
Ultrasound technician coursesUltrasound technician courses
Ultrasound technician courses
 
אתגר 62 יום לשינוי מערכת היחסים עם האוכל ועם עצמך - 7 תרגילים
אתגר 62 יום לשינוי מערכת היחסים עם האוכל ועם עצמך - 7 תרגיליםאתגר 62 יום לשינוי מערכת היחסים עם האוכל ועם עצמך - 7 תרגילים
אתגר 62 יום לשינוי מערכת היחסים עם האוכל ועם עצמך - 7 תרגילים
 
Osher lifelong learning institute
Osher lifelong learning instituteOsher lifelong learning institute
Osher lifelong learning institute
 
Saints Sponsor Proposal
Saints Sponsor ProposalSaints Sponsor Proposal
Saints Sponsor Proposal
 
Advanced Social Networking
Advanced Social NetworkingAdvanced Social Networking
Advanced Social Networking
 
Hbitosdeestudio 100713121008-phpapp02
Hbitosdeestudio 100713121008-phpapp02Hbitosdeestudio 100713121008-phpapp02
Hbitosdeestudio 100713121008-phpapp02
 
PERIFÉRICOS MIXTOS
PERIFÉRICOS MIXTOSPERIFÉRICOS MIXTOS
PERIFÉRICOS MIXTOS
 
Twitter for Media Pros Panel
Twitter for Media Pros PanelTwitter for Media Pros Panel
Twitter for Media Pros Panel
 
Presentación
PresentaciónPresentación
Presentación
 
Trucos del movil
Trucos del movilTrucos del movil
Trucos del movil
 
Intro To Travel Lake Tahoe
Intro To Travel Lake TahoeIntro To Travel Lake Tahoe
Intro To Travel Lake Tahoe
 
Medienprojekt: Plenum (Einführung) WiSe 2014/15
Medienprojekt: Plenum (Einführung) WiSe 2014/15Medienprojekt: Plenum (Einführung) WiSe 2014/15
Medienprojekt: Plenum (Einführung) WiSe 2014/15
 

Similar a Rango

JRuby, Ruby, Rails and You on the Cloud
JRuby, Ruby, Rails and You on the CloudJRuby, Ruby, Rails and You on the Cloud
JRuby, Ruby, Rails and You on the CloudHiro Asari
 
Getting Started with Rails on GlassFish (Hands-on Lab) - Spark IT 2010
Getting Started with Rails on GlassFish (Hands-on Lab) - Spark IT 2010Getting Started with Rails on GlassFish (Hands-on Lab) - Spark IT 2010
Getting Started with Rails on GlassFish (Hands-on Lab) - Spark IT 2010Arun Gupta
 
Java script nirvana in netbeans [con5679]
Java script nirvana in netbeans [con5679]Java script nirvana in netbeans [con5679]
Java script nirvana in netbeans [con5679]Ryan Cuprak
 
JBoss, Rails and the cloud
JBoss, Rails and the cloudJBoss, Rails and the cloud
JBoss, Rails and the cloudelliando dias
 
Behavioural Testing Ruby/Rails Apps @ Scale - Rspec & Cucumber
       Behavioural Testing Ruby/Rails Apps @ Scale - Rspec & Cucumber       Behavioural Testing Ruby/Rails Apps @ Scale - Rspec & Cucumber
Behavioural Testing Ruby/Rails Apps @ Scale - Rspec & CucumberUdaya Kiran
 
React on rails v6.1 at LA Ruby, November 2016
React on rails v6.1 at LA Ruby, November 2016React on rails v6.1 at LA Ruby, November 2016
React on rails v6.1 at LA Ruby, November 2016Justin Gordon
 
Reconciling ReactJS as a View Layer Replacement (MidwestJS 2014)
Reconciling ReactJS as a View Layer Replacement (MidwestJS 2014)Reconciling ReactJS as a View Layer Replacement (MidwestJS 2014)
Reconciling ReactJS as a View Layer Replacement (MidwestJS 2014)Zach Lendon
 
MidwestJS 2014 Reconciling ReactJS as a View Layer Replacement
MidwestJS 2014 Reconciling ReactJS as a View Layer ReplacementMidwestJS 2014 Reconciling ReactJS as a View Layer Replacement
MidwestJS 2014 Reconciling ReactJS as a View Layer ReplacementZach Lendon
 
Killing the Angle Bracket
Killing the Angle BracketKilling the Angle Bracket
Killing the Angle Bracketjnewmanux
 
Gwt and rpc use 2007 1
Gwt and rpc use 2007 1Gwt and rpc use 2007 1
Gwt and rpc use 2007 1Sam Muhanguzi
 
Node.js Development with Apache NetBeans
Node.js Development with Apache NetBeansNode.js Development with Apache NetBeans
Node.js Development with Apache NetBeansRyan Cuprak
 
What’s expected in Java 9
What’s expected in Java 9What’s expected in Java 9
What’s expected in Java 9Gal Marder
 
CouchDB for Web Applications - Erlang Factory London 2009
CouchDB for Web Applications - Erlang Factory London 2009CouchDB for Web Applications - Erlang Factory London 2009
CouchDB for Web Applications - Erlang Factory London 2009Jason Davies
 
Isomorphic JavaScript with Node, WebPack, and React
Isomorphic JavaScript with Node, WebPack, and ReactIsomorphic JavaScript with Node, WebPack, and React
Isomorphic JavaScript with Node, WebPack, and ReactTyler Peterson
 
NodeJS - Server Side JS
NodeJS - Server Side JS NodeJS - Server Side JS
NodeJS - Server Side JS Ganesh Kondal
 

Similar a Rango (20)

Rango
RangoRango
Rango
 
Upgrading to rails3
Upgrading to rails3Upgrading to rails3
Upgrading to rails3
 
JRuby, Ruby, Rails and You on the Cloud
JRuby, Ruby, Rails and You on the CloudJRuby, Ruby, Rails and You on the Cloud
JRuby, Ruby, Rails and You on the Cloud
 
Getting Started with Rails on GlassFish (Hands-on Lab) - Spark IT 2010
Getting Started with Rails on GlassFish (Hands-on Lab) - Spark IT 2010Getting Started with Rails on GlassFish (Hands-on Lab) - Spark IT 2010
Getting Started with Rails on GlassFish (Hands-on Lab) - Spark IT 2010
 
Java script nirvana in netbeans [con5679]
Java script nirvana in netbeans [con5679]Java script nirvana in netbeans [con5679]
Java script nirvana in netbeans [con5679]
 
JBoss, Rails and the cloud
JBoss, Rails and the cloudJBoss, Rails and the cloud
JBoss, Rails and the cloud
 
Day 8 - jRuby
Day 8 - jRubyDay 8 - jRuby
Day 8 - jRuby
 
Behavioural Testing Ruby/Rails Apps @ Scale - Rspec & Cucumber
       Behavioural Testing Ruby/Rails Apps @ Scale - Rspec & Cucumber       Behavioural Testing Ruby/Rails Apps @ Scale - Rspec & Cucumber
Behavioural Testing Ruby/Rails Apps @ Scale - Rspec & Cucumber
 
React on rails v6.1 at LA Ruby, November 2016
React on rails v6.1 at LA Ruby, November 2016React on rails v6.1 at LA Ruby, November 2016
React on rails v6.1 at LA Ruby, November 2016
 
Reconciling ReactJS as a View Layer Replacement (MidwestJS 2014)
Reconciling ReactJS as a View Layer Replacement (MidwestJS 2014)Reconciling ReactJS as a View Layer Replacement (MidwestJS 2014)
Reconciling ReactJS as a View Layer Replacement (MidwestJS 2014)
 
MidwestJS 2014 Reconciling ReactJS as a View Layer Replacement
MidwestJS 2014 Reconciling ReactJS as a View Layer ReplacementMidwestJS 2014 Reconciling ReactJS as a View Layer Replacement
MidwestJS 2014 Reconciling ReactJS as a View Layer Replacement
 
Killing the Angle Bracket
Killing the Angle BracketKilling the Angle Bracket
Killing the Angle Bracket
 
How DSL works on Ruby
How DSL works on RubyHow DSL works on Ruby
How DSL works on Ruby
 
React on rails v4
React on rails v4React on rails v4
React on rails v4
 
Gwt and rpc use 2007 1
Gwt and rpc use 2007 1Gwt and rpc use 2007 1
Gwt and rpc use 2007 1
 
Node.js Development with Apache NetBeans
Node.js Development with Apache NetBeansNode.js Development with Apache NetBeans
Node.js Development with Apache NetBeans
 
What’s expected in Java 9
What’s expected in Java 9What’s expected in Java 9
What’s expected in Java 9
 
CouchDB for Web Applications - Erlang Factory London 2009
CouchDB for Web Applications - Erlang Factory London 2009CouchDB for Web Applications - Erlang Factory London 2009
CouchDB for Web Applications - Erlang Factory London 2009
 
Isomorphic JavaScript with Node, WebPack, and React
Isomorphic JavaScript with Node, WebPack, and ReactIsomorphic JavaScript with Node, WebPack, and React
Isomorphic JavaScript with Node, WebPack, and React
 
NodeJS - Server Side JS
NodeJS - Server Side JS NodeJS - Server Side JS
NodeJS - Server Side JS
 

Último

Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Scott Andery
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditSkynet Technologies
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...panagenda
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 

Último (20)

Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance Audit
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 

Rango

  • 1. Introduction to Rango Jakub Stastny aka @botanicus
  • 2. About me • Ruby & JavaScript developer. • Currently based in London. • Working as a freelancer. • botanicus.github.com
  • 3. What is Rango? • Rack-based light-weight web framework. • As agnostic and flexible as possible. • Ruby 1.9 only. • Provides generators, but doesn’t insist on any certain structure. • Inspired by Django & Merb.
  • 4. • Django terminology: View is called template and view means an action in controller. • You can use just whichever subset of Rango you want and it will work. • No strict conventions, just recommendations, often use hooks or strategies.
  • 5. Boot Process • Script init.rb should setup environment. • Work as a runner: ./init.rb myscript.rb • And as a console: ./init.rb -i • Or both altogether: ./init.rb -i myscript.rb • Start web server: ./config.ru • Rewrite arguments: ./config.ru -s thin
  • 6. Routers • Every router based on Rack (via env [“rango.router.params”]). • Rango::UrlHelper for url(:post, id)
  • 7. Rendering • You don’t need controllers for it:
  • 9. • The most low-level rendering layer. • Template will be evaluated in context of the third argument which defaults to Object.new. • post is defined as a local variable.
  • 11. • Template will be evaluated in context of self.scope which you can redefine. • Data from self.context hash will be available as local variables. • Context defaults to {request: self.request}.
  • 13. • Standard Rails-like rendering. • Template will be evaluated in context of self, so you can use. • Methods as self.request or instance variables as @post are evaluated on self directly, no context required.
  • 14. Template Inheritance • Much more flexible and cleaner than layout/ view, no hacking around with content_for and a bunch of partials. • Just an inheritance: (admin/posts.html => admin/ base.html => base.html). • The only implementation in Ruby(?) • Haml-only, because there's no such thing as <%= method(&block) %> in Erb. • I recently extracted it to template-inheritance gem (see my GitHub).
  • 15. Basic Example #8 Default value for block • render “index.html” • extends “base.html” will parse base.html and replace its blocks by blocks in index.html
  • 16. Returning values • Block can return whichever value via arguments. • Block returns captured string from &block.
  • 17. AJAX
  • 18. • It will render normal page with layout if the request isn’t AJAX. • If request is AJAX it will just render index.html. Haml render everything starting with =, it will render content block which we can use for updating part of site via JS.
  • 19. GenericViews (GV) • Borrowed from Django. • Just a reusable Rack apps. • Can extend router (redirect, defer). • Just render template Rango::GV.static.
  • 20. GV: Router Extensions • Deferred routes: check request and decide where to route (different actions for desktop/mobile, for registered/unregistered users etc). • Rango::GV.redirect may be useful if your router doesn’t support it.
  • 21.
  • 22.
  • 23. HTTP Errors Handling • Based on exceptions inherited from Rango::HttpError. • Error404 resp. NotFound. • Has status, content_type and headers.
  • 27. Other useful tools • Pupu: package manager for assets from GitHub (pupu install mootools). • Formidable: because helpers is welcome-back- to-PHP-mess. Again inspired by Django. Includes validations (server-side & HTML 5), coercions etc. • Git-deployer let you deploy via Git (git push staging-server staging-branch). Similar as what Heroku use, but this is more generic and you can use it with your own server.
  • 28.
  • 29.
  • 30.
  • 31. Links • Wiki: http://wiki.github.com/botanicus/rango • Issues: http://github.com/botanicus/rango/issues • Twitter: http://twitter.com/RangoProject • http://groups.google.com/group/rango-project • http://github.com/botanicus/ruby-manor-rango
  • 32. Thank you for your attention!