Upgrade to Pro — share decks privately, control downloads, hide ads and more …

DaFunk, IOT Framework in Ruby

Scalone
September 26, 2016

DaFunk, IOT Framework in Ruby

Talk about the DaFunk Framework ecosystem, with small pinches of mruby-cli.

Scalone

September 26, 2016
Tweet

More Decks by Scalone

Other Decks in Programming

Transcript

  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. $ 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
  6. $ 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
  7. $ 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
  8. $ 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
  9. $ echo "puts 'Hello RUBYCONF'" >> rubyconf.rb $ mrbc rubyconf.rb

    $ hexdump -C rubyconf.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 |.......HelloRUBY| 00000050 55 2d 53 50 00 00 00 01 00 04 70 75 74 73 00 45 |CONF......puts.E| 00000060 4e 44 00 00 00 00 08 |ND.....| 00000067 $ mruby -b rubyconf.mrb Hello RUBYCONF
  10. lib/device/ !"" application.rb !"" audio.rb !"" crypto.rb !"" display.rb !""

    io.rb !"" magnetic.rb !"" network.rb !"" printer.rb !"" runtime.rb !"" system.rb #"" version.rb
  11. lib/device/ !"" application.rb !"" audio.rb !"" crypto.rb !"" display.rb !""

    io.rb !"" magnetic.rb !"" network.rb !"" printer.rb !"" runtime.rb !"" system.rb #"" version.rb
  12. lib/device/ !"" application.rb !"" audio.rb !"" crypto.rb !"" display.rb !""

    io.rb !"" magnetic.rb !"" network.rb !"" printer.rb !"" runtime.rb !"" system.rb #"" version.rb
  13. lib/device/ !"" application.rb !"" audio.rb !"" crypto.rb !"" display.rb !""

    io.rb !"" magnetic.rb !"" network.rb !"" printer.rb !"" runtime.rb !"" system.rb #"" version.rb class Device class Audio def self.adapter Device.adapter::Audio end def self.beep(tone, seconds) milli = seconds * 1000 adapter.beep(tone, milli) end end end
  14. lib/device/ !"" application.rb !"" audio.rb !"" crypto.rb !"" display.rb !""

    io.rb !"" magnetic.rb !"" network.rb !"" printer.rb !"" runtime.rb !"" system.rb #"" version.rb class Device class Audio def self.adapter Device.adapter::Audio end def self.beep(tone, seconds) milli = seconds * 1000 adapter.beep(tone, milli) end end end
  15. lib/device/ !"" application.rb !"" audio.rb !"" crypto.rb !"" display.rb !""

    io.rb !"" magnetic.rb !"" network.rb !"" printer.rb !"" runtime.rb !"" system.rb #"" version.rb class Device class Audio def self.adapter Device.adapter::Audio end def self.beep(tone, seconds) milli = seconds * 1000 adapter.beep(tone, milli) end end end
  16. lib/device/ !"" application.rb !"" audio.rb !"" crypto.rb !"" display.rb !""

    io.rb !"" magnetic.rb !"" network.rb !"" printer.rb !"" runtime.rb !"" system.rb #"" version.rb class Device class Audio def self.adapter Device.adapter::Audio end def self.beep(tone, seconds) milli = seconds * 1000 adapter.beep(tone, milli) end end end
  17. lib/device/ !"" application.rb !"" audio.rb !"" crypto.rb !"" display.rb !""

    io.rb !"" magnetic.rb !"" network.rb !"" printer.rb !"" runtime.rb !"" system.rb #"" version.rb class Device class Audio def self.adapter Device.adapter::Audio end def self.beep(tone, seconds) milli = seconds * 1000 adapter.beep(tone, milli) end end end
  18. Who Github - Hub Heroku - Heroku Toolbelt AWS -

    aws-cli Trello - trelo_cli Slack - slack-cli CW - cloudwalk
  19. :(

  20. $ echo "puts 'Hello RUBYCONF'" >> rubyconf.rb $ mrbc rubyconf.rb

    $ hexdump -C rubyconf.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 |.......HelloRUBY| 00000050 55 2d 53 50 00 00 00 01 00 04 70 75 74 73 00 45 |CONF......puts.E| 00000060 4e 44 00 00 00 00 08 |ND.....| 00000067 $ mruby -b rubyconf.mrb Hello RUBYCONF
  21. $ echo "puts 'Hello RUBYCONF'" >> rubyconf.rb $ mrbc rubyconf.rb

    $ hexdump -C rubyconf.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 |.......HelloRUBY| 00000050 55 2d 53 50 00 00 00 01 00 04 70 75 74 73 00 45 |CONF......puts.E| 00000060 4e 44 00 00 00 00 08 |ND.....| 00000067 $ mruby -b rubyconf.mrb Hello RUBYCONF
  22. $ echo "puts 'Hello RUBYCONF'" >> rubyconf.rb $ mrbc rubyconf.rb

    $ hexdump -C rubyconf.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 |.......HelloRUBY| 00000050 55 2d 53 50 00 00 00 01 00 04 70 75 74 73 00 45 |CONF......puts.E| 00000060 4e 44 00 00 00 00 08 |ND.....| 00000067 $ mruby -b rubyconf.mrb Hello RUBYCONF
  23. $ echo "puts 'Hello RUBYCONF'" >> rubyconf.rb $ mrbc rubyconf.rb

    $ hexdump -C rubyconf.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 |.......HelloRUBY| 00000050 55 2d 53 50 00 00 00 01 00 04 70 75 74 73 00 45 |CONF......puts.E| 00000060 4e 44 00 00 00 00 08 |ND.....| 00000067 $ mruby -b rubyconf.mrb Hello RUBYCONF
  24. $ echo "puts 'Hello RUBYCONF'" >> rubyconf.rb $ mrbc rubyconf.rb

    $ hexdump -C rubyconf.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 |.......HelloRUBY| 00000050 55 2d 53 50 00 00 00 01 00 04 70 75 74 73 00 45 |CONF......puts.E| 00000060 4e 44 00 00 00 00 08 |ND.....| 00000067 $ mruby -b rubyconf.mrb Hello RUBYCONF
  25. int main(void) { mrb_state *mrb = mrb_open(); mrbc_context *c; mrb_value

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

    v; c = mrbc_context_new(mrb); mrb_load_irep_cxt(mrb, rubyconf, c); mrbc_context_free(mrb, c); return 0; }
  27. I18n $ cat resources/app/i18n.json { "en":{"success":"SUCCESS"}, "pt-br":{"success"SUCESSO!"} } $ cat

    lib/main.rb class Main < Device def self.call I18n.configure("app", "en") I18n.pt(:success) I18n.locale = "pt-br" I18n.pt(:success) getc true end end
  28. I18n $ cat resources/app/i18n.json { "en":{"success":"SUCCESS"}, "pt-br":{"success"SUCESSO!"} } $ cat

    lib/main.rb class Main < Device def self.call I18n.configure("app", "en") I18n.pt(:success) I18n.locale = "pt-br" I18n.pt(:success) getc true end end
  29. I18n $ cat resources/app/i18n.json { "en":{"success":"SUCCESS"}, "pt-br":{"success"SUCESSO!"} } $ cat

    lib/main.rb class Main < Device def self.call I18n.configure("app", "en") I18n.pt(:success) I18n.locale = "pt-br" I18n.pt(:success) getc true end end
  30. I18n $ cat resources/app/i18n.json { "en":{"success":"SUCCESS"}, "pt-br":{"success"SUCESSO!"} } $ cat

    lib/main.rb class Main < Device def self.call I18n.configure("app", "en") I18n.pt(:success) I18n.locale = "pt-br" I18n.pt(:success) getc true end end
  31. I18n $ cat resources/app/i18n.json { "en":{"success":"SUCCESS"}, "pt-br":{"success"SUCESSO!"} } $ cat

    lib/main.rb class Main < Device def self.call I18n.configure("app", "en") I18n.pt(:success) I18n.locale = "pt-br" I18n.pt(:success) getc true end end
  32. I18n $ cat resources/app/i18n.json { "en":{"success":"SUCCESS"}, "pt-br":{"success"SUCESSO!"} } $ cat

    lib/main.rb class Main < Device def self.call I18n.configure("app", "en") I18n.pt(:success) I18n.locale = "pt-br" I18n.pt(:success) getc true end end
  33. I18n $ cat resources/app/i18n.json { "en":{"success":"SUCCESS"}, "pt-br":{"success"SUCESSO!"} } $ cat

    lib/main.rb class Main < Device def self.call I18n.configure("app", "en") I18n.pt(:success) I18n.locale = "pt-br" I18n.pt(:success) getc true end end
  34. Rubygem files = (`git ls-files -z`.split("\x0") files << “out/app/main.mrb”) Gem::Specification.new

    do |spec| spec.files = files end resources.each do |file,dest| FileUtils.cp(file, dest) end