Slide 1

Slide 1 text

No content

Slide 2

Slide 2 text

Chris Oliver Crafting Rails Plugins

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

😱

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

What is a Rails plugin?

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

No content

Slide 9

Slide 9 text

Rails Plugins • Routes • Models • Views • Controllers • Jobs • Etc

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

Railtie vs Engine

Slide 12

Slide 12 text

Railtie The core of a Rails plugin • Initializers • Configuration • Rake tasks

Slide 13

Slide 13 text

Engine Railtie with more features • Models • Controllers • Views • Routes • Locales • Tasks

Slide 14

Slide 14 text

Your Rails app is an Engine.

Slide 15

Slide 15 text

No content

Slide 16

Slide 16 text

$ rails plugin new

Slide 17

Slide 17 text

Railtie rails plugin new my_railtie

Slide 18

Slide 18 text

Engine rails plugin new my_engine —full

Slide 19

Slide 19 text

Mountable Engines

Slide 20

Slide 20 text

Mountable Engine rails plugin new my_mountable_engine —full —mountable

Slide 21

Slide 21 text

\ Mounting Rails Engines in Routes

Slide 22

Slide 22 text

Engine helper

Slide 23

Slide 23 text

main_app helper

Slide 24

Slide 24 text

Dependencies

Slide 25

Slide 25 text

gemspec

Slide 26

Slide 26 text

No content

Slide 27

Slide 27 text

Load Order & Hooks

Slide 28

Slide 28 text

Rails Plugins Rails Load Order Initializers

Slide 29

Slide 29 text

No content

Slide 30

Slide 30 text

No content

Slide 31

Slide 31 text

No content

Slide 32

Slide 32 text

No content

Slide 33

Slide 33 text

on_load callbacks

Slide 34

Slide 34 text

No content

Slide 35

Slide 35 text

No content

Slide 36

Slide 36 text

No content

Slide 37

Slide 37 text

Middleware

Slide 38

Slide 38 text

– Thoughtful government employees “The website should work only during business hours. ”

Slide 39

Slide 39 text

🤔

Slide 40

Slide 40 text

No content

Slide 41

Slide 41 text

No content

Slide 42

Slide 42 text

No content

Slide 43

Slide 43 text

No content

Slide 44

Slide 44 text

Configuration

Slide 45

Slide 45 text

Configuration with Accessors

Slide 46

Slide 46 text

Extending Rails Configuration

Slide 47

Slide 47 text

Extending Rails Configuration

Slide 48

Slide 48 text

Generators

Slide 49

Slide 49 text

No content

Slide 50

Slide 50 text

No content

Slide 51

Slide 51 text

Extending Rails Generators

Slide 52

Slide 52 text

No content

Slide 53

Slide 53 text

No content

Slide 54

Slide 54 text

Models & Migrations

Slide 55

Slide 55 text

No content

Slide 56

Slide 56 text

No content

Slide 57

Slide 57 text

No content

Slide 58

Slide 58 text

Rails Console

Slide 59

Slide 59 text

No content

Slide 60

Slide 60 text

No content

Slide 61

Slide 61 text

No content

Slide 62

Slide 62 text

No content

Slide 63

Slide 63 text

No content

Slide 64

Slide 64 text

Testing Rails Plugins

Slide 65

Slide 65 text

test/dummy Rails App

Slide 66

Slide 66 text

bin/rails test

Slide 67

Slide 67 text

GitHub Actions

Slide 68

Slide 68 text

No content

Slide 69

Slide 69 text

Testing Ruby Versions

Slide 70

Slide 70 text

No content

Slide 71

Slide 71 text

Testing Rails Versions

Slide 72

Slide 72 text

No content

Slide 73

Slide 73 text

Appraisals

Slide 74

Slide 74 text

No content

Slide 75

Slide 75 text

No content

Slide 76

Slide 76 text

No content

Slide 77

Slide 77 text

No content

Slide 78

Slide 78 text

Publishing

Slide 79

Slide 79 text

Rake Release Task

Slide 80

Slide 80 text

Rubygems Trusted Publishing

Slide 81

Slide 81 text

Your Turn! • Extract a feature • Something you wish existed • Just for learning • Read Rails plugin source code • Join me at the Hack Day! • Join Noel Rappin ’ s workshop tomorrow