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
Being A Developer After 40
akosma
91
590k
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
270
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.7k
How GitHub (no longer) Works
holman
316
150k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.9k
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
330
Context Engineering - Making Every Token Count
addyosmani
9
970
A Soul's Torment
seathinner
6
2.9k
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
230
GraphQLの誤解/rethinking-graphql
sonatard
75
12k
30 Presentation Tips
portentint
PRO
1
330
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 ???