Slide 1

Slide 1 text

Building a cross-platform API CLI in 15 minutes

Slide 2

Slide 2 text

toch _toch Magandang araw! Ako si Christophe.

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

Google Trend of the keywords Web API

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

GitHub -> Hub Heroku -> Heroku Toolbelt AWS -> aws-cli Trello -> trello_cli Slack -> slack-cli ...

Slide 9

Slide 9 text

No content

Slide 10

Slide 10 text

Cross Toolchain?

Slide 11

Slide 11 text

Cross Toolchain? ¯\_(ツ)_/¯

Slide 12

Slide 12 text

No content

Slide 13

Slide 13 text

(╯°□°)╯︵ ┻━┻ ┬──┬

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

No content

Slide 16

Slide 16 text

No content

Slide 17

Slide 17 text

No content

Slide 18

Slide 18 text

No content

Slide 19

Slide 19 text

No content

Slide 20

Slide 20 text

No content

Slide 21

Slide 21 text

$ gem install heroku

Slide 22

Slide 22 text

No content

Slide 23

Slide 23 text

No content

Slide 24

Slide 24 text

No content

Slide 25

Slide 25 text

$ GOOS=linux GOARCH=amd64 go build $ GOOS=windows GOARCH=amd64 go build $ GOOS=darwin GOARCH=amd64 go build

Slide 26

Slide 26 text

No content

Slide 27

Slide 27 text

No content

Slide 28

Slide 28 text

We shouldn't stop there!

Slide 29

Slide 29 text

+ = https://github.com/hone/mruby-cli mruby-cli

Slide 30

Slide 30 text

→ Ruby → Performance → No Require → Binary for each platform/arch → Simple to compile & release → CLI apps framework Mruby-cli talk at RubyKaigi 2015 Goals

Slide 31

Slide 31 text

Team

Slide 32

Slide 32 text

No content

Slide 33

Slide 33 text

→ ISO/IEC 30170:2012 standard → Compatible with Ruby 2.1 core API → No Built-in File/Socket/IO → not threadsafe, no Thread → procs/blocks → metaprogramming → monkey patching → literals → easy to bind to C-ABI compatible lib

Slide 34

Slide 34 text

Gotchas: → no stdlib → native ext have to support cross- compilation → no Rubygems, but mrbgems-list

Slide 35

Slide 35 text

No content

Slide 36

Slide 36 text

No content

Slide 37

Slide 37 text

No content

Slide 38

Slide 38 text

Safe Live Coding: Hello RubyConf Ph

Slide 39

Slide 39 text

Safe Live Coding: Advanced Scaffold

Slide 40

Slide 40 text

A real example: ~/my_repo/ $ github_status Success

Slide 41

Slide 41 text

GitHub Repository: $ git config --get remote.origin.url git@github.com:toch/my_repo.git

Slide 42

Slide 42 text

Current Branch Name: $ git symbolic-ref HEAD refs/heads/current_branch

Slide 43

Slide 43 text

Corresponding Pull Request: GET /repos/toch/my_repo/pulls ?head=toch:current_branch

Slide 44

Slide 44 text

GitHub Status GET /repos/toch/my_repo /commits//status

Slide 45

Slide 45 text

Safe Live Coding: GitHub Status

Slide 46

Slide 46 text

Let's build CLI in Ruby <3! toch _toch hone/mruby-cli toch/mruby-web_api toch/github_status