RailsConf 2007 Opening Keynote: David Heinemeier Hansson

Posted by Nick Sieger Fri, 18 May 2007 17:10:39 GMT

Rails 2.0

Where we’ve been

David is surprised and proud of the community that we already have, and wants us to be comfortable with where we are, and not always looking toward the future. We have:

  • Million gem downloads
  • Hundreds of plugins
  • 10k users on the rubyonrails-talk mailing list
  • Ruby job descriptions (asking for 3 years RoR experience, longer than David)
  • Books, books, books (and not just English books, but non-English titles as well), surpassing VBA, Perl, and Python in book sales
  • IDEs from NetBeans, Borland, Aptana, etc.

Rails 2.0 is not going to be the “Unicorn”. It’s not going to be a total rewrite, it actually has a release schedule, it will not break backwards-compatibility. Instead, it will build upon what we already have, and continue the philosophy of building on what is useful and needed. In fact, 95% of what’s in 2.0 already works today, in the edge. Example, a simple controller that handles three formats of input/output, with a person resource for accessing the data from a remote server.

class PeopleController < ApplicationController
  ...
  def create
    @person = Person.create(...)
    respond_to do |format|
      format.html { redirect_to person_url(@person) }
      format.xml  { render :status => :created, :location => person_url(@person), ... }
      format.js {
        render :update do |js|
          ...
        end
      }
    end
  end
end

class Person < ActiveResource::Base
  self.site = "http://example.com/"
end

David then goes into a live demo of the new scaffold resource, which by appearance is identical to the old scaffolding, except it comes pre-baked with a REST-ful XML interface. He then adds support for a text format with a couple of lines of code, jumps into IRB, defines an active resource, and proceeds to change the data remotely.

If you want to add search to your controller, you can do it in a DRY way, and all the format/view work you’ve done will benefit:

class PeopleController < ApplicationController
  def index
    if params[:name]
      @people = Person.find :all, :conditions => ["name like ?", "#{params[:name]}%"]
    else
      @people = Person.find :all
    end
    ...
  end
end

David points out that 37signals, Shopify, Fluxiom, et. al. are real sites, with non-trivial domains that are still well executed in Rails, so it’s not just about simple scaffolding demos.

In Rails 2.0, ActiveResource will be bundled with Rails, and ActionWebService will not.

Friends of Rails

  • AJAX!
  • REST!
  • Atom? -- Atom should be more native to Rails
  • Openid? -- Openid is not necessarily something that needs to be used by all, but still a strong ally.

9 other things I like about Rails 2

  • Breakpoints are back -- no longer depends on Binding.of_caller; instead Rails depends and builds upon ruby-debug by Kent Sibilev.
  • HTTP Performance -- streamlining .js and .css, even though it feels better to break up Javascript and CSS into many little pieces, and gzip them
<%= javascript_include_tag :all, :cache => true %>
<%= stylesheet_link_tag :all, :cache => true %>

We can also fake out the browser and configure multiple asset hosts (4) you can maximize browser connections

config.action_controller.asset_host = 'assets%d.highrisehq.com'
  • Query cache
ActiveRecord::Base.cache do
  # actions here are cached
end
  • Rendering and MIME types -- bake the MIME convention into the template, and separate from the rendering mechanism people/index.html.erb people/index.xml.builder people/index.rss.erb people/index.atom.builder
  • config/initializers replacing config/environment. Initializers are .rb files in the config/initializers directory of your app that are automatically loaded during initialization time.
  • Sexy migrations
create_table :people do |t|
  t.integer :account_id
  t.string :first_name, :last_name, :null => false
  t.text :description
  t.timestamps
end
  • HTTP authentication (authenticate_or_request_with_http_basic, authenticate_with_http_basic)
  • The MIT assumption -- the licensing question -- make it easier to understand
  • Spring cleaning -- getting rid of the cruft -- stay tuned!

Tags ,  | 4 comments | no trackbacks

RailsConf Releases

Posted by Nick Sieger Thu, 17 May 2007 17:35:00 GMT

Just a quick update. Firstly, I just released ci_reporter 1.3; it should be available in the gem index shortly. Thanks to Bret Pettichord, Jeremy Beheler, and Charlie Kunz for reporting issues and prodding me to fix a couple of bugs. The two new items in this release are:

  • RSpec 0.9/trunk-compatible. You can now describe/it all you want with ci_reporter.
  • Errors and failure stack traces now include the full error message and exception type.

Secondly, JRuby 1.0RC2 has been released. Although there is no official release announcement at the moment, it is available for download and has been propagated to the central Maven repository also. Please do check it out and let us know on the mailing lists or in JIRA if you come across any blocker issues or regressions. Just a couple more weeks of stabilization; expect a rockin’ 1.0 release in June!

Lastly, expect an ActiveRecord-JDBC 0.3.2 release Real Soon Now.

Tags , , , ,  | no comments | no trackbacks

GoRuCo Materials Available

Posted by Nick Sieger Thu, 10 May 2007 16:16:06 GMT

Busy times! My apologies for the post-conference talk delay. So, before this stuff becomes completely irrelevant, here are my slides and my demos from my talk at GoRuCo a couple weekends ago. Please let me know if you download the demos and have any problems with them.

From the README included in the demo bundle:

JRuby GoRoCo 2007 Demos

Nick gave these demos at his GoRuCo talk in NYC on April 21, 2007 and at SDForum Silicon Valley Ruby Conference on April 22, 2007.

Requirements

JRuby 0.9.9, Tomcat 5.5.23, RSpec 0.8.2, the MySQL JDBC connector as well as all the demo applications are included with this package. The only prerequisite (other than a Java VM) is that you should have a MySQL database running on localhost, with a password-less root user. If you need to change the user/password for the database server, make the changes in the mephisto/config/database.jruby.yml file.

Setup

Source init.sh or init.bat in your environment to set paths to JRuby.

$ . init.sh
> init.bat

JRBuilder

These examples emphasize the conciseness and structure of Ruby DSLs as a GUI assembly language. Run the following:

$ jrake jrb:hello
$ jrake jrb:tabs

View the source for these (and others) in jrbuilder/examples.

RSpec

This shows a simple RSpec example that exercises a Java ArrayList. The initial specs fails, but is easily fixed.

$ jrake rspec:run

Mephisto

This example shows building and deploying a .war file containing the Mephisto blog engine. It uses a snapshot of the Rails Integration plugin just before version 1.1.1.

MySQL is required for the database. As noted above, the database configuration assumes a password-less root user. If you need to change that assumption, edit the production section of the file mephisto/config/database.jruby.yml.

Several targets are available:

$ jrake meph:clean     # Clean Mephisto database and war file
$ jrake meph:database  # Setup Mephisto database
$ jrake meph:war       # Create Mephisto war

Before you can run the example, the mephisto database must be created.

$ jrake meph:database

Next, create the war file. This target creates the war file and copies it into the Tomcat webapps directory.

$ jrake meph:war

Next, run the Tomcat web container, and observe the war file getting deployed.

$ tomcat/bin/catalina.sh run

Finally, visit http://localhost:8080/ in a web browser, and see Mephisto running in a Java web container.

More information on the Rails Integration plugin (now renamed “Goldspike”) can be found at the JRuby wiki.

Tags ,  | no comments | no trackbacks

Gig: Double-stacked Conferences in One Weekend

Posted by Nick Sieger Fri, 20 Apr 2007 15:01:08 GMT

So, on somewhat late notice due to a miscommunication, I’ve been asked to step in and give a talk on JRuby at the SDForum Silicon Valley Ruby Conference this Sunday the 22nd. This, in addition to my already-scheduled talk at GoRuCo! JRuby makes an appearance on both coasts in a single busy weekend!

Due to schedule shuffling, I’ll be sharing a 75-minute time slot in the morning with Tor Norbye, who will be giving a talk on Ruby tooling featuring NetBeans.

Tags , , , ,  | 1 comment | no trackbacks

Gig: Speaking at Gotham Ruby Conference 2007

Posted by Nick Sieger Sat, 24 Mar 2007 04:41:00 GMT

Hey! I’ve been so excited and busy at the same time I forgot to mention I’ll be speaking at the Gotham Ruby Conference on April 21st in NYC located at the Googleplex in Chelsea. Hopefully you’ve got your ticket by now, as last I heard there were only a couple of tickets left. You’ll hear me giving the JRuby pitch: Ruby on the best VM on the planet, performance updates, deploying Rails by dropping a file in a Java webserver, and more. Looking forward to carousing with the fine Rubyists in the Tri-State Metro area! Manhattan was my provenance in 1997-1999, where I had my first programming gig out of college, so I feel like I’m coming back to where I got started, in a way.

Only downer -- I’ll miss the second incarnation of Minnebar, which was a blast last year. If you’re near the Twin Cities that weekend you owe it to yourself to attend.

Tags , , ,  | 1 comment | no trackbacks

JRuby on Rails: Integration Plugin Goes 1.0

Posted by Nick Sieger Fri, 16 Mar 2007 16:55:00 GMT

On the heels of my last post, Robert announced the 1.0 release of Rails Integration, the bits that allow JRuby on Rails to be run out of a Java web archive (war). If you have any interest at all in trying out JRuby on Rails, do yourself a favor and try out the integration bits. Even though this is 1.0, we’re still moving rapidly and would appreciate any and all feedback. (And Robert is doing his best to keep up with changes in core.)

Related to this, Stuart Halloway recently announced his J plugin which is a drop-in collection of Rake tasks that bridge the inherent differences between Rails running on C Ruby vs. JRuby. We still have some work to do in some areas, such as database driver configuration, test database bootstrapping and launching unit tests. For example, instead of the big, ugly, database-specific case statement that’s in Rails’ databases.rake today:

desc "Recreate the test databases from the development structure"
task :clone_structure => [ "db:structure:dump", "db:test:purge" ] do
  abcs = ActiveRecord::Base.configurations
  case abcs["test"]["adapter"]
    when "mysql"
      ActiveRecord::Base.establish_connection(:test)
      ActiveRecord::Base.connection.execute('SET foreign_key_checks = 0')
      IO.readlines("db/#{RAILS_ENV}_structure.sql").join.split("

").each do |table|
        ActiveRecord::Base.connection.execute(table)
      end
    when "postgresql"
      ENV['PGHOST']     = abcs["test"]["host"] if abcs["test"]["host"]
      ENV['PGPORT']     = abcs["test"]["port"].to_s if abcs["test"]["port"]
      ENV['PGPASSWORD'] = abcs["test"]["password"].to_s if abcs["test"]["password"]
      `psql -U "#{abcs["test"]["username"]}" -f db/#{RAILS_ENV}_structure.sql #{abcs["test"]["database"]}`
    when "sqlite", "sqlite3"
      dbfile = abcs["test"]["database"] || abcs["test"]["dbfile"]
      `#{abcs["test"]["adapter"]} #{dbfile} < db/#{RAILS_ENV}_structure.sql`
    when "sqlserver"
      `osql -E -S #{abcs["test"]["host"]} -d #{abcs["test"]["database"]} -i db\#{RAILS_ENV}_structure.sql`
    when "oci", "oracle"
      ActiveRecord::Base.establish_connection(:test)
      IO.readlines("db/#{RAILS_ENV}_structure.sql").join.split(";

").each do |ddl|
        ActiveRecord::Base.connection.execute(ddl)
      end
    when "firebird"
      set_firebird_env(abcs["test"])
      db_string = firebird_db_string(abcs["test"])
      sh "isql -i db/#{RAILS_ENV}_structure.sql #{db_string}"
    else
      raise "Task not supported by '#{abcs["test"]["adapter"]}'"
  end
end

we can use migrations to create the test database:

desc "Recreate the test databases from migrations"
task :migrate_test_db do
  ActiveRecord::Base.establish_connection(ActiveRecord::Base.configurations['test'])
  ActiveRecord::Schema.verbose = t.application.options.trace
  ActiveRecord::Migrator.migrate("db/migrate/")
end

Over time, I hope to see all these efforts coalesce and make the Rails developer experience virtually identical on either interpreter. What would be most excellent is to eventually push some of these improvements back to the Rails core.

Tags ,  | 2 comments | no trackbacks

Process, Thread, Whatever

Posted by Nick Sieger Fri, 16 Mar 2007 04:18:00 GMT

While cleaning up the subprocess launching code in JRuby recently, I pulled a fast one. See, JRuby has this little trick we call an in-process script that allows launching of a separate JRuby runtime in the same process. Basically, we look for the command-line passed to Kernel#system or Kernel#backtick, and if the program name contains “ruby” or ends in “.rb”, we assume the caller wants to launch another JRuby interpreter and launch the command in the same process instead of spawning a new one. Set aside for a moment the question of whether this is “the right thing” to do.

In my desire to dry up this code a bit, but also to extend the same behavior for IO.popen, I needed the in-process script to behave like a real process. So hey, why not extend java.lang.Process? The details are in the ShellLauncher code, but it turns out, oddly enough, this actually works.

I think this points out an interesting feature of JRuby -- that it’s process-agnostic. You can map JRuby runtimes M:N with processes in any combination you like. In fact, this is what’s currently being done with the Rails Integration (Rails-in-a-war-file) code -- a pool of JRuby runtimes preloaded with Rails are used to run the Rails application from a Java servlet. Robert Egglestone’s been doing some great work with Rails Integration and the possibilities are only starting to reveal themselves.

Tags  | no comments | no trackbacks

JRuby Update: Continuous Improvement

Posted by Nick Sieger Fri, 16 Mar 2007 03:47:17 GMT

JRuby development pace has been fast and furious for the past few months, and, at times dangerous. While the overall gains have been significant, occasional regressions to various parts of the interpreter and applications such as rubygems have been frustrating for people trying to track the bleeding edge.

Well, no longer. I’ve now got Bamboo up and running, continuously building JRuby itself, as well as test suites of third-party software. Right now, there is a gem install smoke test (for ensuring basic gem install continues to work) as well as the ActiveSupport tests (which are run with CI::Reporter of course so we can track test failures -- now you see the method to my earlier madness).

On the short list for new builds to be added to the CI server are:

  • Testing the rest of the Rails components
  • ActiveRecord-JDBC
  • Nightly snapshots for those who want to track development but don’t want to build from source

If you have a favorite pure-Ruby package or code that exercises JRuby in a public source repository, let me know and we’ll consider adding it to Bamboo so you (and we) know if and when it breaks, or how badly it’s broken.

On a side note, I’ve quietly released CI::Reporter 1.1; you should be able to get it from gems soon. Quietly, because there was only a small, non-essential change -- an assertions attribute was added to the testsuite element in each XML file. Custom applications wishing to count the number of assertions per test suite can parse it out of the XML. Maybe there’ll be a non-XML output format in the future, but I don’t need it now, so it’s not going to be built.

Tags ,  | 1 comment | no trackbacks

ActiveRecord-JDBC 0.2.3 Released

Posted by Nick Sieger Tue, 06 Mar 2007 03:58:00 GMT

ActiveRecord-JDBC version 0.2.3 has been released!

Install

Use JRuby to install the gem into your JRuby installation as follows. Currently, Rails is not a dependency of ActiveRecord-JDBC; it is assumed you’re going to have Rails installed already.

$ jruby --command gem install ActiveRecord-JDBC
Successfully installed ActiveRecord-JDBC-0.2.3
Installing ri documentation for ActiveRecord-JDBC-0.2.3...
Installing RDoc documentation for ActiveRecord-JDBC-0.2.3...

See the new RDoc documentation on Rubyforge for more information on how to use ActiveRecord-JDBC. If you’re grabbing the new JRuby 0.9.8 release, be sure you get this one as well if you plan to try out JRuby on Rails.

Changes

  • Release coincides (and compatible) with JRuby 0.9.8 release
  • 8 bugs fixed
  • Improvements and compatibility fixes for Rails 1.2.x

Comments, questions, test cases, patches and all that are welcome over on the jruby-extras mailing list.

Tags , ,  | 6 comments | no trackbacks

Countdown to 1.0: JRuby 0.9.8 Released

Posted by Nick Sieger Tue, 06 Mar 2007 02:51:35 GMT

JRuby 0.9.8 is hot! With the release of JRuby 0.9.8, the countdown begins. The reason we jumped from 0.9.2 up to 0.9.8 are several:

  • Now there are only two more releases to 1.0, with 1.0 landing in May.
  • This release fixes more issues, has more changesets, improves performance, etc. etc. etc., more than all the other 0.9.x releases combined.
  • Rails support is something to feel good about, more than a single point release for sure

Stay tuned for details on the new release in the coming days. Be sure to download JRuby 0.9.8 today (source) and let us know how it goes!

Tags ,  | no comments | no trackbacks

Older posts: 1 ... 7 8 9 10 11 ... 17