Share
Embed
Transcript
72 slides
-
Hi! I’m @masuidrive. • Yuichiro MASUI - Ichi • Open
source developer, Ruby fun • Pukiwiki, Ruby on Rails tutorial movie in Japanese, IKEA hacker • Furo-grammer (Coding in hot tub) • FrogApps, Inc. CTO // ex-Appcelerati Saturday, May 18, 13 -
Hi! I’m @masuidrive. • Yuichiro MASUI - Ichi • Open
source developer, Ruby fun • Pukiwiki, Ruby on Rails tutorial movie in Japanese, IKEA hacker • Furo-grammer (Coding in hot tub) • FrogApps, Inc. CTO // ex-Appcelerati Saturday, May 18, 13 -
Hi! I’m @masuidrive. • Yuichiro MASUI - Ichi • Open
source developer, Ruby fun • Pukiwiki, Ruby on Rails tutorial movie in Japanese, IKEA hacker • Furo-grammer (Coding in hot tub) • FrogApps, Inc. CTO // ex-Appcelerati Saturday, May 18, 13 -
Hi! I’m @masuidrive. • Yuichiro MASUI - Ichi • Open
source developer, Ruby fun • Pukiwiki, Ruby on Rails tutorial movie in Japanese, IKEA hacker • Furo-grammer (Coding in hot tub) • FrogApps, Inc. CTO // ex-Appcelerati Saturday, May 18, 13 -
Hi! I’m @masuidrive. • Yuichiro MASUI - Ichi • Open
source developer, Ruby fun • Pukiwiki, Ruby on Rails tutorial movie in Japanese, IKEA hacker • Furo-grammer (Coding in hot tub) • FrogApps, Inc. CTO // ex-Appcelerati ϛΠϧ Saturday, May 18, 13 -
mruby • Ruby for less resources • ISO/JIS compliant •
CRuby subset. Not included File, Socket, Thread and more ext libraries • OS / CPU Independent • Not required POSIX, only C99 Saturday, May 18, 13 -
Configurable • Drop off unnecessary features • Parser / Compiler
• Struct, Time, Math, STDIO, Regexp, sprintf • Table algorithm - hash or list • NaN Boxing Saturday, May 18, 13 -
mruby target • Embedded • Digital Appliance • Game console
• Vendor machine • Bundle with applications Saturday, May 18, 13 -
mruby target • CPU - 32bit, FPU • Memory -
256KB - 1MB • OS Saturday, May 18, 13 -
mruby internals • VM structure - Multi VM instance •
No C global variable • Generational incremental GC (Mark&Sweep) • Not thread safe • Build system build on CRuby Saturday, May 18, 13 -
development • Spring 2010 - Subsidy • Matz, some companies
and colleges • April 22, 2012 - Publish to GitHub • mruby got some contributors Saturday, May 18, 13 -
mrbgems • Daniel (@bovi) created extension package feature at end
of Nov 2012. • Easy to install from GitHub • Supported cross build • Already provided 40+ gems Saturday, May 18, 13 -
mrbgems • Daniel (@bovi) created extension package feature at end
of Nov 2012. • Easy to install from GitHub • Supported cross build • Already provided 40+ gems Saturday, May 18, 13 -
wrap up • mruby͕ࢦ͢ͷޙͷੈք • CRubyRuby͕ओɺmrubyै • ΈࠐΉઌσόΠε͚ͩ͡Όͳ͍ • ࠐΉͳΒࠓ
Saturday, May 18, 13 -
When will you release RiteVM? I want to run it
on iOS/ Android. It’s mruby. I need more time to make public (probably June) Should I give you access to private repos? Yes! I want to try it! What’s your github account? Saturday, May 18, 13 -
What’s MobiRuby? • iOS app development kit on mruby •
MIT license • Can access native functions • Have plan for Android version • Already released MobiRuby based app • Search “mobiruby” in AppStore on iOS Saturday, May 18, 13 -
Vision • Provide Ruby power to Mobile devices • Meta
programming is most important Ruby power Saturday, May 18, 13 -
Hello world \ class Cocoa::MyAlertView < Cocoa::UIAlertView
define C::Void, :alertView, Cocoa::Object, :clickedButtonAtIndex, C::Int do |me, index| if index.to_i == 1 app = Cocoa::UIApplication._sharedApplication urlstr = "http://mobiruby.org" url = Cocoa::NSURL._URLWithString(urlstr) app._openURL url end end end alert = Cocoa::MyAlertView._alloc._initWithTitle "Hello", :message, "I am MobiRuby", :delegate, nil, :cancelButtonTitle, "I know!", :otherButtonTitles, "What's?", nil alert._setDelegate alert alert._show Saturday, May 18, 13 -
Hello world \ class Cocoa::MyAlertView < Cocoa::UIAlertView
define C::Void, :alertView, Cocoa::Object, :clickedButtonAtIndex, C::Int do |me, index| if index.to_i == 1 app = Cocoa::UIApplication._sharedApplication urlstr = "http://mobiruby.org" url = Cocoa::NSURL._URLWithString(urlstr) app._openURL url end end end alert = Cocoa::MyAlertView._alloc._initWithTitle "Hello", :message, "I am MobiRuby", :delegate, nil, :cancelButtonTitle, "I know!", :otherButtonTitles, "What's?", nil alert._setDelegate alert alert._show Saturday, May 18, 13 -
class Cocoa::MyAlertView < Cocoa::UIAlertView define C::Void, :alertView, Cocoa::Object,
:clickedButtonAtIndex, C::Int do |me, idx| if idx.to_i == 1 app = Cocoa::UIApplication._sharedApplica urlstr = "http://mobiruby.org" url = Cocoa::NSURL._URLWithString(urlstr) app._openURL url end end end class Cocoa::MyAlertView < Cocoa::UIAlertView define C::Void, :alertView, Cocoa::Object, :clickedButtonAtIndex, C::Int do |me, idx| if idx.to_i == 1 app = Cocoa::UIApplication._sharedApplica urlstr = "http://mobiruby.org" url = Cocoa::NSURL._URLWithString(urlstr) app._openURL url end end end Hello world - 1st half Saturday, May 18, 13 -
class Cocoa::MyAlertView < Cocoa::UIAlertView define C::Void, :alertView, Cocoa::Object,
:clickedButtonAtIndex, C::Int do |me, idx| if idx.to_i == 1 app = Cocoa::UIApplication._sharedApplica urlstr = "http://mobiruby.org" url = Cocoa::NSURL._URLWithString(urlstr) app._openURL url end end end Hello world - 1st half class Cocoa::MyAlertView < Cocoa::UIAlertView Saturday, May 18, 13 -
class Cocoa::MyAlertView < Cocoa::UIAlertView define C::Void, :alertView, Cocoa::Object,
:clickedButtonAtIndex, C::Int do |me, idx| if idx.to_i == 1 app = Cocoa::UIApplication._sharedApplica urlstr = "http://mobiruby.org" url = Cocoa::NSURL._URLWithString(urlstr) app._openURL url end end end define C::Void, :alertView, Cocoa::Object, :clickedButtonAtIndex, C::Int do |me, idx| Hello world - 1st half Saturday, May 18, 13 -
Hello world - 2nd half \ alert = Cocoa::MyAlertView._alloc.
_initWithTitle "Hello", :message, "I am MobiRuby", :delegate, nil, :cancelButtonTitle, "I know!", :otherButtonTitles, "What's?", nil alert._setDelegate alert alert._show alert = Cocoa::MyAlertView._alloc. _initWithTitle "Hello", :message, "I am MobiRuby", :delegate, nil, :cancelButtonTitle, "I know!", :otherButtonTitles, "What's?", nil alert._setDelegate alert alert._show Saturday, May 18, 13 -
Hello world - 2nd half \ alert = Cocoa::MyAlertView._alloc.
_initWithTitle "Hello", :message, "I am MobiRuby", :delegate, nil, :cancelButtonTitle, "I know!", :otherButtonTitles, "What's?", nil alert._setDelegate alert alert._show alert = Cocoa::MyAlertView._alloc. _initWithTitle "Hello", :message, "I am MobiRuby", :delegate, nil, :cancelButtonTitle, "I know!", :otherButtonTitles, "What's?", nil alert._setDelegate alert alert._show Saturday, May 18, 13 -
Next step \ class MyAlertView < MobiRuby::AlertView title "Hello"
message "I am MobiRuby" cancelButton "I know!" do end button "What's?" do openURL "http://mobiruby.org" end end alert = MyAlertView.new alert.show Saturday, May 18, 13 -
MobiRuby stack iOS mruby mruby- cfunc Your code mruby- cocoa
mobiruby- common mobiruby- ios Saturday, May 18, 13 -
MobiRuby stack iOS mruby mruby- cfunc Your code mruby- cocoa
mobiruby- common mobiruby- ios Saturday, May 18, 13 -
MobiRuby stack iOS mruby mruby- cfunc Your code mruby- cocoa
mobiruby- common mobiruby- ios Saturday, May 18, 13 -
mruby-cfunc • C function bridge for mruby • Call C
based function directly • Based on libFFI • Same as Ruby/DL library on CRuby Saturday, May 18, 13 -
mruby-cfunc str = "STRING" ptr = CFunc::Pointer.malloc(7) result_ptr = CFunc::call(CFunc::Pointer,
"strcpy", ptr, str) ptr.to_s -‐> “STRING” Saturday, May 18, 13 -
mruby-cfunc \ class TestStruct < CFunc::Struct define
CFunc::SInt8, :x, CFunc::SInt16, :y end test = TestStruct.new test[:x] = 10 Saturday, May 18, 13 -
MobiRuby stack iOS mruby mruby- cfunc Your code mruby- cocoa
mobiruby- common mobiruby- ios Saturday, May 18, 13 -
mruby-cocoa • Cocoa bridge for mruby • Use Cocoa functions
transparently • Based on mruby-cfunc and Cocoa runtime • Manipulate Cocoa objects • Create class/instance, inherit existing classes • Garbage collection Saturday, May 18, 13 -
Bridge Cocoa runtime • Objective-C has powerful runtime features •
Create and modify class dynamically • ObjC class <- Ruby class <- ObjC class • ObjC value interconverted with Ruby value • Supported delegate and blocks Saturday, May 18, 13 -
Memory management • Objective-C - Reference count • mruby -
Mark & Sweep • Swizzled Objective-C “release” method • awful performance bottleneck Saturday, May 18, 13 -
MobiRuby stack iOS mruby mruby- cfunc Your code mruby- cocoa
mobiruby- common mobiruby- ios Saturday, May 18, 13 -
mobiruby-common • Will be common utilities with Android ver. •
require method • Some POSIX based functions Saturday, May 18, 13 -
MobiRuby stack iOS mruby mruby- cfunc Your code mruby- cocoa
mobiruby- common mobiruby- ios Saturday, May 18, 13 -
mobiruby-ios • iOS specific utilities • Bootstrap • Xcode integration
• Wrapped classes Saturday, May 18, 13 -
Wrapped APIs \ class MyAlertView < MobiRuby::AlertView title "Hello"
message "I am MobiRuby" cancelButton "I know!" do end button "What's?" do openURL "http://mobiruby.org" end end alert = MyAlertView.new alert.show Saturday, May 18, 13 -
Road map • Finished building Cocoa bridge • Fix bugs,
Improvement • Packaging • Documentation • Build wrapped APIs Saturday, May 18, 13 -
Road map • Finished building Cocoa bridge • Fix bugs,
Improvement • Packaging • Documentation • Build wrapped APIs Version 1 Q1 2013 Saturday, May 18, 13 -
Road map • Finished building Cocoa bridge • Fix bugs,
Improvement • Packaging • Documentation • Build wrapped APIs Version 1 Summer 2013 Saturday, May 18, 13 -
Current status • Already MobiRuby based app is in AppStore
• Finally released alpha 1 • Can call almost iOS native functions • Writing test codes • It's only for iOS and mruby hackers Saturday, May 18, 13 -
Pros. • Ruby power • Based on Matz implemented Ruby
• mrbgems • MIT license • Compact (~4000 lines) Saturday, May 18, 13 -
Cons. • Unstable • Less classes / functions • Don't
have debugging feature • Need to understand iOS and Cocoa Saturday, May 18, 13 -
PCܥٕज़ͷԠ༻ • ΈࠐΈ༻ڥҰੲલͷPCฒ • ։ൃڥ • ARM • खܰͳ࣮ߦڥ •
Arduino, Raspberry Pi Saturday, May 18, 13 -
Thank you • Logo design: Maylis Agniel • English review:
@tenderlove and ebi-chan • http://mobiruby.org • http://github.com/mobiruby • http://twitter.com/mobiruby • http://fb.me/mobiruby Saturday, May 18, 13