Slide 1

Slide 1 text

Modern Make for modern (RAILS) developers Ivan Nemytchenko, @inem, inem.at RubyConf Brasil 2020 CRASH COURSE

Slide 2

Slide 2 text

Ivan Nemytchenko • rubyist since 2006 • former GitLabber • teacher • railshurts.com author • freelance/consulting

Slide 3

Slide 3 text

• painlessrails.com

Slide 4

Slide 4 text

http://urban-connect.ch

Slide 5

Slide 5 text

What to expect here • What’s the problem? • The basics • Advanced stuff • Examples from real project • Principles

Slide 6

Slide 6 text

Make?

Slide 7

Slide 7 text

What’s the problem?

Slide 8

Slide 8 text

Modern Developer? • Dev+Ops • Multiple stacks (Rails + JS for example) • Multiple projects • Multiple environments (dev, ±docker, ssh)

Slide 9

Slide 9 text

Command line interface tools • git • ssh • rails • bundle • docker • docker-compose • heroku • aws • ansible • ansible-playbook • yarn • …

Slide 10

Slide 10 text

Command line interface tools

Slide 11

Slide 11 text

What’s the problem? ansible-playbook -i inventory/production -- tags "deploy" app-server.yml --become- user=app --extra-vars=extra.txt --vault- password-file="~/.ansible/vault.txt" -vvv

Slide 12

Slide 12 text

What’s the problem? ansible-playbook -i inventory/production -- tags "deploy" app-server.yml --become- user=app --extra-vars=extra.txt --vault- password-file="~/.ansible/vault.txt" -vvv Imperative, not declarative!

Slide 13

Slide 13 text

• Imperative, not declarative • Implementation, not semantics • Have to remember a lot of low-level details • Outdated README-s What’s the problem?

Slide 14

Slide 14 text

Deployment ansible-playbook -i inventory/production -- tags "deploy" app-server.yml --become- user=app --extra-vars=extra.txt --vault- password-file="~/.ansible/vault.txt" -vvv

Slide 15

Slide 15 text

How about? make deploy

Slide 16

Slide 16 text

make deploy

Slide 17

Slide 17 text

Run tests MINITEST_REPORTER=SpecReporter bundle exec bin/rails test

Slide 18

Slide 18 text

Make test

Slide 19

Slide 19 text

Yay! • You can use Make now!

Slide 20

Slide 20 text

Modern Make In practice

Slide 21

Slide 21 text

Why not … ? • Rake • Yarn • Bash scripts

Slide 22

Slide 22 text

USE Make AS GLUE BETWEEN TECHNOLOGIES!

Slide 23

Slide 23 text

Principles • No instructions in Readme! • Semantics first! • Duplication is ok! • StackOverflow → Makefile

Slide 24

Slide 24 text

Modern make http://makefile.site http://re.dopo.st/201015204327 http://inem.at