Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Hobbit (English)
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Krzysztof Wawer
July 23, 2014
570
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Hobbit (English)
Prese
Krzysztof Wawer
July 23, 2014
More Decks by Krzysztof Wawer
See All by Krzysztof Wawer
The Good Architecture
wafcio
0
670
GIT - Good Practices
wafcio
0
110
Slim Ruby on Rails: Controllers & Middlewares
wafcio
1
210
Dry System
wafcio
0
120
dry-validations
wafcio
0
200
Validations in Ruby
wafcio
0
200
Generating a CSV file with ROM
wafcio
0
370
Trailblazer bez trailblazera
wafcio
0
260
ActiveRecord, DataMapper czy Agregacja encji
wafcio
0
210
Featured
See All Featured
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
230
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
300
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
The Limits of Empathy - UXLibs8
cassininazir
1
360
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
370
Testing 201, or: Great Expectations
jmmastey
46
8.2k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Paper Plane
katiecoart
PRO
1
51k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
Google's AI Overviews - The New Search
badams
0
1k
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
310
HTML-Aware ERB: The Path to Reactive Rendering @ RubyCon 2026, Rimini, Italy
marcoroth
1
200
Transcript
Building web application in Ruby Hobbit
About me Christopher Wawer!
[email protected]
! Github: wafcio! ! Neubloc Poland
Ruby on Rails Web Server Ruby on Rails Our application
Ruby on Rails Web Server Ruby on Rails Our application
Rack
Ruby on Rails - zależności rails actionmailer (4.1.4 - 62
112 B) mail actionpack (4.1.4 - 651 917 B) AbstractController, ActionController, ActionDispatch rack rack-test actionview (4.1.4 - 624 372 B) builder erubis activemodel (4.1.4 - 159 322 B) builder activerecord (4.1.4 - 1 143 044 B) arel ! activesupport (4.1.4 - 1 475 624 B) cache, core_ext, json, multibyte, notification, number conversions i18n jon minitest thread_safe tzinfo bundler railties (4.1.4 - 368 897 B) rake thor sprockets-rails SUM 4 485 298 B ~ 4,28 MB
Ruby on Rails Convention over Configuration! ! Creator => Performer
Ruby on Rails ??? Do we really understand RoR source
code ?
Ruby on Rails ??? Can we use RoR in optimal
way ?
Ruby on Rails ??? Maybe something we don’t like in
RoR ?
Ruby off Rails Web Server Ruby on Rails Our application
Rack
Ruby off Rails Micro Libraries! Piotr Solnica: https://www.youtube.com/ watch?v=urUEB8Kz6jY! Use
only what you need! Better performance
Rack Rack Web Serwer Our application https://github.com/rack/rack
Rack Application require 'rack' ! class HelloWorld def call(env) [200,
{'Content-Type' => 'text/plain'}, 'Hello World!'] end end ! run HelloWorld.new
Rack Rack Web Server Our application https://github.com/rack/rack Lightweight framework
Some frameworks Brooklyn, Cuba, Hobbit, Lotus, Nancy, NYNY, Mustermann, Ramaze,
Rambutan, Scorched, Sinatra! https://github.com/luislavena/bench-micro! ! Cuba, Hobbit, Jellyfish, Sinatra, Substation, Subway! http://microrb.com/#framework!
Hobbit Patricio Mac Adden
[email protected]
Github: patriciomacadden ! First commit:
11 IV 2013
Hobbit first name: bonsai, but … ! must be fast
very simple, only routes extendable no configuration ! http://www.sitepoint.com/ruby-microframeworks-round/
hobbit - source https://github.com/patriciomacadden/hobbit v0.6.0, 12 VI 2014 - 9
239 B ~ 9,02 KB hobbit.rb - 4 lines hobbit/base.rb - 93 lines hobbit/request.rb - 10 lines hobbit/response.rb - 40 lines Sum: 147 lines
Hello World require 'hobbit' ! class HelloWorld < Hobbit::Base get
'/' do 'Hello World!' end end ! run HelloWorld.new
hobbit-contrib - source https://github.com/patriciomacadden/hobbit-contrib v0.7.0, 10 VII 2014 - 5
280 B ~ 5,16 KB hobbit/contrib.rb - 13 lines hobbit/environment.rb - 15 lines hobbit/error_handling.rb - 27 lines hobbit/filter.rb - 73 lines hobbit/mote.rb - 42 lines hobbit/render.rb - 55 lines hobbit/session.rb - 7 lines Sum: 232 lines
hobbit-contrib - source https://github.com/patriciomacadden/hobbit-contrib environment.rb - development?, production? error_handling.rb -
catch exceptions filter.rb - after, before mote.rb - render views with Mote render.rb - render views with Tilt session.rb - easy access to session
HTML view require 'hobbit' require 'hobbit/render' require 'tilt/haml' ! class
HelloWorld < Hobbit::Base def template_engine 'haml' end ! get '/' do render 'index', {}, layout: false end end ! run HelloWorld.new
When something missing ? Rack gems Sinatra gems activesupport ???
Hobbit - attacks no protection against web attacks use: https://github.com/rkh/rack-protection
Cross Site Request Forgery Cross Site Scripting Clickjacking Directory Traversal Session Hijacking IP Spoofing
Hobbit Application Template https://github.com/patriciomacadden/hat i18n tilt sprockets better_errors rake rack-test,
minitest
Asset precompilation require 'rake/sprocketstask' require 'uglifier' ! Rake::SprocketsTask.new do |t|
environment = Sprockets::Environment.new environment.append_path(…) environment.js_compressor = :uglify environment.css_compressor = :scss ! t.environment = environment t.manifest = Sprockets::Manifest.new(environment, "public/assets/manifest.json") ! t.output = 'public/assets' t.assets = %w(application.js application.css) end rake assets # Compile assets ! rake clean_assets # Clean old assets ! rake clobber_assets # Remove all assembler
Sample application Based on https://github.com/ryant523/blog haml sass rake sequel pony
Thank you Questions ???