After an exhilarating week of hosting the Rails community in Baltimore for , I thought it’d be helpful to share the lessons that we learned organizing .
Community Code Drives Rock!
We had a strong showing of open source authors including , , , , and various members of . Wayne () and Greg () in particular raved about the contributions they were able to make to their projects. Hey, I even got a new release of out thanks to a patch from . Other well known OSS authors that dropped by included , , and . If you were there and we missed you, please drop us a line in the comments!
I just wanted to make a quick note about directory conventions for rack middleware gems. For all gems you should follow the convention of housing all of your code inside a single file and directory of the same name as your gem within lib, e.g.
$> ls -l ~/projects/timecop/lib
drwxr-xr-x 5 john staff 170 Jan 14 20:31 timecop
-rw-r--r-- 1 john staff 82 Jan 14 20:31 timecop.rb
The reason for this is related to how RubyGems hijacks Ruby’s require method. When a gem is activated its lib/ folder is added to the load path. This means that anything inside that directory is now accessible via the require method. In order to avoid file naming collisions across gems, you must name these exactly the same as your gem. (see for a more complete discussions of this)
However, this is slightly different with rack gems. The convention for naming rack middleware is by using a dash, e.g. rack-rewrite. The convention for requiring rack middleware though is to replace that dash with a slash, e.g. require 'rack/rewrite'.
The convention I’ve adopted for structuring rack middleware within a gem is to include a file by the same name as the gem and a rack directory in lib/, and then to include the second part of the middleware name as a subdirectory under that.
~/projects/rack-rewrite (master) $> ls -l lib/
total 8
drwxr-xr-x 4 john staff 136 Apr 17 18:02 rack
-rw-r--r--@ 1 john staff 22 Apr 17 18:02 rack-rewrite.rb
~/projects/rack-rewrite (master) $> ls -l lib/rack
total 8
drwxr-xr-x 3 john staff 102 May 13 11:09 rewrite
-rw-r--r--@ 1 john staff 827 Apr 17 18:02 rewrite.rb
This allows my users to use either require 'rack-rewrite' or require 'rack/rewrite'.
Rack::Rewrite 1.0.0 has just been released. To install simply run: gem install rack-rewrite.
Rack::Rewrite is a web-server agnostic rack middleware for defining and applying rewrite rules. In many cases you can get away with Rack::Rewrite instead of writing Apache mod_rewrite rules.
Documentation is hosted at . The source code is hosted at .
Rack::Rewrite 0.2.1 has just been released. To install simply run: gem install rack-rewrite.
Rack::Rewrite is a web-server agnostic rack middleware for defining and applying rewrite rules. In many cases you can get away with Rack::Rewrite instead of writing Apache mod_rewrite rules.
Documentation is hosted at . The source code is hosted at .
has teamed up with and the (ETC) to create the , an annual technology show and tell event to showcase the technologies being developed in our region. We already have commitments from 20 presenting companies and more than 140 attendee registrations. We expect to have about 200 participants in total.
Maryland Tech Crawl
The Tech Crawl is being held Wednesday, December 16 from 4:30PM to 7:30PM at .
Timecop 0.3.4 has just been released. To install simply run: gem install timecop.
Timecop is a RubyGem providing “time travel” and “time freezing” capabilities, making it dead simple to test time-dependent code. It provides a unified method to mock Time.now, Date.today, and DateTime.now in a single call.
Documentation is hosted at . The source code is hosted at .
At SmartLogic we recently rebuilt our in rails. The previous version was a MediaWiki installation with a ton of content that had garnered a decent bit of Google juice that we did not want to lose. By setting up 301 permanent redirects for the old URL’s, we can hold onto that juice.
is a middleware for defining and applying rewrite rules. Though it’s not a full replacement for , a great deal of rules I’ve previously written in Apache config files can be replaced by Rack::Rewrite. Run gem install rack-rewrite to install the gem.
I typically leverage rewrite rules to take my sites offline for maintenance. Most users will be familiar with the following Apache rewrite ruleset. Read the rest of this entry »
Timecop 0.3.0 has just been released. To install simply run: gem install timecop.
Timecop is a RubyGem providing “time travel” and “time freezing” capabilities, making it dead simple to test time-dependent code. It provides a unified method to mock Time.now, Date.today, and DateTime.now in a single call.
Documentation is on . The source code is hosted at .
Updates include:
API
Completely remove Timecop#unset_all (deprecated by Timecop#return in 0.2.0)
Return Time.now from #freeze, #travel and #return — code contributed by Keith Bennett ()
Maintenance
Fix bug that left Time#mock_time set in some instances
Upped build dependency to jeweler ~> 1.2.1
Don’t pollute top-level namespace with classes/constants
Documentation
Clearer examples in the README, better description in the gemspec