Warbler 1.0

Posted by Nick Sieger Tue, 06 Apr 2010 17:11:17 GMT

It’s past due time to “carry the 1” over and roll over to a 1.0 version of Warbler. This time around, the changes in the codebase are significant enough that I hope you’ll find many past usability issues resolved.

Assemble in-place

The biggest change is that Warbler now creates a war file in place, without an intermediate copy-to-assemble step. Warbler does this using the rubyzip gem, or alternatively using a small Java extension when run under JRuby 1.5 or greater. This should reduce processing and confusion due to the extra copy, which can sometimes get out of sync. The downside is that Warbler cannot be used easily for exploded directory development, though you can always create the war file and unpack it to a staging area.

Simpler extension

Warbler also underwent an internal refactoring that should make extending it much easier. Here’s how you add Warbler tasks to your Rakefile:

require 'warbler'
Warbler::Task.new

In versions prior to 1.0, if there were deploy steps that created new files that didn’t exist at the time the Rakefile was loaded (such as what the asset:packager:build_all task does in the asset_packager plugin), it was tricky to get Warbler to recognize them. No longer -- now the expected Rake configuration should do the trick.

require 'warbler'
Warbler::Task.new
task :war => "asset:packager:build_all"

Bundler support

Another exciting development in the Ruby development world is Bundler, and Warbler 1.0 supports packaging your bundled gems with it. Warbler even creates a .bundle/environment.rb file inside the war file that loads the gems from relative paths to where Warbler puts the gems in the war file.

More configuration

There are a number of new configuration options, so check out the new configuration and see if any are useful to you.

  • config.gem_home allows you to control the path inside the war file where Warbler will pack your application’s gems. For use with older versions of Bundler or other custom gem vendoring schemes.
  • config.webinf_files is a file list that can contain multiple files, XML or otherwise. If the files named in this list have .erb extensions, they will be expanded in the same manner as web.xml.

Rails 3 support

JRuby-Rack, the servlet adapter component bundled by Warbler, also received a version bump, and there are no longer any Java libraries included in the Warbler gem, so the two components can be versioned independently. With the release of both Warbler 1.0 and JRuby-Rack 0.9.7, Rails 3 applications can be warbled and deployed seamlessly, often without any additional configuration.

Please continue to send feedback to the JRuby mailing list or the Warbler bug tracker. Enjoy!

Tags ,  | 2 comments

RubyConf India 2010!

Posted by Nick Sieger Fri, 12 Mar 2010 23:21:04 GMT

I’m honored to be heading to the first ever RubyConf India in Bangalore next week. I’ll be delivering an update on Rails 3, JRuby, and what’s in store for the future of the combined platform in 2010. I’m looking forward to meeting you there!

I'm speaking at RubyConf India 2010

Tags , ,  | 2 comments

Toward a GoDaddy-Free Life

Posted by Nick Sieger Thu, 11 Mar 2010 20:25:51 GMT

Ask ten geeks who their favorite domain registrar is, and you’ll get ten answers -- though I doubt GoDaddy would be one of them. Their heavily-ad-filled, upselling, confusing site makes even the most patient webmaster’s skin crawl, and don’t even get me started about their embarrassingly titillating Super Bowl tease ads.

Along those lines, there seems to be a fair amount of myth around GoDaddy inertia. While not what I’d describe as a pleasant experience, it is possible to extricate yourself from GoDaddy. Here’s the process I took, which took maybe an hour start-to-finish. Maybe I just got lucky and hit the right buttons, so YMMV.

I decided to go with Dynadot as my new registrar based on reasonable prices, some good words from other hackers, available features such as email forwarding (so I don’t have to maintain a Postfix server), and a clean-looking site. So far I have not been disappointed -- the account panel is straightforward and easy to use, the purchase process is quick, and I haven’t had any hiccups with the transfer.

So herewith are the steps I took:

  1. Prepare the GoDaddy domains for transfer.
  2. Make sure you don’t change the Organization or First/Last Name in any of your domain contact fields! It appears that GoDaddy will put a 60-day lock on your domain if you do so.
  3. Cancel any Domains by Proxy private registration. The new registrar needs to be able to fetch an email address from WHOIS that’s under your control.
  4. Make sure the domains are unlocked. You can do this in the Domain Manager by selecting the domains to transfer and clicking the “Lock” icon, and selecting to unlock them in following dialogs.
  5. Get an authorization code for each domain you wish to transfer. To do this, you have to visit each individual domain in the Domain Manager, and click the link to send the code via email. You should have the codes within 10 minutes.
  6. Initiate a transfer or bulk transfer, specify the authorization codes for each domain, and check out.
  7. Within another 10 minutes Dynadot initiates the transfer by sending email to the address in the WHOIS record for each domain.
  8. In the email, click on a link back to Dynadot and authorize each transfer.
  9. Within another 10 minutes Dynadot contacts GoDaddy and initiates the transfer.
  10. Receive an email from GoDaddy that they acknowledged the transfer.
  11. To speed up the transfer process, go back into the Domain Manager one last time. Under the “Domains” hover menu, look for the “Pending Transfers” item.
  12. See the domains listed in the Pending Transfer queue. Select all and click the “Accept/Deny” button, select “Accept” in the prompt.
  13. Within another 10-20 minutes, receive confirmation from Dynadot that the transfer has been completed. You can now go into the Dynadot panel and manage your DNS and other settings.
  14. Apparently you can’t fully cancel your GoDaddy account, but you can remove all payment methods, services and turn off email notifications.

Bask in the glory that is your renewed life as a website operator!

7 comments

JRuby and Rails 3, Sitting in a Tree

Posted by Nick Sieger Wed, 24 Feb 2010 03:58:00 GMT

Synopsis

jruby -S rails new myapp -m http://jruby.org/rails3.rb

When creating your Rails 3 application, just add the JRuby-specific template (-m http://jruby.org/rails3.rb).

Details

$ jruby -S gem install rails --pre --no-rdoc --no-ri
Due to a rubygems bug, you must uninstall all older versions of bundler for 0.9 to work
Successfully installed i18n-0.3.3
Successfully installed tzinfo-0.3.16
Successfully installed builder-2.1.2
Successfully installed memcache-client-1.7.8
Successfully installed activesupport-3.0.0.beta
Successfully installed activemodel-3.0.0.beta
Successfully installed rack-1.1.0
Successfully installed rack-test-0.5.3
Successfully installed rack-mount-0.4.7
Successfully installed abstract-1.0.0
Successfully installed erubis-2.6.5
Successfully installed actionpack-3.0.0.beta
Successfully installed arel-0.2.1
Successfully installed activerecord-3.0.0.beta
Successfully installed activeresource-3.0.0.beta
Successfully installed mime-types-1.16
Successfully installed mail-2.1.3
Successfully installed text-hyphen-1.0.0
Successfully installed text-format-1.0.0
Successfully installed actionmailer-3.0.0.beta
Successfully installed thor-0.13.3
Successfully installed railties-3.0.0.beta
Successfully installed bundler-0.9.7
Successfully installed rails-3.0.0.beta
24 gems installed

And:

$ jruby -S gem install activerecord-jdbcsqlite3-adapter --no-rdoc --no-ri
Successfully installed activerecord-jdbc-adapter-0.9.3-java
Successfully installed jdbc-sqlite3-3.6.3.054
Successfully installed activerecord-jdbcsqlite3-adapter-0.9.3-java
3 gems installed

Finally:

$ jruby -S rails new myapp -m http://jruby.org/rails3.rb
      create
...(app creation)...
       apply  http://jruby.org/rails3.rb
       apply    http://jruby.org/templates/default.rb
        gsub      Gemfile
         run      jruby script/rails generate jdbc from "."
...(warnings omitted)...
       exist  
      create  config/initializers/jdbc.rb
      create  lib/tasks/jdbc.rake
$ cd myapp
$ jruby script/rails server
...(warnings omitted)...
=> Booting WEBrick
=> Rails 3.0.0.beta application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2010-02-23 19:44:26] INFO  WEBrick 1.3.1
[2010-02-23 19:44:26] INFO  ruby 1.8.7 (2010-02-23) [java]
[2010-02-23 19:44:26] INFO  WEBrick::HTTPServer#start: pid=16449 port=3000

rails-welcome

Recap

You’ll have best results with JRuby 1.5 snapshots, which include RubyGems 1.3.6. JRuby 1.5 final is coming soon. Also, the new activerecord-jdbc-adapter 0.9.3 release is required for Rails 3 compatibility.

The Rails experience on JRuby continues to get better.

Tags ,  | no comments

Gem clash: activerecord-jdbc-adapter and pg

Posted by Nick Sieger Thu, 28 Jan 2010 15:16:49 GMT

I got a note from a community member about an annoying problem that a few people have run into when installing activerecord-jdbc-adapter (AR-JDBC) into a C Ruby implementation:

NameError: uninitialized constant
ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::PGconn

Turns out it’s pretty easy to momentarily forget to use jruby -S gem or jgem and just gem install activerecord-jdbc-adapter and suddenly your pg Postgres gems are not working properly. I thought it was worth documenting here in case others run into this problem.

I apologize for the clash. I had to provide a stub pg.rb in AR-JDBC inside of JRuby so that I could get active_record/connection_adapters/postgresql_adapter.rb to load with a database adapter type of postgresql. Because of load path order issues, I couldn’t get AR-JDBC’s code to load before ActiveRecord’s. At the time I was thinking this wouldn’t be a problem because the pg library won’t work on JRuby anyway, right? Wrong.

I can think of a couple options going forward:

  1. Submit a patch to ActiveRecord so that active_record/connection_adapters/postgresql_adapter.rb can load without requiring pg up front and then AR-JDBC won’t have to stub it out.
  2. Display a big fat warning message when AR-JDBC is installed into anything other than JRuby.

Any other thoughts?

Tags ,  | 2 comments

New Hpricot Release

Posted by Nick Sieger Fri, 06 Nov 2009 16:06:37 GMT

It’s with a modicum of fanfare and a cocktail of orange peel, maraschino, bitters, bourbon and vermouth that I announce the 0.8.2 release of Hpricot.

hpricot

The angly thingies are just two martini glasses turned on their side, see? Pouring out hpricoty goodness for you. (I don’t know if _why imbibed alcoholic beverages but I feel the desire to raise a glass to him.)

This release is mostly a refresh; the previous release was way back in April. From the Git logs I can see that there were a few bug fixes since then. Otherwise, the main addition is a modern JRuby release, thanks to Ola Bini. (the previous was the 0.6 series). This does fix a fairly old, popular JRuby bug.

As for the future of Hpricot, it’s up to you. I know it’s still a trusty tool for many; I have no grand plans to change it. So if you encounter bugs and want to send patches, I’m happy to serve as your curator.

Tags , , ,  | 2 comments

Fresh 0.9.2 activerecord-jdbc-adapter Release

Posted by Nick Sieger Mon, 12 Oct 2009 18:30:45 GMT

As announced last week on the jruby-user list, 0.9.2, the latest activerecord-jdbc-adapter release, has been pushed out. Please install the gem in the usual fashion and try it out on your applications.

One of the most contentious bugs broke db:create and db:drop, ruining the quick-start workflow that Rails is known for. To fix this, a creative solution was needed that ended up bringing some nice benefits.

The problem stemmed from the fact that some database setup tasks in Rails 2.3 no longer load the environment; instead they just load the configuration data and work with that. This means that there is no easy way to hook into Rails and override those tasks, which is what activerecord-jdbc needs to do.

The solution I ended up with was to create a jdbc Rails generator that inserts a couple files into your rails application that inject the JDBC logic into ActiveRecord and the database rake tasks. To wit:

$ jruby script/generate jdbc
      exists  config/initializers
      create  config/initializers/jdbc.rb
      exists  lib/tasks
      create  lib/tasks/jdbc.rake

The upside of this new technique is that now that we have a way to ensure the JDBC adapter is properly injected into Rails, and you no longer need to use adapter names like jdbcmysql, jdbcsqlite3 and the like. The net result is that database.yml no longer needs to be modified for the default Rails databases (mysql, sqlite3, postgresql). So while we introduced one additional step in the process to bootstrap a Rails application under JRuby, the removal the step where database.yml needs to be modified results in a more predictable workflow.

The new JRuby-specific Rails workflow looks like the following, assuming you’ve installed the activerecord-jdbc-adapter gem into JRuby, along with the appropriate database driver gem (e.g, jdbc-mysql). (Of course, the gems only need to be installed once per JRuby installation.)

  1. Create your Rails application as usual.
  2. Run the jdbc generator as shown above.
  3. Profit!

Additionally, if you maintain a Rails application template that you use to start a new application, you can simply add generate(:jdbc) to that template’s script.

What’s more, the presence of the JDBC files in your application are guarded and only inject JDBC support when running under JRuby, so you can safely keep them around when running Rails under multiple Ruby implementations.

For more details of what’s in the release please consult the mini-changelog on Rubyforge and the list of fixed issues in JIRA.

Tags , ,  | 9 comments

JRubyConf 2009: First of Many!

Posted by Nick Sieger Sat, 12 Sep 2009 04:22:15 GMT

I’m so excited to see the news finally hit the wire today about the paint drying on the plans for JRubyConf 2009!

jrubyconf-sf.jpg

We always joked about having the first JRubyConf in the middle of a brisk Minnesota winter at Tom’s Cabin, but I think this will do nicely!

cabin

Please go quickly and register! Though there is no fee for the day, we only have a limited number of spots available!

P.S. This post is a little late to the party; I was in the air on the way back from JavaZone. If you want a peek at what’s been happening in JRuby land you can check out the slides from my talk there.

Tags ,  | no comments

What's New: Releases and Oh Right, a New Gig

Posted by Nick Sieger Thu, 27 Aug 2009 20:12:00 GMT

So, after a long, busy summer, I’m finally back onto support of the various bits for JRuby web application development (meaning Warbler and JRuby-Rack). I’m pleased to announce the 0.9.5 release of JRuby-Rack and the 0.9.14 release of Warbler! All of this brought to you courtesy of Engine Yard, my new employer!

Both of these are long-overdue releases. Here’s the low-down on each:

JRuby-Rack 0.9.5

For the full history, see the 0.9.5 entry in the History.txt file.

One bad bug in particular prevented you from running Rack-powered Rails 2.3 out of the box at all because JRuby-Rack bundled an older version of Rack than needed by Rails. This has been fixed for good by not forcing JRuby-Rack’s bundled copy of Rack on your application; any version of Rack you include (either via gems or vendor’ed in Rails or your application) will take precedence.

Another major upgrade is the introduction of rewindable requests. The Rack spec dictates that the request IO object be rewindable and that server/handler writers (such as myself) need to buffer the input. You’d think that Java application servers would do this for you, but, as is the case with Java so often, servers perform the bare minimum amount of work and leave the grunt work to the application developer. So JRuby-Rack takes care of the input buffering for you. The first 64k of input data are buffered entirely in memory; above that the request body is dumped into a temp file. (64k is a default and is configurable. If you have a better suggestion for a default, let me know.)

Finally, this release brings back Java Servlet-based sessions for use with the Rack-based session mechanism. For those of you experimenting with hybrid Rails/Java applications and want to share session data between them, you’ll want this. Servlet sessions are not the default; you need to turn them on by setting ActionController::Base.session_store = :java_servlet_store.

Warbler 0.9.14

Warbler’s main change this release is to unbundle JRuby. When you install Warbler as a gem, you’ll now get a dependent gem called jruby-jars installed for you. We’ll be releasing a new version of this gem with every release of JRuby, and you’ll be able to upgrade JRuby versions without having to update Warbler.

JRuby-Rack is still bundled with Warbler for now (0.9.14 comes with JRuby-Rack 0.9.5 of course), but the jar file is not that big and the two projects tend to be released around the same time. By Warbler 1.0 I hope to have a mechanism to unbundle all jar files so that Warbler is just a lightweight Rake library with enough smarts to fetch the binaries your application needs.

Future

The projects seem to be headed for a 1.0 release soon. For these releases, I hope to ensure that they are both ready to take advantage of Rails 3 out of the box. One of the ways is to use Bundler in Warbler to manage gems. Hopefully as Rails 3 and other applications start to standardize Bundler manifests, it means less custom configuration for Warbler.

Since the core of JRuby-Rack seems to be stabilizing, the next promising step is to explore more ways to integrate with existing Java code and Java applications. This should dovetail nicely with JRuby’s plan for better Java integration in the upcoming JRuby 1.4 release. For example, Christian Seiler explained how he’s using JRuby-Rack to integrate JMS while running an in-memory ActiveMQ server for his site blissmessage.com. These kinds of ease-of-use scenarios where you can start a single process with all of your application needs: web server, message queue, timer for periodic tasks etc. present a great way to jumpstart a project. I’d like to see some of these APIs standardize so that we can transition from all-in-one development servers up to scalable production clusters where app, message queue, and other servers are separated and standalone.

The fellows over at Google have been busy this summer with the appengine-jruby project, and there are opportunities for tuning that experience as well.

Of course, your suggestions are welcome too. I’d appreciate it if you’d drop me a line if you’re doing something novel with these tools, so I can help shape future directions around people like you who are Getting Things Done with them!

(Postlude: Both these projects need a logo. If you can mock something up, I’d love to see some ideas!)

Tags , , ,  | 1 comment

Which Tool Would You Use?

Posted by Nick Sieger Fri, 12 Jun 2009 20:34:27 GMT

I started in on the twice-yearly task of pruning our hedges today. So confronted with this task:

Shearing the shrubs

Which tool would you use?

Which tool?

I used both today, but realized I enjoy using the hand trimmers much more. With the electric trimmers, you can buzz through a lot of hedge quickly, but sometimes this happens:

Too close

With the hand trimmers, I can take my time and make precise cuts. The end result may take more time, but it turns out much, much better.

Software tools have similar feels to me. Java feels an awful lot like the electric trimmers. It’s heavy and powerful, but sometimes by the time you’ve finished with it, you’ve cut so far in that you may have missed a simpler, lighter solution.

Ruby feels like the hand trimmers. Precision, less code, more intent, and I can take my time to think through and arrive at a solution without leaving a huge trail of trimmings (code) behind me.

Tags  | 4 comments

Older posts: 1 2 3 4 ... 17