SlideShare une entreprise Scribd logo
1  sur  17
Télécharger pour lire hors ligne
A story about Gemified Engines
A 45-minute introduction to Engines
FYI
A few essential concepts
A few essential concepts
○ A Ruby Gem is a container for reusable
Ruby code.
○ A Rails Gem is a Ruby Gem that depends
on Rails.
○ To "gemify" something, is to create a Gem
out of a piece of isolated Ruby code.
Enlighten me!
Quick intro to Railties & Engines
Quick intro to Railties & Engines
○ Since version 3, Rails major components
are built on top of a core class called
Railtie.
○ Thus, all (new and old) components based
on this class were dubbed "Railties".
○ This class "provides several hooks to
extend Rails and/or modify the
initialization process".1
[1] Taken from http://api.rubyonrails.org/classes/Rails/Railtie.html
Quick intro to Railties & Engines
○ Railties are responsible for their own
initialization/configuration process, making
Rails core's independent from them -sort
of a "plug & play" standard.
○ Obviously, we can create our own Railties
and extend our application, much like any
Rails Gem we know does.
Quick intro to Railties & Engines
○ Read more about Railties:
○ Rails::Railtie - Ruby On Rails API Online
http://api.rubyonrails.org/classes/Rails/Railtie.html
Quick intro to Railties & Engines
○ An Engine is a Railtie.
○ Hence, an Engine can do all that that a
Railtie can do, and more.
○ Internally, Engine inherits from Railtie, as
you imagined.
Quick intro to Railties & Engines
○ Engines are self-contained Rails
applications.
○ Any Rails ~> 3 application is an Engine.
○ Engines you plug into your application
integrate seamlessly adding their
controllers, models, views, routes, etc. as if
they were part of the whole thing.
○ They can also be isolated (namespaced) to
avoid conflicts with the main application.
And...?
Deeper into Engines
Deeper into Engines
○ Engines are the way to extend any Rails 3
application by default.
○ They can be thought of as Plugins (sort of).
○ In fact, the Rails default generator for
Engines is: rails plugin new <name> --
<type>.
○ Type can be full or mountable.
Deeper into Engines
○ Mountable Engines
○ Namespace isolated by default.
○ Meaning: no name-clash conflicts with the "host"
application.
○ All your controllers, models and routes get
isolated inside the namespace.
○ The routes namespace name is defined when
mounting the Engine routes in the routes.rb file.
○ This is a conservative approach.
Deeper into Engines
○ Full Engines
○ No namespace isolation; everything you put in it
will become available to the host application "as
is".
○ Useful if you're adding functionality to existing
resources.
○ Because routes are also not isolated, you should
take special care when defining them.
○ Could blow up everything if you use common
names for classes. Watch out!
Deeper into Engines
○ Read more about Engines:
○ Rails::Engine - Ruby On Rails API Online
http://api.rubyonrails.org/classes/Rails/Engine.html
○ Try yourself building an Engine - Ruby on Rails
Guides
http://guides.rubyonrails.org/engines.html
Last but not least
"Gemify" your Engine
Gemify your Engine
○ Check you have correctly defined your .
gemspec file.
○ Run gem build <name>.gemspec.
○ Then install it with gem install .
/<name>.gem.
○ You can add it to Bundler's Gemfile
passing a :path key in your options hash.
○ And, well, that's pretty much everything I
wanted to cover here.
Thank you for your time!
2013

Contenu connexe

En vedette

Modal verbs
Modal verbsModal verbs
Modal verbsmariamug
 
ΕΝΑ ΓΛΥΠΤΟ ΤΗΣ ΑΙΝΟΥ ΔΙΗΓΕΙΤΑΙ ΤΗΝ ΙΣΤΟΡΙΑ ΤΟΥ
ΕΝΑ ΓΛΥΠΤΟ ΤΗΣ ΑΙΝΟΥ ΔΙΗΓΕΙΤΑΙ ΤΗΝ ΙΣΤΟΡΙΑ ΤΟΥΕΝΑ ΓΛΥΠΤΟ ΤΗΣ ΑΙΝΟΥ ΔΙΗΓΕΙΤΑΙ ΤΗΝ ΙΣΤΟΡΙΑ ΤΟΥ
ΕΝΑ ΓΛΥΠΤΟ ΤΗΣ ΑΙΝΟΥ ΔΙΗΓΕΙΤΑΙ ΤΗΝ ΙΣΤΟΡΙΑ ΤΟΥMZaxou
 
παρουσιαση προγραμματος 2014
παρουσιαση προγραμματος 2014παρουσιαση προγραμματος 2014
παρουσιαση προγραμματος 2014MZaxou
 
"Η ΑΝΤΑΛΛΑΓΗ των ΠΛΗΘΥΣΜΩΝ μετά τη ΣΥΝΘΗΚΗ της ΛΟΖΑΝΗΣ. Η ΜΟΙΡΑ του ΠΡΟΣΦΥΓΑ"
"Η ΑΝΤΑΛΛΑΓΗ των ΠΛΗΘΥΣΜΩΝ μετά τη ΣΥΝΘΗΚΗ της ΛΟΖΑΝΗΣ. Η ΜΟΙΡΑ του ΠΡΟΣΦΥΓΑ""Η ΑΝΤΑΛΛΑΓΗ των ΠΛΗΘΥΣΜΩΝ μετά τη ΣΥΝΘΗΚΗ της ΛΟΖΑΝΗΣ. Η ΜΟΙΡΑ του ΠΡΟΣΦΥΓΑ"
"Η ΑΝΤΑΛΛΑΓΗ των ΠΛΗΘΥΣΜΩΝ μετά τη ΣΥΝΘΗΚΗ της ΛΟΖΑΝΗΣ. Η ΜΟΙΡΑ του ΠΡΟΣΦΥΓΑ"MZaxou
 
ΚΩΝΣΤΑΝΤΙΝΟΥΠΟΛΗ - ΠΑΡΕΛΘΟΝ/ΠΑΡΟΝ
ΚΩΝΣΤΑΝΤΙΝΟΥΠΟΛΗ - ΠΑΡΕΛΘΟΝ/ΠΑΡΟΝΚΩΝΣΤΑΝΤΙΝΟΥΠΟΛΗ - ΠΑΡΕΛΘΟΝ/ΠΑΡΟΝ
ΚΩΝΣΤΑΝΤΙΝΟΥΠΟΛΗ - ΠΑΡΕΛΘΟΝ/ΠΑΡΟΝMZaxou
 
το πολιτιστικο γιγνεσθαι της ισπανιας
το πολιτιστικο γιγνεσθαι της ισπανιαςτο πολιτιστικο γιγνεσθαι της ισπανιας
το πολιτιστικο γιγνεσθαι της ισπανιαςMZaxou
 
βιωματικη α3
βιωματικη α3βιωματικη α3
βιωματικη α3MZaxou
 
RSpec 3: The new, the old, the good
RSpec 3: The new, the old, the goodRSpec 3: The new, the old, the good
RSpec 3: The new, the old, the goodmglrnm
 
Recruitment
RecruitmentRecruitment
RecruitmentSean Ray
 
DIDÁCTICA CRÍTICA
DIDÁCTICA CRÍTICA DIDÁCTICA CRÍTICA
DIDÁCTICA CRÍTICA Diana Barco
 

En vedette (11)

Magaly
MagalyMagaly
Magaly
 
Modal verbs
Modal verbsModal verbs
Modal verbs
 
ΕΝΑ ΓΛΥΠΤΟ ΤΗΣ ΑΙΝΟΥ ΔΙΗΓΕΙΤΑΙ ΤΗΝ ΙΣΤΟΡΙΑ ΤΟΥ
ΕΝΑ ΓΛΥΠΤΟ ΤΗΣ ΑΙΝΟΥ ΔΙΗΓΕΙΤΑΙ ΤΗΝ ΙΣΤΟΡΙΑ ΤΟΥΕΝΑ ΓΛΥΠΤΟ ΤΗΣ ΑΙΝΟΥ ΔΙΗΓΕΙΤΑΙ ΤΗΝ ΙΣΤΟΡΙΑ ΤΟΥ
ΕΝΑ ΓΛΥΠΤΟ ΤΗΣ ΑΙΝΟΥ ΔΙΗΓΕΙΤΑΙ ΤΗΝ ΙΣΤΟΡΙΑ ΤΟΥ
 
παρουσιαση προγραμματος 2014
παρουσιαση προγραμματος 2014παρουσιαση προγραμματος 2014
παρουσιαση προγραμματος 2014
 
"Η ΑΝΤΑΛΛΑΓΗ των ΠΛΗΘΥΣΜΩΝ μετά τη ΣΥΝΘΗΚΗ της ΛΟΖΑΝΗΣ. Η ΜΟΙΡΑ του ΠΡΟΣΦΥΓΑ"
"Η ΑΝΤΑΛΛΑΓΗ των ΠΛΗΘΥΣΜΩΝ μετά τη ΣΥΝΘΗΚΗ της ΛΟΖΑΝΗΣ. Η ΜΟΙΡΑ του ΠΡΟΣΦΥΓΑ""Η ΑΝΤΑΛΛΑΓΗ των ΠΛΗΘΥΣΜΩΝ μετά τη ΣΥΝΘΗΚΗ της ΛΟΖΑΝΗΣ. Η ΜΟΙΡΑ του ΠΡΟΣΦΥΓΑ"
"Η ΑΝΤΑΛΛΑΓΗ των ΠΛΗΘΥΣΜΩΝ μετά τη ΣΥΝΘΗΚΗ της ΛΟΖΑΝΗΣ. Η ΜΟΙΡΑ του ΠΡΟΣΦΥΓΑ"
 
ΚΩΝΣΤΑΝΤΙΝΟΥΠΟΛΗ - ΠΑΡΕΛΘΟΝ/ΠΑΡΟΝ
ΚΩΝΣΤΑΝΤΙΝΟΥΠΟΛΗ - ΠΑΡΕΛΘΟΝ/ΠΑΡΟΝΚΩΝΣΤΑΝΤΙΝΟΥΠΟΛΗ - ΠΑΡΕΛΘΟΝ/ΠΑΡΟΝ
ΚΩΝΣΤΑΝΤΙΝΟΥΠΟΛΗ - ΠΑΡΕΛΘΟΝ/ΠΑΡΟΝ
 
το πολιτιστικο γιγνεσθαι της ισπανιας
το πολιτιστικο γιγνεσθαι της ισπανιαςτο πολιτιστικο γιγνεσθαι της ισπανιας
το πολιτιστικο γιγνεσθαι της ισπανιας
 
βιωματικη α3
βιωματικη α3βιωματικη α3
βιωματικη α3
 
RSpec 3: The new, the old, the good
RSpec 3: The new, the old, the goodRSpec 3: The new, the old, the good
RSpec 3: The new, the old, the good
 
Recruitment
RecruitmentRecruitment
Recruitment
 
DIDÁCTICA CRÍTICA
DIDÁCTICA CRÍTICA DIDÁCTICA CRÍTICA
DIDÁCTICA CRÍTICA
 

Similaire à A story about gemified engines

How to set up and test a Rails 3 Engine
How to set up and test a Rails 3 EngineHow to set up and test a Rails 3 Engine
How to set up and test a Rails 3 Enginenicholasf
 
Revised Rails Engine Patterns for Montreal.rb meetup Oct 16, 2012
Revised Rails Engine Patterns for Montreal.rb meetup Oct 16, 2012Revised Rails Engine Patterns for Montreal.rb meetup Oct 16, 2012
Revised Rails Engine Patterns for Montreal.rb meetup Oct 16, 2012Andy Maleh
 
West Yorkshire Mulesoft Meetup #6
West Yorkshire Mulesoft Meetup #6West Yorkshire Mulesoft Meetup #6
West Yorkshire Mulesoft Meetup #6Francis Edwards
 
Content Management That Won't Rot Your Brain
Content Management That Won't Rot Your BrainContent Management That Won't Rot Your Brain
Content Management That Won't Rot Your BrainSean Cribbs
 
Building a Custom Theme in Drupal 8
Building a Custom Theme in Drupal 8Building a Custom Theme in Drupal 8
Building a Custom Theme in Drupal 8Anne Tomasevich
 
Beyond rails new
Beyond rails newBeyond rails new
Beyond rails newPaul Oguda
 
Building Application with Ruby On Rails Framework
Building Application with Ruby On Rails FrameworkBuilding Application with Ruby On Rails Framework
Building Application with Ruby On Rails FrameworkEdureka!
 
Mythical Mysfits: Monolith to Microservice with Docker and AWS Fargate (CON21...
Mythical Mysfits: Monolith to Microservice with Docker and AWS Fargate (CON21...Mythical Mysfits: Monolith to Microservice with Docker and AWS Fargate (CON21...
Mythical Mysfits: Monolith to Microservice with Docker and AWS Fargate (CON21...Amazon Web Services
 
Ruby on Rails introduction
Ruby on Rails introduction Ruby on Rails introduction
Ruby on Rails introduction Tran Hung
 
Rails in the bowels
Rails in the bowelsRails in the bowels
Rails in the bowelsCreditas
 
Rails engines in large apps
Rails engines in large appsRails engines in large apps
Rails engines in large appsEnrico Teotti
 
Lightning web components
Lightning web components Lightning web components
Lightning web components Cloud Analogy
 
DiUS Computing Lca Rails Final
DiUS  Computing Lca Rails FinalDiUS  Computing Lca Rails Final
DiUS Computing Lca Rails FinalRobert Postill
 
Building Websites Using ASP.NET Core Razor Pages
Building Websites Using ASP.NET Core Razor PagesBuilding Websites Using ASP.NET Core Razor Pages
Building Websites Using ASP.NET Core Razor Pagesssusere19c741
 
FOSDEM19 MySQL Component Infrastructure
FOSDEM19 MySQL Component InfrastructureFOSDEM19 MySQL Component Infrastructure
FOSDEM19 MySQL Component InfrastructureGeorgi Kodinov
 
MySQL Cluster Asynchronous replication (2014)
MySQL Cluster Asynchronous replication (2014) MySQL Cluster Asynchronous replication (2014)
MySQL Cluster Asynchronous replication (2014) Frazer Clement
 
Onion Architecture with S#arp
Onion Architecture with S#arpOnion Architecture with S#arp
Onion Architecture with S#arpGary Pedretti
 

Similaire à A story about gemified engines (20)

How to set up and test a Rails 3 Engine
How to set up and test a Rails 3 EngineHow to set up and test a Rails 3 Engine
How to set up and test a Rails 3 Engine
 
Carbon and OSGi Deep Dive
Carbon and OSGi Deep DiveCarbon and OSGi Deep Dive
Carbon and OSGi Deep Dive
 
Revised Rails Engine Patterns for Montreal.rb meetup Oct 16, 2012
Revised Rails Engine Patterns for Montreal.rb meetup Oct 16, 2012Revised Rails Engine Patterns for Montreal.rb meetup Oct 16, 2012
Revised Rails Engine Patterns for Montreal.rb meetup Oct 16, 2012
 
Rails Concept
Rails ConceptRails Concept
Rails Concept
 
West Yorkshire Mulesoft Meetup #6
West Yorkshire Mulesoft Meetup #6West Yorkshire Mulesoft Meetup #6
West Yorkshire Mulesoft Meetup #6
 
Content Management That Won't Rot Your Brain
Content Management That Won't Rot Your BrainContent Management That Won't Rot Your Brain
Content Management That Won't Rot Your Brain
 
Building a Custom Theme in Drupal 8
Building a Custom Theme in Drupal 8Building a Custom Theme in Drupal 8
Building a Custom Theme in Drupal 8
 
Beyond rails new
Beyond rails newBeyond rails new
Beyond rails new
 
Building Application with Ruby On Rails Framework
Building Application with Ruby On Rails FrameworkBuilding Application with Ruby On Rails Framework
Building Application with Ruby On Rails Framework
 
Mythical Mysfits: Monolith to Microservice with Docker and AWS Fargate (CON21...
Mythical Mysfits: Monolith to Microservice with Docker and AWS Fargate (CON21...Mythical Mysfits: Monolith to Microservice with Docker and AWS Fargate (CON21...
Mythical Mysfits: Monolith to Microservice with Docker and AWS Fargate (CON21...
 
Ruby on Rails introduction
Ruby on Rails introduction Ruby on Rails introduction
Ruby on Rails introduction
 
Rails in the bowels
Rails in the bowelsRails in the bowels
Rails in the bowels
 
Rails engines in large apps
Rails engines in large appsRails engines in large apps
Rails engines in large apps
 
Lightning web components
Lightning web components Lightning web components
Lightning web components
 
DiUS Computing Lca Rails Final
DiUS  Computing Lca Rails FinalDiUS  Computing Lca Rails Final
DiUS Computing Lca Rails Final
 
Building Websites Using ASP.NET Core Razor Pages
Building Websites Using ASP.NET Core Razor PagesBuilding Websites Using ASP.NET Core Razor Pages
Building Websites Using ASP.NET Core Razor Pages
 
Railties
RailtiesRailties
Railties
 
FOSDEM19 MySQL Component Infrastructure
FOSDEM19 MySQL Component InfrastructureFOSDEM19 MySQL Component Infrastructure
FOSDEM19 MySQL Component Infrastructure
 
MySQL Cluster Asynchronous replication (2014)
MySQL Cluster Asynchronous replication (2014) MySQL Cluster Asynchronous replication (2014)
MySQL Cluster Asynchronous replication (2014)
 
Onion Architecture with S#arp
Onion Architecture with S#arpOnion Architecture with S#arp
Onion Architecture with S#arp
 

Dernier

The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesBoston Institute of Analytics
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 

Dernier (20)

The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 

A story about gemified engines

  • 1. A story about Gemified Engines A 45-minute introduction to Engines
  • 3. A few essential concepts ○ A Ruby Gem is a container for reusable Ruby code. ○ A Rails Gem is a Ruby Gem that depends on Rails. ○ To "gemify" something, is to create a Gem out of a piece of isolated Ruby code.
  • 4. Enlighten me! Quick intro to Railties & Engines
  • 5. Quick intro to Railties & Engines ○ Since version 3, Rails major components are built on top of a core class called Railtie. ○ Thus, all (new and old) components based on this class were dubbed "Railties". ○ This class "provides several hooks to extend Rails and/or modify the initialization process".1 [1] Taken from http://api.rubyonrails.org/classes/Rails/Railtie.html
  • 6. Quick intro to Railties & Engines ○ Railties are responsible for their own initialization/configuration process, making Rails core's independent from them -sort of a "plug & play" standard. ○ Obviously, we can create our own Railties and extend our application, much like any Rails Gem we know does.
  • 7. Quick intro to Railties & Engines ○ Read more about Railties: ○ Rails::Railtie - Ruby On Rails API Online http://api.rubyonrails.org/classes/Rails/Railtie.html
  • 8. Quick intro to Railties & Engines ○ An Engine is a Railtie. ○ Hence, an Engine can do all that that a Railtie can do, and more. ○ Internally, Engine inherits from Railtie, as you imagined.
  • 9. Quick intro to Railties & Engines ○ Engines are self-contained Rails applications. ○ Any Rails ~> 3 application is an Engine. ○ Engines you plug into your application integrate seamlessly adding their controllers, models, views, routes, etc. as if they were part of the whole thing. ○ They can also be isolated (namespaced) to avoid conflicts with the main application.
  • 11. Deeper into Engines ○ Engines are the way to extend any Rails 3 application by default. ○ They can be thought of as Plugins (sort of). ○ In fact, the Rails default generator for Engines is: rails plugin new <name> -- <type>. ○ Type can be full or mountable.
  • 12. Deeper into Engines ○ Mountable Engines ○ Namespace isolated by default. ○ Meaning: no name-clash conflicts with the "host" application. ○ All your controllers, models and routes get isolated inside the namespace. ○ The routes namespace name is defined when mounting the Engine routes in the routes.rb file. ○ This is a conservative approach.
  • 13. Deeper into Engines ○ Full Engines ○ No namespace isolation; everything you put in it will become available to the host application "as is". ○ Useful if you're adding functionality to existing resources. ○ Because routes are also not isolated, you should take special care when defining them. ○ Could blow up everything if you use common names for classes. Watch out!
  • 14. Deeper into Engines ○ Read more about Engines: ○ Rails::Engine - Ruby On Rails API Online http://api.rubyonrails.org/classes/Rails/Engine.html ○ Try yourself building an Engine - Ruby on Rails Guides http://guides.rubyonrails.org/engines.html
  • 15. Last but not least "Gemify" your Engine
  • 16. Gemify your Engine ○ Check you have correctly defined your . gemspec file. ○ Run gem build <name>.gemspec. ○ Then install it with gem install . /<name>.gem. ○ You can add it to Bundler's Gemfile passing a :path key in your options hash. ○ And, well, that's pretty much everything I wanted to cover here.
  • 17. Thank you for your time! 2013