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

Build a Cross-Platform Web API CLI in 15 minute...

Build a Cross-Platform Web API CLI in 15 minutes with Mruby-CLI

Thanks to web APIs, we can extend any web apps with simple Ruby CLI: listing open pull requests, or tweeting directly from the terminal.

Unfortunately, distributing Ruby CLIs is complicated. So many runtimes to support, so hard to guarantee compatibility of gems on every platforms.

With mruby-cli, you can easily build an API CLI in mruby, a Ruby sibbling, and distribute it for every major platforms.

In this talk, we'll show how quickly you can build and distribute a such CLI with mruby-cli.

GitHub Repository:
- mruby-cli https://github.com/hone/mruby-cli
- mruby-web_api https://travis-ci.org/toch/mruby-web_api
- github_status https://github.com/toch/github_status

Screencasts of the live coding made during the talk https://gfycat.com/tochgif/rubyconf_ph_2016

Christophe Philemotte

April 09, 2016
Tweet

More Decks by Christophe Philemotte

Other Decks in Programming

Transcript

  1. GitHub -> Hub Heroku -> Heroku Toolbelt AWS -> aws-cli

    Trello -> trello_cli Slack -> slack-cli ...
  2. → Ruby → Performance → No Require → Binary for

    each platform/arch → Simple to compile & release → CLI apps framework Mruby-cli talk at RubyKaigi 2015 Goals
  3. → 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
  4. Gotchas: → no stdlib → native ext have to support

    cross- compilation → no Rubygems, but mrbgems-list