Slide 1

Slide 1 text

THIAGO SCALONE - @scalone CLI WITH MRUBY-CLI

Slide 2

Slide 2 text

Wecolme Message! The activities of a company associated with buying and selling a product or service that includes advertising, social media, selling products Marketing is based on thinking about the business in terms of customer needs and their satisfaction marketing differs from selling because in the words of the best university of the world.

Slide 3

Slide 3 text

Wecolme Message! The activities of a company associated with buying and selling a product or service that includes advertising, social media, selling products Marketing is based on thinking about the business in terms of customer needs and their satisfaction marketing differs from selling because in the words of the best university of the world.

Slide 4

Slide 4 text

Wecolme Message! The activities of a company associated with buying and selling a product or service that includes advertising, social media, selling products Marketing is based on thinking about the business in terms of customer needs and their satisfaction marketing differs from selling because in the words of the best university of the world.

Slide 5

Slide 5 text

WHY?

Slide 6

Slide 6 text

Web API Mail

Slide 7

Slide 7 text

Web API Mail Analytics

Slide 8

Slide 8 text

Web API Mail Analytics Communication

Slide 9

Slide 9 text

Web API Mail Analytics Communication Monitoring

Slide 10

Slide 10 text

Web API Mail Analytics Communication Monitoring Authentication

Slide 11

Slide 11 text

Web API Mail Analytics Communication Monitoring Authentication Errors

Slide 12

Slide 12 text

$ my-cli

Slide 13

Slide 13 text

NO BROWSER

Slide 14

Slide 14 text

Who Github - Hub Heroku - Heroku Toolbelt AWS - aws-cli Trello - trelo_cli Slack - slack-cli CW - cloudwalk

Slide 15

Slide 15 text

No content

Slide 16

Slide 16 text

No content

Slide 17

Slide 17 text

gem install heroku

Slide 18

Slide 18 text

CRuby Requires Ruby

Slide 19

Slide 19 text

CRuby Requires Ruby Performance (Require)

Slide 20

Slide 20 text

CRuby Requires Ruby Performance (Require) Ruby Versions

Slide 21

Slide 21 text

CRuby Requires Ruby Performance (Require) Ruby Versions Packaging Problems

Slide 22

Slide 22 text

:(

Slide 23

Slide 23 text

No content

Slide 24

Slide 24 text

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

Slide 25

Slide 25 text

No content

Slide 26

Slide 26 text

No content

Slide 27

Slide 27 text

No content

Slide 28

Slide 28 text

HAPPY! I feel

Slide 29

Slide 29 text

No content

Slide 30

Slide 30 text

mruby-cli

Slide 31

Slide 31 text

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

Slide 32

Slide 32 text

mruby-cli Ruby Performance No Require Binary for each platform Simple compile and release CLI apps framework

Slide 33

Slide 33 text

WHY?

Slide 34

Slide 34 text

mruby

Slide 35

Slide 35 text

No content

Slide 36

Slide 36 text

MRuby ISO/IEC 30170:2012

Slide 37

Slide 37 text

MRuby ISO/IEC 30170:2012 Ruby 1.9.3 / 2.1 Syntax

Slide 38

Slide 38 text

MRuby ISO/IEC 30170:2012 Ruby 1.9.3 / 2.1 Syntax No built-in IO/Thread/stdlib

Slide 39

Slide 39 text

MRuby ISO/IEC 30170:2012 Ruby 1.9.3 / 2.1 Syntax No built-in IO/Thread/stdlib Cross-compilation / ANSI C

Slide 40

Slide 40 text

MRuby ISO/IEC 30170:2012 Ruby 1.9.3 / 2.1 Syntax No built-in IO/Thread/stdlib Cross-compilation / ANSI C No gems, but mrbgems

Slide 41

Slide 41 text

runtime Operation System

Slide 42

Slide 42 text

runtime Operation System SDK / Dynlib

Slide 43

Slide 43 text

runtime Operation System SDK / Dynlib MRuby VM

Slide 44

Slide 44 text

runtime Operation System SDK / Dynlib MRuby VM Mrbgem

Slide 45

Slide 45 text

runtime Operation System SDK / Dynlib MRuby App MRuby App MRuby VM Mrbgem

Slide 46

Slide 46 text

runtime Operation System SDK / Dynlib MRuby App MRuby App MRuby VM Mrbgem

Slide 47

Slide 47 text

static Operation System SDK / Dynlib MRuby App MRuby App MRuby VM Mrbgem

Slide 48

Slide 48 text

mrbgem Operation System SDK / Dynlib MRuby App MRuby App MRuby VM Mrbgem

Slide 49

Slide 49 text

$ cd mruby-print/ $ ls mrbgem.rake mrblib src $ cat mrbgem.rake MRuby::Gem::Specification.new('mruby-print') do |spec| spec.license = 'MIT' spec.author = 'mruby developers' spec.summary = 'standard print/puts/p' end

Slide 50

Slide 50 text

$ cd mruby-print/ $ ls mrbgem.rake mrblib src $ cat mrbgem.rake MRuby::Gem::Specification.new('mruby-print') do |spec| spec.license = 'MIT' spec.author = 'mruby developers' spec.summary = 'standard print/puts/p' end

Slide 51

Slide 51 text

$ cd mruby-print/ $ ls mrbgem.rake mrblib src $ cat mrbgem.rake MRuby::Gem::Specification.new('mruby-print') do |spec| spec.license = 'MIT' spec.author = 'mruby developers' spec.summary = 'standard print/puts/p' end

Slide 52

Slide 52 text

$ cd mruby-print/ $ ls mrbgem.rake mrblib src $ cat mrbgem.rake MRuby::Gem::Specification.new('mruby-print') do |spec| spec.license = 'MIT' spec.author = 'mruby developers' spec.summary = 'standard print/puts/p' end

Slide 53

Slide 53 text

runtime Operation System SDK / Dynlib MRuby App MRuby App MRuby VM Mrbgem

Slide 54

Slide 54 text

$ echo "puts 'Hello GURU-SP'" >> guru.rb $ mrbc guru.rb $ hexdump -C guru.mrb 00000000 52 49 54 45 30 30 30 33 0e 93 00 00 00 67 4d 41 |RITE0003.....gMA| 00000010 54 5a 30 30 30 30 49 52 45 50 00 00 00 49 30 30 |TZ0000IREP...I00| 00000020 30 30 00 00 00 41 00 01 00 04 00 00 00 00 00 04 |00...A..........| 00000030 00 80 00 06 01 00 00 3d 00 80 00 a0 00 00 00 4a |.......=.......J| 00000040 00 00 00 01 00 00 0d 48 65 6c 6c 6f 20 47 55 52 |.......Hello GUR| 00000050 55 2d 53 50 00 00 00 01 00 04 70 75 74 73 00 45 |U-SP......puts.E| 00000060 4e 44 00 00 00 00 08 |ND.....| 00000067 $ mruby -b guru.mrb Hello GURU-SP

Slide 55

Slide 55 text

$ echo "puts 'Hello GURU-SP'" >> guru.rb $ mrbc guru.rb $ hexdump -C guru.mrb 00000000 52 49 54 45 30 30 30 33 0e 93 00 00 00 67 4d 41 |RITE0003.....gMA| 00000010 54 5a 30 30 30 30 49 52 45 50 00 00 00 49 30 30 |TZ0000IREP...I00| 00000020 30 30 00 00 00 41 00 01 00 04 00 00 00 00 00 04 |00...A..........| 00000030 00 80 00 06 01 00 00 3d 00 80 00 a0 00 00 00 4a |.......=.......J| 00000040 00 00 00 01 00 00 0d 48 65 6c 6c 6f 20 47 55 52 |.......Hello GUR| 00000050 55 2d 53 50 00 00 00 01 00 04 70 75 74 73 00 45 |U-SP......puts.E| 00000060 4e 44 00 00 00 00 08 |ND.....| 00000067 $ mruby -b guru.mrb Hello GURU-SP

Slide 56

Slide 56 text

$ echo "puts 'Hello GURU-SP'" >> guru.rb $ mrbc guru.rb $ hexdump -C guru.mrb 00000000 52 49 54 45 30 30 30 33 0e 93 00 00 00 67 4d 41 |RITE0003.....gMA| 00000010 54 5a 30 30 30 30 49 52 45 50 00 00 00 49 30 30 |TZ0000IREP...I00| 00000020 30 30 00 00 00 41 00 01 00 04 00 00 00 00 00 04 |00...A..........| 00000030 00 80 00 06 01 00 00 3d 00 80 00 a0 00 00 00 4a |.......=.......J| 00000040 00 00 00 01 00 00 0d 48 65 6c 6c 6f 20 47 55 52 |.......Hello GUR| 00000050 55 2d 53 50 00 00 00 01 00 04 70 75 74 73 00 45 |U-SP......puts.E| 00000060 4e 44 00 00 00 00 08 |ND.....| 00000067 $ mruby -b guru.mrb Hello GURU-SP

Slide 57

Slide 57 text

$ echo "puts 'Hello GURU-SP'" >> guru.rb $ mrbc guru.rb $ hexdump -C guru.mrb 00000000 52 49 54 45 30 30 30 33 0e 93 00 00 00 67 4d 41 |RITE0003.....gMA| 00000010 54 5a 30 30 30 30 49 52 45 50 00 00 00 49 30 30 |TZ0000IREP...I00| 00000020 30 30 00 00 00 41 00 01 00 04 00 00 00 00 00 04 |00...A..........| 00000030 00 80 00 06 01 00 00 3d 00 80 00 a0 00 00 00 4a |.......=.......J| 00000040 00 00 00 01 00 00 0d 48 65 6c 6c 6f 20 47 55 52 |.......Hello GUR| 00000050 55 2d 53 50 00 00 00 01 00 04 70 75 74 73 00 45 |U-SP......puts.E| 00000060 4e 44 00 00 00 00 08 |ND.....| 00000067 $ mruby -b guru.mrb Hello GURU-SP

Slide 58

Slide 58 text

guru[] = { 0x45,0x54,0x49,0x52,0x30,0x30,0x30,0x33,0x78,0xfb,0x00,0x00,0x00,0x67,0x4d,0x41, 0x54,0x5a,0x30,0x30,0x30,0x30,0x49,0x52,0x45,0x50,0x00,0x00,0x00,0x49,0x30,0x30, 0x30,0x30,0x00,0x00,0x00,0x41,0x00,0x01,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x04, 0x06,0x00,0x80,0x00,0x3d,0x00,0x00,0x01,0xa0,0x00,0x80,0x00,0x4a,0x00,0x00,0x00, 0x00,0x00,0x00,0x01,0x00,0x00,0x0d,0x48,0x65,0x6c,0x6c,0x6f,0x20,0x47,0x55,0x52, 0x55,0x2d,0x53,0x50,0x00,0x00,0x00,0x01,0x00,0x04,0x70,0x75,0x74,0x73,0x00,0x45, 0x4e,0x44,0x00,0x00,0x00,0x00,0x08, };

Slide 59

Slide 59 text

int main(void) { mrb_state *mrb = mrb_open(); mrbc_context *c; mrb_value v; c = mrbc_context_new(mrb); mrb_load_irep_cxt(mrb, guru, c); mrbc_context_free(mrb, c); return 0; }

Slide 60

Slide 60 text

int main(void) { mrb_state *mrb = mrb_open(); mrbc_context *c; mrb_value v; c = mrbc_context_new(mrb); mrb_load_irep_cxt(mrb, guru, c); mrbc_context_free(mrb, c); return 0; }

Slide 61

Slide 61 text

$ gcc -o guru guru.c -I mruby/include mruby/build/host/lib/libmruby.a $ ./guru Hello GURU-SP

Slide 62

Slide 62 text

$ gcc -o guru guru.c -I mruby/include mruby/build/host/lib/libmruby.a $ ./guru Hello GURU-SP

Slide 63

Slide 63 text

.RB Review

Slide 64

Slide 64 text

BYTECODE MRB .RB Review

Slide 65

Slide 65 text

BYTECODE MRB VM + MRBGEM + MRB .RB Review

Slide 66

Slide 66 text

BYTECODE MRB VM + MRBGEM + MRB BIN .RB Review

Slide 67

Slide 67 text

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

Slide 68

Slide 68 text

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

Slide 69

Slide 69 text

+ = https://github.com/hone mrub

Slide 70

Slide 70 text

+ = https://github.com/hone mrub MRuby App MRuby VM Mrbgem Cross Compilation

Slide 71

Slide 71 text

+ = https://github.com/hone mrub MRuby App MRuby VM Mrbgem Cross Compilation

Slide 72

Slide 72 text

+ = https://github.com/hone mrub MRuby App MRuby VM Mrbgem Cross Compilation

Slide 73

Slide 73 text

+ = https://github.com/hone mrub MRuby App MRuby VM Mrbgem Cross Compilation

Slide 74

Slide 74 text

No content

Slide 75

Slide 75 text

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

Slide 76

Slide 76 text

DEMO https:/ /github.com/scalone/guru41

Slide 77

Slide 77 text

TIPS

Slide 78

Slide 78 text

No content

Slide 79

Slide 79 text

number of malloc calls: 6480 number of realloc calls: 0 number of free calls: 1436 number of free(!NULL) calls: 334 number of free(NULL) calls: 1102 total size of allocated memory: 689710 bytes current number of allocated objects: 6146 current size of allocated memory: 611230 bytes mruby-memprof

Slide 80

Slide 80 text

Windows

Slide 81

Slide 81 text

Windows

Slide 82

Slide 82 text

Windows

Slide 83

Slide 83 text

Windows

Slide 84

Slide 84 text

DAFUNK, OPEN SOURCE RUBY FRAMEWORK FOR IOT @scalone

Slide 85

Slide 85 text

We're hiring [email protected]

Slide 86

Slide 86 text

Thank you @scalone THIAGO SCALONE - [email protected]