giant robots smashing into other giant robots

Written by thoughtbot

gabebw

SHOULDA BEEN GONE

We haven’t been taking pull requests on shoulda-matchers as much as we shoulda, but it’s back in the spotlight now. Shoulda’s been gone … but it’s back.

Here are the new features in shoulda-matchers 1.1.0:

  • A NEWS file so you can track new hottness in REAL TIME
  • shoulda-matchers’ very first dependency: ActiveSupport >= 3.0.0. This was an implicit dependency for a while, but now it’s official.
  • An only_integer option for validates_numericality_of
  • A query_the_database matcher, so that you can do it { should query_the_database(4.times).or_less }
  • Database column primality is correctly checked
  • The flash matcher can check specific keys using [], like so: it { should set_the_flash[:alert].to("Bad username") }
  • A validates_confirmation_of matcher: it { should validate_confirmation_of(:password) }
  • A serialize matcher: it { should serialize(:details).as(Hash).as_instance_of(Hash) }
  • A have_sent_email matcher can now check reply_to: it { should have_sent_email.reply_to([user, other]) }
  • An accept_nested_attributes matcher

If you filed a pull request and we didn’t take a look, please re-submit or ping me on Github. We’d love to hear from you.

jferris

Inbox Zero: Github Issues Edition

We’ve noticed unpleasant trends in our most popular open source projects:

  • patches not getting merged
  • bugs not getting fixed
  • issues going unanswered

We believe the causes of the problems are:

  • feature requests, help requests, bug reports, and patches all in the same system
  • limited amount of manpower

We want to do better so we’re trying a new policy that we believe is helping.

Limit what’s in the queue

The Github Issues queue should contain items we can act on and close quickly.

This means feature and help requests should be submitted to the appropriate mailing list. If you’re worried about your pull request not being accepted, reach out to us on the mailing list before you start coding.

We’re trying to keep issues restricted to two kinds:

  • Pull requests that we can easily merge in
  • Bug reports that we can act on

We’re always going to be looking at pull requests before issues, meaning the fastest way to get your bug fixed is to submit a pull request that fixes it.

We’ve been doing this on a few projects and the results have been good.

By keeping the list restricted to items that we can act on quickly, we’ve brought Paperclip’s issues count down to 25 from hundreds and Factory Girl’s issue count has consistently been in the single digits.

Although this means that we’ll be closing some issues that might represent real bugs or valuable features, we’ve found that we can actually move more code through the queue by weeding out the issues that we can’t act on.

To recap:

  • Pull requests will be addressed first.
  • Bugs that we can’t reproduce or act on quickly will be closed.
  • Feature and help requests will be closed with a link to the mailing list.

lolconomy

This week in open source

laptop

I was reminded that I’ve been missing out on our sweet laptop script, which is a program we maintain to get a Rails environment set up on OS X as quickly as possible. So over the past week, Antonio Salazar Cardozo (Shadowfiend) fixed our capitalization of Qt (b667280), Prem Sichanugrist (sikachu) fixed our capitalization of JavaScript (87fe88f), and Dan Croak (croaky) removed the deprecated Heroku Labs plugin (842cd0d) and gave instructions on installing the command-line XCode tools (a177cca).

suspenders

The suspenders gem, which has helped many people start a Rails app, now shows that the build is broken. Gabe Berke-Williams (gabebw) added that (76e42eb).

shoulda-matchers

The shoulda-matchers gem is a collection of RSpec matchers for various Rails things. Gabe Berke-Williams (gabebw) went to town on it this week, cleaning everything up in an effort to make it more pleasant to hack on (2b98e49, 09544fa, 7b3d6d0, 96df0b1, 36006d8, 4ff1344, 3b3181b, 4574f51, 1c517d2, bd52483, e70e1bf, 41bccc8). Having done that, he added a :primary option to the have_db_column matcher (68e65b2). Matthew Daubert (MDaubs) fixed a JRuby failure and also added support for Rails 3.0 (d85503f).

bourne

Due to my complaining last week, the bourne gem now has a NEWS file (8dfb077), thanks to Gabe Berke-Williams (gabebw).

paperclip

So we have this gem named paperclip. You might have heard of it. This week, Tony Brewerio (tony-brewerio) fixed the :content_type validator (c4c22f8).

Prem Sichanugrist (sikachu) released version 3.0.1, which breaks backward compatibility (d61ddd5, 51bb0f9, 7088f5b, e1951ed, 9ea4a9b, 36d1289, 8390516, b3f9690, 8e80310, ee4107a, b3a63ed, 8a758c2, 84d2d08, fe706c6, b54904e, d3a7427, da5d716, ee42b19, e83f88f, 03f777f, 5232b19, 19aedbc).

Jon Yurek (jyurek) merged in something he has been working on: adapters for different types of I/O (6c5fe19, e10edcd, f4b6d48, 78cfebd, 89c8d11). Adding new file-like things is now easier, including URLs that act like files. Yeah, that’s right.

Jon is so going to write a blog post about this with more explanations, after he updates the README.

factory_girl

A bunch of fun commits to factory_girl this week. Chris Griego (cgriego) used pull requests as a forum to promote his ActiveAttr gem (81c9f2c and 4e2a672). Joshua Clayton (joshuaclayton) added a before_create callback (24d417d).

Vasiliy Ermolovich (nashby) used ActiveSupport for deprecation warnings (bca13f1 and 28e3c25) and also made use of the singleton_class method in Ruby 1.9 (08d01c1).

Mike Subelsky (subelsky) fixed a typo in the docs around the name FactoryGirl::Syntax::Methods (266b1d6), Dan Croak (croaky) mentioned the supported Ruby versions in the README (bed50ec), Josh renamed Changelog to NEWS because that’s exactly what it is (4f5b775) and also renamed *rb files to *erb to handle yardoc better (a6ccbcb).

capybara-webkit

I totally dropped the ball on releasing a new version of capybara-webkit this week. Sorry about that! Joe Ferris (jferris), however, refactored some of the C++, which is very welcome (c2a2bd0 and 4531f65).

appraisal

Some news in our appraisal gem this week: Gabe Berke-Williams (gabebw) added a contribution guideline (fd05fdf), then osheroff fixed appraisal to handle weird filenames (1d4fa93, b21220a, and 75a4970).

sikachu

Paperclip is Going Three-Point-Oh Nelly

The new version of your favorite file upload library, Paperclip 3.0.0, has been released earlier today. We changed a lot of internals to make Paperclip better. These changes lay the groundwork for the shiny, new features that will come in the future.

Goodbye, Rails 2.3.x and Ruby 1.8.7

Ruby 1.8.7 and Ruby on Rails 2.3.x are both reaching end of life now, so this is a good time to drop support for them. This let us remove some code and introduce a new validator syntax (below.)

If you’re still using Ruby on Rails 2.3.x or Ruby 1.8.7, you should lock Paperclip to version 2.x by doing this:

gem "paperclip", "~> 2.7"

In some rare case that there’s a critical bug in Paperclip 2.7.x, we’ll release a patch version under that minor version. However, you’re advised to upgrade to a newer version of Ruby and Rails as soon as you can.

Modularized Internals

We’re working to extract functionality into modules. We’re not done with this yet, and it is an ongoing process. If you’ve freedom patched Paperclip, you’ll need to look out for this as some of the methods might have new names or locations.

If you are developing a plugin for Paperclip—e.g. custom storage, a processor, or a validator—we would love to hear from you. We want to expose hooks to help you develop your plugin and reduce the risk of breaking things in the future.

Default attachment path has been changed

When you’re installing the new version of Paperclip, you’ll be greeted with this upgrading message:

##################################################
#  NOTE FOR UPGRADING FROM PRE-3.0 VERSION       #
##################################################

Paperclip 3.0 introduces a non-backward compatible change in your attachment
path. This will help to prevent attachment name clashes when you have
multiple attachments with the same name. If you didn't alter your
attachment's path and are using Paperclip's default, you'll have to add
`:path` and `:url` to your `has_attached_file` definition. For example:

    has_attached_file :avatar,
      :path => ":rails_root/public/system/:attachment/:id/:style/:filename",
      :url => "/system/:attachment/:id/:style/:filename"

Going forward, the default URL for your attachment will be /system/:class/:attachment/:id_partition/:style/:filename. This will prevent filename collisions and will reduce the number of files in a single directory.

Rails 3 Validators

All of the validators have been rewritten to take the full advantage of Rails 3. They’re now in their own Validator class, and can be passed into validates or validates_with like any other Active Model validator:

validates :avatar, :attachment_presence => true
validates_with AttachmentPresenceValidator, :attributes => :avatar

We are also introducing a validates_attachment method. This method is almost the same as the validates method except you can skip the :attachment_ prefix. We’ve found this helpful when defining multiple validators on a single attachment:

validates_attachment :avatar, :presence => true,
  :content_type => { :content_type => "image/jpg" },
  :size => { :in => 0..10.kilobytes }

Going forward

I would like to thank our contributors and all of the other users who are helping to make Paperclip better and better. Please give this new version a try. If you find a bug, please file an issue, or better, you can also help us fixing it.

We’re thrilled to introduce the new Paperclip, and we hope that you’ll like them.

lolconomy

This week in open source

bourne

Version 1.1.2 of bourne is out (fba748b), without a NEWS file describing the changes! However, the history indicates that it is compatible with a more recent version of mocha and it presents better error messages now.

bourbon

We’re trying out version 2.0.0, release candidate 1, of bourbon (0ec0115). So please, try it out and let us know what’s broken.

Out of nowhere, Gabe Berke-Williams (gabebw) changed the formatting of something (7ec8959).

But Phil LaPier (plapier) removed animation-basic (316f2a7), cleaned up the default padding for buttons (2a46225), changed the radial-gradient in a way I don’t totally understand (94506ea), added some shorthands for transition (3342577), removed the position mixin (4621347), and updated the README (5f1176d and f5cdfad).

factory_girl

Version 3.0.0 of factory_girl is out: read the blog post to know more. In summary: goodbye five-year-old Ruby 1.8, goodbye two-year-old Rails 2, goodbye four-year-old FactoryGirl syntax!

suspenders

Minor cleanups to suspenders this week: Gabe Berke-Williams (gabebw) fixed some markdown (107b103) and Andy Waite (andyw8) removed some annoying whitespace probably left by someone using TextMate (32104f9) and noted the fact that you must be running Postgres while suspending (de20630).

paul_revere

In paul_revere news this week, Cameron Desautels (camdez) pointed out that controller helpers need to use the helper class method (3b74d84).

shoulda

The shoulda gem got taken care of by Gabe Berke-Williams (gabebw) this week: the Rails test helpers use the installed shoulda-matchers and shoulda-context gems instead of the GitHub ones (6f3b7b4); the dependencies are updated to more recent versions, and the tests require the user of bundler now (34d9f4a); the Rakefile doesn’t present a clobber action, whatever that did (058724b); and the contribution guidelines now reflect the fact that we’ve wanted pull requests for the past three years (f75da74).

shoulda-matchers

This week, Gabe decided to take all pull requests on shoulda-matchers over the past few…years. Gabe Berke-Williams (gabebw) also did a bunch of cleanup and maintainance (c10cf34, 31b140f, c27de41, 7d70805, 7950d00, 3d6b8a8, ff0d364, ca6d428, ba78ed0, 8724cd2, c493c40, f841805, 0746b79, 963a293, 65d6d1c, afaf72b, and 76127ea).

Norway’s own Håkon Lerring (Hakon) added as_instance_of to the serialize matcher (9b5e972, 3b891cf, and d9906d8). Hey Håkon, I’m moving to your neighboring country soon!

Matthew Daubert (MDaubs) added an odd query_the_database matcher, which could be useful for making sure a n+1 is good and dead (0ecb774, 93cd34e, 56de191, 8e7fbc5, 558d1df, and 00a9a68).

Frank Luithle (sigi) extended the allow_value matcher to handle multiple values (cab62a1, c86d8e2, and 026927b).

Luca Guidi (jodosha) updated our dependencies. Sweet. (1956736)

And last but not least, Mike Bloy (bloy) extended the association matchers to understand inverse relations and to check the correct class (a4cb684, 5c173bf, and c863f7e).

capybara-webkit

The capybara-webkit gem got a fix for the RSpec matcher from Chris Nicola (lucisferre), possibly due to an API change elsewhere (8fb7ccd); Will Ryan added keyCode and which to the keypress, keydown, and keyup triggers (c6103e7 and fb97fe8); and Joe Ferris (jferris) refactored everything (1ed54b1, 3ebe0fa, 67d5e3d, 354180a, 85dcc72, and 5b57eee), plus stopped clearing the page on the URL about:blank (b3b1adf).

dotfiles

A bug fix to dotfiles this week as Claudio Ortolina (cloud8421) changed the .vimrc to load the local configs from the homedir instead of just about anywhere (9dc7f9c).

appraisal

A feature in appraisal this week: Gregory Ostermayr (gregors) exposed the bundle command that Appraisal uses to install the Gemfile-specific gems (6b41d07 and 8023273). Gabe Berke-Williams (gabebw) stopped the tests from loading shoulda; instead it loads rake, which is already installed (beaee3b).

fake_braintree

The contribution guidelines were written for fake_braintree by Gabe Berke-Williams (gabebw), which are mostly the same as our others (bd5220a). Namely, we love tests and pull requests.

paperclip

Mostly quiet on the paperclip front, except Dmitry Polushkin (dmitry) snuck a backward-incompatible change into the generated migration (b7bfdec).