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
Building Extensions - best practises
Search
Peter Berkenbosch
February 27, 2014
65
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
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
220
Spree Commerce hub for developers
pberkenbosch
0
200
Behavior Driven Development, an introduction
pberkenbosch
1
64
TDD Spree
pberkenbosch
5
470
Twente RB Spree from the trenches
pberkenbosch
0
59
GroningenRB Spree from the trenches
pberkenbosch
0
130
Spree from the Trenches
pberkenbosch
3
330
[dutch] Behavior Driven Development
pberkenbosch
1
81
BDD Outside in development
pberkenbosch
1
170
Featured
See All Featured
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
68
58k
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
300
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
2
1.6k
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
360
Game over? The fight for quality and originality in the time of robots
wayneb77
1
310
We Have a Design System, Now What?
morganepeng
55
8.4k
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
74
43k
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
730
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
310
Docker and Python
trallard
47
4.2k
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.5k
Product Roadmaps are Hard
iamctodd
55
13k
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!