Download presentation
Presentation is loading. Please wait.
Published byCleopatra Gregory Modified over 9 years ago
1
Sakai on Rails Integrating Ruby and Sakai David Adams, Virginia Tech
2
Topics to cover Quick introduction to Ruby and Rails Why consider Rails for Sakai? How to integrate Ruby and Java How to integrate Rails and Sakai Tiny demo if we have time
3
Caveats I’m a sysadmin, not a programmer I’m new to Sakai I’ve never written a Sakai tool in Java This is bleeding edge technology This presentation is a starting point
4
What is Ruby? Programming language Dynamic, interpreted, strongly-typed Built on ideas from many other languages: –The good parts of Perl –Smalltalk-like OO: everything is an object –A few dashes of Scheme http://www.ruby-lang.org
5
Really Cool Stuff about Ruby Concise syntax, easy to read Metaprogramming –Redefine classes at runtime Like Javascript, “a crazed language” per Antranig –method_missing? Duck typing –If it looks like a duck and quacks like a duck… (These can be good and bad)
6
The Ruby Community “Ruby may not actually be the be-all and end-all of programming languages. But right now, make no mistake, it's a white-hot nexus of innovation.” -- Tim Bray, Sun Microsystems, co-creator of XML
7
What is Rails? Web application framework Built on Ruby Unique to Ruby Strict MVC pattern More than just a CRUD generator
8
Really Cool Stuff about Rails Convention over configuration Use Ruby for everything (DSLs) –SQL migrations, schemas –Javascript (RJS) –Templates (Markaby) –URL mapping (Routes) –Maintenance tasks (Rake) –Okay, some stuff has to be in YAML
9
More Really Cool Stuff about Rails Integrated testing framework Integrated data validation Robust plugin system Robust AJAX integration ActiveRecord (ORM) –Discovers the database structure without help –Harnesses Ruby’s metaprogramming abilities –Just as useful outside of web applications
10
Why use Rails? Write applications quickly “Powerful web applications that formerly might have taken weeks or months to develop can be produced in a matter of days.” – Tim O’Reilly Less code, better maintainability Ruby is fun!
11
Who cares? Why should the Sakai community care? –Perfect for ad hoc and internal use tools –Rapid prototyping – with functionality B-but Rails is Ruby; Sakai runs on Java…
12
JRuby 1.0 Released June 10, 2007 “Our main goal for 1.0 has been Ruby compatibility. We feel this goal has been reached.” – Thomas Enebo Run Ruby (and thus Rails) in the JVM In some cases, can be faster than C Ruby http://www.jruby.org
13
Rails in a Servlet Goldspike (Rails-Integration) –Rails plugin –Packs Rails app (and dependencies) in a WAR –Experimental Maven 2 support –Kinda flaky; needs tweaking to work with Sakai –http://www.headius.com/jrubywiki/index.php/Rails_Integration
14
A Sakai Tool in Rails Take a Goldspike WAR Tweak the web.xml file Add the sakai.toolname.xml file Done! (mostly) Sakai on Rails plugin: –https://source.edtech.vt.edu/svn/sakai/rails/trunk/pluginhttps://source.edtech.vt.edu/svn/sakai/rails/trunk/plugin –Generator, templates, library
15
Demo Create a Rails app that runs as a Sakai tool I won’t go through the environment setup –It’s painful and error prone –Goldspike requires tweaks to work with Sakai No time to do anything fancy
16
Downsides Something new to learn Sakai is built on Java idioms No way (yet?) to call Ruby classes from Java directly ActiveRecord versus Sakai APIs “Attempts to code directly to Sakai databases will only lead to heartache and disappointment.” – Mark Norton
17
Now what? Sakai on Rails not yet ready for prime time Study performance impact Streamline/document environment setup Goldspike needs to be “fixed” Provide Ruby-ized access to Sakai APIs Start building small tools
18
Thanks! David Adams, daveadams@vt.edu
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.