Another week of great pull requests to our open source projects.
A new gem, started by Gabe Berke-Williams (gabebw) with much help from Nick Quaranto (qrush), kumade is a drop-in Heroku deployer that handles assets, migrations, and sanity checks. It’s under heavy development so stay tuned to hear more, or try it out yourself.
The name comes from the Japanese word for “bamboo rake” and is pronounced “koo-mah-day”.
Appraisal is our gem for testing engines against multiple versions of Rails—or really, for testing any gem against multiple gemsets. We use it to make sure our gems continue to work against various version of Rails.
Matt Griffin (betamatt) noticed that the excellent Aruba gem is listed as a runtime dependency even though it is most definitely a development dependency, and fixed that (276cc9b).
Clearance, our authentication engine, got a little formatting fix for the README (77bb97a) thanks to Quico Moya (qmoya).
Our popular fixture-improving testing gem, factory_girl, got more specs for assigning associations (841e012) from Josh Clayton (joshuaclayton) and a hard decision that non-block values are evaluated before block values (28f541e) thanks to Flavio Castelli (flavio).
Since we love pushing new versions while I’m writing this, Josh then pushed version 2.0.3 of factory_girl (ec88698).
Our headless webkit-based integration testing tool, capybara-webkit, saw a bunch of documentation and session love this week.
Dennis Prochniak (denysonique) and Diego Plentz (plentz) clarified documentation for Gentoo (9b53e01 and 8850f2d) and OS X Lion (47b8c86), respectively.
Our file uploading gem, paperclip, got some love this week: Reinaldo de Souza Junior (juniorz) localized error messages by default (6fd2cf7) while Matthew Schulkind (mschulkind) generalized the filename extension then made it generate the correct one based on the content type (fdbd7bf).
We saw some bundler- and gem-related upgrades to paul_revere, the gem to add quick announcements to Rails apps, thanks to Christopher Meiklejohn (cmeiklejohn) (7d5eebc, 334bb25, 260db1a, 3039333, and e217b85).
Phil LaPier (plapier) continues on with bourbon, cleaning up the README (02900ae) and fixing a bug in
linear-gradient (4802351). He then pulled in a documentation fix from Andrés Mejía (andmej) to include
box-shadow in the full list of mixins (78cf621) before releasing version 0.1.3 of bourbon (09a875f).
Nick Quaranto (qrush) went on a CI kick, trying Travis CI for our open source projects. He added it to high_voltage (1fcf319, d21b037, and cb4a53c), shoulda (928311d), and paperclip (8d95066, 6c501ef, 6cef277, e02613d, and 24cc278).
Prem Sichanugrist (sikachu) joined in on paperclip, fixing the Gemfile (e0bbebc) and adding JRuby support (b08c6c6).
This week saw updates to our dotfiles, suspenders, capybara-webkit, factory girl, paperclip, bourbon, flutie, and clearance projects.
I’ve also added a file named
CONTRIBUTING.md to each project, describing how to submit patches. Patches are welcome!
We maintain a set of configuration files for vim, zsh, and so on, in our dotfiles repository. Gabe Berke-Williams (gabebw) added the
:Cuc command to vim which will run all scenarios (d57e450). You can pass text to restrict to just scenarios matching. As the commit message explains:
:Cuc my text (no quotes) -> runs cucumber scenarios containing "my text"
Alex Godin (alexgodin) added Cucumber as a development dependency to Suspenders (a57c975, 4fc3979, 6e429c5, and 872ff64), our app generator. He then noticed that prior versions of the gem were broken so he released version 0.2.6 of Suspenders.
Gabe Berke-Williams (gabebw) exposed the underlying socket to a logger, which verbosely prints information about all data sent to and from the headless browser (a4538b6 and 01665e6). Activate it by setting
The factory_girl and factory_girl_rails fixture-replacement gems got some small updates this week. The ever-commiting Gabe Berke-Williams (gabebw) handled documentation typos (cec108d and b3f8ac8) then updated the docs to point out the existance of the reusable Cucumber steps (49a47fa and 811fd04). Simon Hürlimann (huerlisi) continued on the documentation fixes by pointing out that
factory_girl_rails is at version 1.1.0 (8bd8e0c).
Nick Quaranto (qrush) fixed the afore-mentioned Cucumber steps to work in the newest versions of Cucumber by stringifying all values (d8aa63a), then he released version 2.0.2 of FactoryGirl (1d9a3cf).
Paperclip is our gem for uploading files to Rails apps. Some regression and infrastructural changes: Tim Cooper (coop) found that the documentation had a feature that the code didn’t, so he defaulted the
:fog_public option to
true (62a9f64). Trung le (joneslee85) noticed that
sqlite3-ruby is now
sqlite3 and fixed our dependencies to match (f815726). And Prem Sichanugrist (sikachu) continued on his testing bent by adding jruby to the mix (0f7485f, b62330a, and 1ad401a).
Speaking of testing, Chris Sepic (cgs) found that the
validate_attachment_content_type matcher has
rejecting methods on it, but that you must specify both. He relaxed this restriction so now you can specify either (0206259).
Today aya-soft fixed Paperclip to work in Rails 2.3.8 (e0b139d and e0b139d), then Prem Sichanugrist (sikachu) released version 2.3.16 of Paperclip (891badb).
Phil LaPier (plapier) did more work on bourbon, the Sass gem with awesome mixins. He added fade-in and fade-out animations (46e36a2). He also updated the documentation to be explicit about browser support (3b9b58b) and also pedantically ordered the imports alphabetically (2278b58).
He then topped it all off by releasing version 0.1.2 of bourbon (1d9bac8).
Working with Phil’s on bourbon, Matt Jankowski (mjankowski) noticed that the
sass-mixins gem was renamed to
bourbon so he made that fix in flutie (d42e838).
Our authentication gem, clearance, got an upgraded Cucumber (89f106f) and one fewer broken Cucumber step (6b7c6e0), thanks to Chad Pytel (cpytel).
This week saw improvements to suspenders, fistface, factory_girl, capybara-webkit, bourbon, and paperclip. Contributions came from other thoughtbot devs but also pull requests from people like you. Thank you!
Gabe Berke-Williams (gabebw) improved the test infrastructure of Suspenders by making the default
REPO the same as the base directory of the gem (in three commits: 397675a, 0932829, and ae96481). He also switched Suspenders to use PostgreSQL by default, which makes sense given how often we use Heroku and also given that PostgreSQL is obviously better than MySQL (7bb5236, 2cf556b).
Fork it and submit your own pull request.
Gareth Rees dropped some great changes to Fistface: gemification, so you can add it as a dependency (ea096a3, 1ff49d7, and 85e57cc); modularization, so you can load individual components of it and unit test it (d1a0175 and 607eef9); and an overall upgrade of the dependent gems (afcb413).
Fork it and submit your own pull request.
No commit is too inconsequential! Gabe Berke-Williams (gabebw) improved the README syntax highlighting for factory_girl. More highlighting in more places. (8ad1cc6)
At the last minute, as this post was about to be published, Josh Clayton (joshuaclayton) fixed
find_definitions for Ruby 1.9.x when used on the
./script/rails console (8ef79aa, a51b970, c47affb, and 17f3ef4).
Then Josh pulled out all the stops and released FactoryGirl 2.0.1 (d175bf4 and ff1a019). You heard it here first!
Perhaps you too want to submit a doc patch. Fork it and submit a pull request.
A few excellent improvements were made to capybara-webkit. Marc Seeger (rb2k) gave us a
#checked? method, which will make tests easier to read (90e561b and 2ad577f). Hubert Łępicki (hubertlepicki) swooped in with file upload support, including HTML5’s multiple file uploads (a449008, 0c8e347, and 8cad037).
There is still a ton of room for active development and improvement so please fork it and submit a pull request.
Phil LaPier (plapier) continues to rock on the Bourbon gem with better abstraction and modularization for the
flex-box mixin. (0892222), improved documentation for the
golden-ratio function. (b8ab7ce), and a
grid-width function in the base stylesheet. (599825e)
He also added two bug fixes: properly require the modules so it works with more versions of Rails (5945475) and remove the conflicting
linear-gradient function name (5d2452f).
Use it, fork it; pull requests welcome.
Improvements continue on Paperclip. Jeremy Walker (ihid) allowed for more freedom in naming storage modules by camel-casing instead of capitalizing; his example was
DelayedFog (cfe406b and c8a271e).
Prem Sichanugrist (sikachu) improved the development process by using Travis CI (56bb131, 6d4252d, and 45334fb), forcing
rake appraisal:install on the default
test task (cd10ba2), and upgrading the version of Rails it tests against (6cd951a).
As usual, pull requests are welcome so please do fork it.
Like many of you, we’ve had a lot of code pass through our github.com/thoughtbot account and we’re in need of a little cleanup our projects.
We have not used some projects in a year or more and also do not know of any alternatives to point people toward. We’d like to find them good homes. If you’re interested in managing one of them, please email email@example.com.
thoughtbot/sortable_table allows you to click the header rows of HTML tables to sort the contents. We were never quite happy with the implementation and we typically question the need for the feature when a client requests it. We tend to find there’s a better UI we can provide to solve the need they’re trying to solve with sortable tables. We haven’t made a substantial commit to it in about 2.5 years. People may be using it: there are 160 watchers.
tsaleh/ldap-activerecord-gateway is an implementation of an LDAP server which uses ActiveRecord as a data store. Tammer “Shoulda” Saleh is the new maintainer.
Some of our projects have been replaced by better libraries or their functionality was added by Rails. We’re deprecating them, which entails this announcement, updating the READMEs, and turning off Github Issues and Wikis for these projects.
thoughtbot/what provided boolean query methods on Mime::Type instances for the native Rails mime-types. We now use the #respond_to method or the mobile_fu plugin and we recommend you do, too.
thoughtbot/when added :if and :unless conditions to ActiveRecord callbacks and validations and ActionController filters. It can still be used on Rails apps pre-2.1, but it has been built into Rails since the 2.1 release.
Instead of capybara-envjs-fixes, we now use capybara-webkit on almost all our projects. It’s receiving a lot of interest from the community, with lots of good patches coming in. We’re actively maintaining it and recommend you give it a try for your integration testing stack.
thoughtbot/mile_marker was a project for visually setting expectations to clients during development, particularly for the staging environment. We haven’t used it since Rails 2.x and now simply use a “wip” CSS class when we need to accomplish the same goal.
thoughtbot/squirrel was a a Ruby-esque way of querying SQL. ActiveRelation, named scopes, and projects like Searchlogic have since been released and are much nicer and more powerful.
thoughtbot/report_card generated a CI metrics report using metric_fu and notified Campfire. It was deeply tied to Integrity, which we no longer use. We must not have cared too much about the metrics, either, because we haven’t bothered to set up metric_fu again with Hudson. If you’d like to, check out the Hudson metric_fu plugin.
thoughtbot/quietbacktrace was a filtering mechanism for deleting extra line noise in Test::Unit backtraces. It was added to Rails 2.3.
thoughtbot/clearance-twitter was a Twitter OAuth library that played nicely with Clearance. Omniauth is the bomb and should be used instead.
Some projects were forks where we needed to add additional functionality or fix bugs. We’re deleting those repos and mentioning them here with alternatives in case you were ever using one of our forks.
Ancestry allows the records of a Ruby on Rails ActiveRecord model to be organised as a tree structure (or hierarchy). It uses a single, intuitively formatted database column, using a variation on the materialised path pattern. We forked it to add Rails 3 functionality, which is now included in Ancestry. We still turn to this library when we need this functionality and recommend to others.
Friendly Identifier adds a human-readable identifier to ActiveRecord objects so they can be used in URLs. The original still exists on Google Code. We added a minor feature to it but now recommend norman/friendly_id instead.
Spawn provides a ‘spawn’ method to easily fork or thread long-running sections of code. This plugin works by creating new database connections in ActiveRecord::Base for the spawned block. We forked it to make it Rails 2.2 compatible. It is still an active project at tra/spawn, however we now typically use DelayedJob or Resque for background processing (DJ by default, Resque if we need multiple queues).
“Code review.” My knee-jerk reaction to that phrase? Nap time.
I’ll be honest, I never really felt engaged during “code review” meetings at the end of an iteration. It always took too long to get and discuss the code. The room would get warmer. We’d discover things we’d want to change. Many of those changes would never be made.
Since today is Boycott a Meeting Day, I thought I’d offer an alternative we’ve used lately.
Here’s the flow. Read Josh Susser’s post for the git commands.
Many teams use this “feature branch” pattern. The “code review” part is the Github pull request flow stuck right before the code goes into master.
Here’s what a pull request looks like:
jm-cm-client-sets-up-recurring-payment branch is compared to master.
And here’s what a comment on a commit looks like:
You could use normal git tools to check out a team member’s feature branch, view the history, etc., but Github one-ups bare git by adding a streamlined user interface and commenting.
Test-Driven Development moves code failure earlier in the development process. It’s better to have a failing test on your development machine than in production. It also allows you to have tighter feedback cycles.
Code reviews that happen right before code goes into master offer similar benefits:
I’ve personally loved this process. Give it a shot!
Written by Dan Croak.