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
Building Extensions - best practises
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Peter Berkenbosch
February 27, 2014
59
0
Share
Building Extensions - best practises
SpreeConf 2014 Lightning talk.
Peter Berkenbosch
February 27, 2014
More Decks by Peter Berkenbosch
See All by Peter Berkenbosch
Open source contribution with Spree
pberkenbosch
1
210
Spree Commerce hub for developers
pberkenbosch
0
180
Behavior Driven Development, an introduction
pberkenbosch
1
52
TDD Spree
pberkenbosch
5
460
Twente RB Spree from the trenches
pberkenbosch
0
55
GroningenRB Spree from the trenches
pberkenbosch
0
120
Spree from the Trenches
pberkenbosch
3
330
[dutch] Behavior Driven Development
pberkenbosch
1
76
BDD Outside in development
pberkenbosch
1
160
Featured
See All Featured
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
260
SEO for Brand Visibility & Recognition
aleyda
0
4.5k
Embracing the Ebb and Flow
colly
88
5k
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
118
110k
Optimising Largest Contentful Paint
csswizardry
37
3.6k
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
1
170
The SEO Collaboration Effect
kristinabergwall1
0
420
Bootstrapping a Software Product
garrettdimon
PRO
307
120k
The Language of Interfaces
destraynor
162
26k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
27
3.4k
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
120
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
1
2k
Transcript
Building Extensions best practises ! Peter Berkenbosch
Unix philosophy building short, simple, clear, modular, and extendable code
that can be easily maintained and repurposed by developers other than its creators.
Documentation
Modular
OOP
Extension as “Model”
Models Views Controllers Assets Overrides Rails::Engine Spree other 3rd party
gems extension
Looks familier! Rails anyone?!
Outside In
Models Views Controllers Assets Overrides Rails::Engine Spree other 3rd party
gems extension
Test the “interface” can be just an API
Drives Quality
Self documenting
gem install spree_cmd
spree extension
git clone spree
rake sandbox
spree extension
module SpreeSales! class Engine < Rails::Engine! require 'spree/core'! isolate_namespace Spree!
engine_name 'spree_sales'! ! # use rspec for tests! config.generators do |g|! g.test_framework :rspec! end! ! def self.activate! Dir.glob(File.join(File.dirname(__FILE__), '../../app/**/*_decorator*.rb')) do |c|! Rails.configuration.cache_classes ? require(c) : load(c)! end! end! ! config.to_prepare &method(:activate).to_proc! end! end
Spree Testing Support
Usual suspect rspec capybara factory_girl
# Requires factories defined in spree_core! require 'spree/testing_support/factories'! require 'spree/testing_support/controller_requests'!
require 'spree/testing_support/authorization_helpers'! require 'spree/testing_support/url_helpers'
Red - Green - Refacor Repeat
Nothing new. TDD / BDD …
Extending Spree
class_evil Looking at adding durable_decorator
Deface for small changes
override view file for the more complex customisations
Deface-able views ! for easy overriding the overrides.
github.com/spree/spree_ Inspiration and collaboration!