Crate - ruby based standalone executables
-
Upload
jeremy-hinegardner -
Category
Technology
-
view
2.969 -
download
0
Transcript of Crate - ruby based standalone executables
![Page 2: Crate - ruby based standalone executables](https://reader035.fdocuments.net/reader035/viewer/2022081414/5555a7dad8b42a52568b4798/html5/thumbnails/2.jpg)
COPIOUS FREE TIME
Fedora Packaging
•beanstalkd•haproxy•libtomcrypt•libtommath•nginx•ragel•tinyproxy
Ruby Gems
•amalgalite•crate•keybox•launchy•heel•hitimes•htauth•rabal•stickler
![Page 3: Crate - ruby based standalone executables](https://reader035.fdocuments.net/reader035/viewer/2022081414/5555a7dad8b42a52568b4798/html5/thumbnails/3.jpg)
Crate&
Amalgalite
![Page 4: Crate - ruby based standalone executables](https://reader035.fdocuments.net/reader035/viewer/2022081414/5555a7dad8b42a52568b4798/html5/thumbnails/4.jpg)
SURVEY
![Page 5: Crate - ruby based standalone executables](https://reader035.fdocuments.net/reader035/viewer/2022081414/5555a7dad8b42a52568b4798/html5/thumbnails/5.jpg)
PRE HISTORYRubyConf 2007
![Page 6: Crate - ruby based standalone executables](https://reader035.fdocuments.net/reader035/viewer/2022081414/5555a7dad8b42a52568b4798/html5/thumbnails/6.jpg)
PRE HISTORYRubyConf 2007
• Sploitin’ with Ruby
• Aaron Bedra
![Page 7: Crate - ruby based standalone executables](https://reader035.fdocuments.net/reader035/viewer/2022081414/5555a7dad8b42a52568b4798/html5/thumbnails/7.jpg)
PRE HISTORYRubyConf 2007
• Sploitin’ with Ruby
• Aaron Bedra
• Deploying Ruby Runtimes
• Bruce Williams & Rich Kilmer
![Page 8: Crate - ruby based standalone executables](https://reader035.fdocuments.net/reader035/viewer/2022081414/5555a7dad8b42a52568b4798/html5/thumbnails/8.jpg)
STORYTIME
![Page 9: Crate - ruby based standalone executables](https://reader035.fdocuments.net/reader035/viewer/2022081414/5555a7dad8b42a52568b4798/html5/thumbnails/9.jpg)
PERL 4, 1993
![Page 10: Crate - ruby based standalone executables](https://reader035.fdocuments.net/reader035/viewer/2022081414/5555a7dad8b42a52568b4798/html5/thumbnails/10.jpg)
NO CONTROL
![Page 11: Crate - ruby based standalone executables](https://reader035.fdocuments.net/reader035/viewer/2022081414/5555a7dad8b42a52568b4798/html5/thumbnails/11.jpg)
NO CONTROL
• interpreters? - perl probably, python maybe, ruby most likely not
![Page 12: Crate - ruby based standalone executables](https://reader035.fdocuments.net/reader035/viewer/2022081414/5555a7dad8b42a52568b4798/html5/thumbnails/12.jpg)
NO CONTROL
• interpreters? - perl probably, python maybe, ruby most likely not
• what libraries? - openssl? zlib?
![Page 13: Crate - ruby based standalone executables](https://reader035.fdocuments.net/reader035/viewer/2022081414/5555a7dad8b42a52568b4798/html5/thumbnails/13.jpg)
NO CONTROL
• interpreters? - perl probably, python maybe, ruby most likely not
• what libraries? - openssl? zlib?
• compiler? - quite possibly not
![Page 14: Crate - ruby based standalone executables](https://reader035.fdocuments.net/reader035/viewer/2022081414/5555a7dad8b42a52568b4798/html5/thumbnails/14.jpg)
What do you do, when only thing you know about your target
system, is the Operating System?
![Page 15: Crate - ruby based standalone executables](https://reader035.fdocuments.net/reader035/viewer/2022081414/5555a7dad8b42a52568b4798/html5/thumbnails/15.jpg)
AND YOU LOVE RUBY.
![Page 16: Crate - ruby based standalone executables](https://reader035.fdocuments.net/reader035/viewer/2022081414/5555a7dad8b42a52568b4798/html5/thumbnails/16.jpg)
YOU MAKE CRATE.
![Page 17: Crate - ruby based standalone executables](https://reader035.fdocuments.net/reader035/viewer/2022081414/5555a7dad8b42a52568b4798/html5/thumbnails/17.jpg)
SO WHAT IS CRATE?
![Page 18: Crate - ruby based standalone executables](https://reader035.fdocuments.net/reader035/viewer/2022081414/5555a7dad8b42a52568b4798/html5/thumbnails/18.jpg)
![Page 19: Crate - ruby based standalone executables](https://reader035.fdocuments.net/reader035/viewer/2022081414/5555a7dad8b42a52568b4798/html5/thumbnails/19.jpg)
embedded Ruby
![Page 20: Crate - ruby based standalone executables](https://reader035.fdocuments.net/reader035/viewer/2022081414/5555a7dad8b42a52568b4798/html5/thumbnails/20.jpg)
embedded Ruby + ruby extensions
![Page 21: Crate - ruby based standalone executables](https://reader035.fdocuments.net/reader035/viewer/2022081414/5555a7dad8b42a52568b4798/html5/thumbnails/21.jpg)
embedded Ruby
+ main wrapper+ ruby extensions
![Page 22: Crate - ruby based standalone executables](https://reader035.fdocuments.net/reader035/viewer/2022081414/5555a7dad8b42a52568b4798/html5/thumbnails/22.jpg)
embedded Ruby
+ standard library+ main wrapper+ ruby extensions
![Page 23: Crate - ruby based standalone executables](https://reader035.fdocuments.net/reader035/viewer/2022081414/5555a7dad8b42a52568b4798/html5/thumbnails/23.jpg)
embedded Ruby
+ standard library+ main wrapper
+ application code
+ ruby extensions
![Page 24: Crate - ruby based standalone executables](https://reader035.fdocuments.net/reader035/viewer/2022081414/5555a7dad8b42a52568b4798/html5/thumbnails/24.jpg)
embedded Ruby
+ standard library+ main wrapper
+ application codeCrate based application
+ ruby extensions
![Page 25: Crate - ruby based standalone executables](https://reader035.fdocuments.net/reader035/viewer/2022081414/5555a7dad8b42a52568b4798/html5/thumbnails/25.jpg)
RUBYSCRIPT2EXE ?
![Page 26: Crate - ruby based standalone executables](https://reader035.fdocuments.net/reader035/viewer/2022081414/5555a7dad8b42a52568b4798/html5/thumbnails/26.jpg)
http://www.erikveen.dds.nl/rubyscript2exe
![Page 27: Crate - ruby based standalone executables](https://reader035.fdocuments.net/reader035/viewer/2022081414/5555a7dad8b42a52568b4798/html5/thumbnails/27.jpg)
SHOES ?
![Page 28: Crate - ruby based standalone executables](https://reader035.fdocuments.net/reader035/viewer/2022081414/5555a7dad8b42a52568b4798/html5/thumbnails/28.jpg)
MY NEEDS
![Page 29: Crate - ruby based standalone executables](https://reader035.fdocuments.net/reader035/viewer/2022081414/5555a7dad8b42a52568b4798/html5/thumbnails/29.jpg)
MY NEEDS
• Minimally Invasive
• do not unpack to a temporary location
• small as can be
![Page 30: Crate - ruby based standalone executables](https://reader035.fdocuments.net/reader035/viewer/2022081414/5555a7dad8b42a52568b4798/html5/thumbnails/30.jpg)
MY NEEDS
• Minimally Invasive
• do not unpack to a temporary location
• small as can be
• Wide deployment capabilities
• more than linux, mac, windows, cygwin
![Page 31: Crate - ruby based standalone executables](https://reader035.fdocuments.net/reader035/viewer/2022081414/5555a7dad8b42a52568b4798/html5/thumbnails/31.jpg)
embedded Ruby
+ standard library+ main wrapper
+ application codeCrate based application
+ ruby extensions
![Page 32: Crate - ruby based standalone executables](https://reader035.fdocuments.net/reader035/viewer/2022081414/5555a7dad8b42a52568b4798/html5/thumbnails/32.jpg)
Cembedded Ruby
+ standard library+ main wrapper
+ application codeCrate based application
+ ruby extensions
![Page 33: Crate - ruby based standalone executables](https://reader035.fdocuments.net/reader035/viewer/2022081414/5555a7dad8b42a52568b4798/html5/thumbnails/33.jpg)
CRuby
embedded Ruby
+ standard library+ main wrapper
+ application codeCrate based application
+ ruby extensions
![Page 34: Crate - ruby based standalone executables](https://reader035.fdocuments.net/reader035/viewer/2022081414/5555a7dad8b42a52568b4798/html5/thumbnails/34.jpg)
CRuby
Statically Compile
embedded Ruby
+ standard library+ main wrapper
+ application codeCrate based application
+ ruby extensions
![Page 35: Crate - ruby based standalone executables](https://reader035.fdocuments.net/reader035/viewer/2022081414/5555a7dad8b42a52568b4798/html5/thumbnails/35.jpg)
CRuby
Statically Compile
Amalgalite
embedded Ruby
+ standard library+ main wrapper
+ application codeCrate based application
+ ruby extensions
![Page 36: Crate - ruby based standalone executables](https://reader035.fdocuments.net/reader035/viewer/2022081414/5555a7dad8b42a52568b4798/html5/thumbnails/36.jpg)
CRuby
Statically Compile
Pack into Amalgalite
embedded Ruby
+ standard library+ main wrapper
+ application codeCrate based application
+ ruby extensions
![Page 37: Crate - ruby based standalone executables](https://reader035.fdocuments.net/reader035/viewer/2022081414/5555a7dad8b42a52568b4798/html5/thumbnails/37.jpg)
1 CREATE TABLE rubylibs (2 id INTEGER PRIMARY KEY AUTOINCREMENT,3 filename TEXT UNIQUE,4 compressed BOOLEAN,5 contents BLOB6 );
![Page 38: Crate - ruby based standalone executables](https://reader035.fdocuments.net/reader035/viewer/2022081414/5555a7dad8b42a52568b4798/html5/thumbnails/38.jpg)
Executable + C extensions
Ruby libs
Ruby 1.8.6
Crate/ruby 1.8.6
2.4 M 8.4 M
2.9 M 1.9 M
Inexact Size Measurements
![Page 39: Crate - ruby based standalone executables](https://reader035.fdocuments.net/reader035/viewer/2022081414/5555a7dad8b42a52568b4798/html5/thumbnails/39.jpg)
1 module Kernel 2 # alias the original require away to use later 3 alias :amalgalite_original_require :require 4 5 # 6 # hook into the system 'require' to allow for required text or blobs from an 7 # amalgalite database. 8 # 9 def require( filename )10 loaded = amalgalite_original_require( filename )11 rescue LoadError => load_error12 if load_error.message =~ /#{Regexp.escape filename}\z/ then13 loaded = Amalgalite::Requires.require( filename )14 else15 raise load_error16 end17 end18 19 private :require20 private :amalgalite_original_require21 end
![Page 40: Crate - ruby based standalone executables](https://reader035.fdocuments.net/reader035/viewer/2022081414/5555a7dad8b42a52568b4798/html5/thumbnails/40.jpg)
Amalgalite ruby driver is bootstrapped in its C extension
![Page 41: Crate - ruby based standalone executables](https://reader035.fdocuments.net/reader035/viewer/2022081414/5555a7dad8b42a52568b4798/html5/thumbnails/41.jpg)
DEMO
![Page 42: Crate - ruby based standalone executables](https://reader035.fdocuments.net/reader035/viewer/2022081414/5555a7dad8b42a52568b4798/html5/thumbnails/42.jpg)
ISSUE #1 - AUTOLOAD
![Page 43: Crate - ruby based standalone executables](https://reader035.fdocuments.net/reader035/viewer/2022081414/5555a7dad8b42a52568b4798/html5/thumbnails/43.jpg)
ISSUE #1 - AUTOLOAD
• Problem
• bypasses the require chain setup by amalgalite
• used by rack, active_support, active_record
![Page 44: Crate - ruby based standalone executables](https://reader035.fdocuments.net/reader035/viewer/2022081414/5555a7dad8b42a52568b4798/html5/thumbnails/44.jpg)
ISSUE #1 - AUTOLOAD
• Problem
• bypasses the require chain setup by amalgalite
• used by rack, active_support, active_record
• Solution
• Port tree style patches?
• custom gem builds?
![Page 45: Crate - ruby based standalone executables](https://reader035.fdocuments.net/reader035/viewer/2022081414/5555a7dad8b42a52568b4798/html5/thumbnails/45.jpg)
ISSUE #2 - VIEWS
![Page 46: Crate - ruby based standalone executables](https://reader035.fdocuments.net/reader035/viewer/2022081414/5555a7dad8b42a52568b4798/html5/thumbnails/46.jpg)
ISSUE #2 - VIEWS
• Problem
• layout and templates loaded from disk
![Page 47: Crate - ruby based standalone executables](https://reader035.fdocuments.net/reader035/viewer/2022081414/5555a7dad8b42a52568b4798/html5/thumbnails/47.jpg)
ISSUE #2 - VIEWS
• Problem
• layout and templates loaded from disk
• Solution
• wait for Rails 3
• sinatra, others, make patches for upstream, if needed.
![Page 48: Crate - ruby based standalone executables](https://reader035.fdocuments.net/reader035/viewer/2022081414/5555a7dad8b42a52568b4798/html5/thumbnails/48.jpg)
ISSUE #3 - CLASS RELOADING
• Problem
• Development mode reloads classes
• Solution ( for now )
• production mode when running as crate based apps
![Page 49: Crate - ruby based standalone executables](https://reader035.fdocuments.net/reader035/viewer/2022081414/5555a7dad8b42a52568b4798/html5/thumbnails/49.jpg)
QUESTIONS?