Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Hobbit (English)
Search
Krzysztof Wawer
July 23, 2014
590
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
680
GIT - Good Practices
wafcio
0
110
Slim Ruby on Rails: Controllers & Middlewares
wafcio
1
230
Dry System
wafcio
0
130
dry-validations
wafcio
0
200
Validations in Ruby
wafcio
0
210
Generating a CSV file with ROM
wafcio
0
380
Trailblazer bez trailblazera
wafcio
0
270
ActiveRecord, DataMapper czy Agregacja encji
wafcio
0
230
Featured
See All Featured
Git: the NoSQL Database
bkeepers
PRO
432
67k
Into the Great Unknown - MozCon
thekraken
41
2.7k
Bash Introduction
62gerente
615
220k
KATA
mclloyd
PRO
35
15k
Why Our Code Smells
bkeepers
PRO
340
58k
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.4k
The untapped power of vector embeddings
frankvandijk
2
1.9k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.4k
The Pragmatic Product Professional
lauravandoore
37
7.4k
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.5k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
330
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
31k
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 ???