Much of the work over the past week was done in paperclip, so now you can upload files to your Rails apps with more flare and style!
It now supports an option for keeping old files, so you can pass
has_attached_file and, when you destroy an attachment (
@user.avatar.destroy) it won’t actually delete the underlying files (345ec74). Many people find this useful for S3 storage, which hints that there may be a deeper problem elsewhere. This is thanks to Eike Bernhardt (teefax) but was originally written by Philippe Creux (pcreux).
Christoph Lupprich (kitto) saw a quick way to speed up the
#public_url method for Fog storage using AWS as the provider, so he did (989ec0e).
I’ve long wanted a migration helper, and Daniel Schierbeck (dasch) wrote it with some git cleanup from Alexey Mahotkin (693b528, b922111, f82c0d9, f3eacd2, e0a6732, ffbfc24, 500f1bb, b70ffbc, 65a6ae8). It looks like this:
class AddAvatarColumnsToUser < ActiveRecord::Migration def self.up change_table :users do |t| t.has_attached_file :avatar end end def self.down drop_attached_file :users, :avatar end end
There were also some important internal changes. For example, Prem Sichanugrist (sikachu) replaced the AWS::S3 gem with AWS::SDK (1df1b03, 81129ad, 88a8af9, 75f413d, 2cf7378). He called out AWS (amazonwebservices) and Trevor Rowe (trevorrowe) for helping, and John Joseph Bachir (jjb) updated the docs appropriately (308f1a0).
Prem also got Paperclip passing on Rubinius (001fd99).
In bug fixes, base URLs with a
? but no
= will produce Paperclip URLs using
? (128d664 and bb22be3). Prem thinks that’s the right behavior now, but it’s tricky to nail down.
Nick Padgett (npadgett) found an edgecase where we were calling
strip on a non-string object, sometimes, and fixed that (34913f1).
Dimitrij Denissenko (dim) handled the case where using the
:id_partition pattern in a URL or path pattern raises a
NoMethodError on an unsaved resource (ac82244). He and I are now enemies for life for his use of
Prem fixed another bug: if you have a path or URL pattern with
:class in it it will show a warning. He removed this warning (b4ff2c5).
Prem worked with Steve Richert (laserlemon) to show the Gemnasium results in the README (3e20907 and 777ac90), and Prem also updated the README to be more readable (adcd03c).
The fake credit card processor, fake_braintree, hit 0.0.6 (eed875e and 0934f1e) this week as Ben Orenstein (r00k) added support for discounted subscriptions (757c0aa) and Gabe Berke-Williams (gabebw) exposed the transactions that have run (8dde09c and ab93137).
Taking a stance on whether we play along with the little Open Directory Project game, suspenders now defaults to
NOODP on every page which, as Matt Jankowski (mjankowski) points out, tells Web crawlers to never bother looking for ODP details (6275d0f).
The sweet shoulda-matchers collection of RSpec matchers now has more accurate error messages for the
allow_value matcher (25c2623), thanks to Clemens Helm (clemenshelm). It uses the underlying internationalization information to generate this.
Another documentation update on bourbon as Phil LaPier (plapier) explained that multiple background images with shorthand notation are unsupported (798aa1c), after clarifying that multiple background images themselves have fancy comma-separated syntax (aa66831).
Few commits over the past week. We’ve been hard at work on refactorings and larger features (plus client work), so keep your eyes peeled for the amazing commits we pull from you (yes, you!) in coming weeks.
Commits on suspenders this week bring us instructions on how to use the app with Heroku (257ea39 and 5a4c257), revised documentation “that is awesome, not terrible” (c5ba370), and a bug fix on Heroku: specifying the environment can sometimes raise an error (b45e57f)—all thanks to our Dan Croak (croaky). Brooke McKim (brookemckim) updated the docs to reflect that Hoptoad is now named Airbrake (8b5216e).
A tiny but important change to paperclip this week from Abel Martin (abelmartin): he documented how to use the Paperclip test helpers from
Test::Unit (9d7b0dc, e8d5331, and 5f3b88d).
For the first week ever factory_girl saw one tiny refactoring and no new features. Joshua “The Refactorer” Clayton (joshuaclayton) cleaned up the stub proxy—the build stategy that is invoked when you use
FactoryGirl.build_stubbed—by completely removing the constructor and delaying the actual construction of the stub object (8ce897f). This is part of a larger refactoring he is doing.
Some peace and quiet on capybara-webkit this week, when Joe Ferris (jferris) removed some stray print-debugging and general Ruby whining (5adab74).
Dan Croak (croaky) dedicated some time to our dotfiles over the week, improving documentation on how to use and upgrade it (87685f1 and 326ceb4), organizing and adding shell aliases for working with Heroku (352dcad, 6458ae7, and cbea59b), and deciding that the Github color scheme is better than the vividchalk color scheme in vim (de071e9).
Since last week was Thanksgiving here in the States, here’s a double-whammy: everything that happened last week and everything that’s happened this week, in one blog post!
The big deal with suspenders, our app app, is that version 0.3.2 is officially out! Since 0.3.1 on October 28th we’ve added an email validator, raised email delivery errors in the development environment, added Heroku support (try the
--heroku flag), and switched to bundler for the gem itself.
While Dan Croak (croaky) was releasing 0.3.2 (40690ae) he also made sure to document the
--clearance flags (02a8bb0). Gabe Berke-Williams (gabebw) added a missing
bundler/setup to the
Rakefile, tying everything together neatly (d09ee5b).
Above I mentioned how Gabe Berke-Williams (gabebw) added
bundler/setup to the
Rakefile of suspenders. He also did it to shoulda-matchers (9d79124), shoulda (8054563), high_voltage (ec656e1), bourne (9d21677), flutie (7863d14), shoulda-context (75a8384), factory_girl_rails (797a985), and pacecar of all things (fb972c0).
Version 1.2.0 of bourbon is out, bringing more Sass mixins into your life. Phil LaPier (plapier) added support for the CSS3
appearance (e888e0a) and
background-size (4588c5c) properties, and added
$verdana variables (4ba1cff). He also updated the docs to reflect this (d23064b), cleaned up some warnings (99946bb), and made the release (93beb25).
The past two weeks saw an improvement for gem authors in paperclip: Mike Burns (mike-burns) removed the
Paperclip::Options object, replacing it with a
Hash. Any option you pass to
has_attached_file is thus available to your underlying Paperclip extension without any extra work and with a canonical interface (5a7769b).
Prem Sichanugrist (sikachu) continued on his quest for having Paperclip work on CI with Rubinius; he tried removing the generated
rbc files so the CI server will generate them every time (2c08152).
In the past two weeks factory_girl has seen three releases: 2.3.0 (85d4735, 2fdabdb, and 89b9a82), 2.3.1 (e15ae8d), and 2.3.2 (17eacf0). Joshua Clayton (joshuaclayton) has been hard at work, you see.
As a result, dynamic attributes and callbacks in traits are called in the right order, closing #247 (1eb7e1b and 65e5e25). Also, traits can be added to factories dynamically, when creating an object (442ba18). For example, if you have an
:admin trait you can make an admin user on the fly with
FactoryGirl.create(:user, :admin, :name => "Frank Blank").
The other pile of commits from Josh are all internal refactorings. Things like removing the
Proxy#associate method in place of using
Proxy#set everywhere (3ed2f62, f47c03c, and d3a7b7e), cleaning up the
require statements (9472a14), consolidating and documenting all exceptions in the
FactoryGirl class (c46c090), handling nil blocks when running a factory (2bf5cea) and when creating it in general (86f971b), delaying the sorting of attributes until the last minute by using a lighter-weight array instead of hash (d563b94), making bold claims about inheritance that some blog post authors disagree with (557cce6), moving
Proxy::Stub#next_id into the private namespace (0c31b6e), taking an ignored argument to a block so some versions of Ruby don’t complain (c93dea5), defaulting the creation method to save instead of
nil (5bbbcb9), singularizing
Attribute#alias_for? (f247968), using his beloved Null Object pattern to reduce some conditionals (fba404a and b339c8f), adding a common
#to_proc method across all attributes and then invoking methods with
# instead of
#call (fba6f33 and 3282eea), straight-up removing dead code from the
AttributeList (56a6f67), and passing overrides through to the runner class (5fc57da).
Gotta break a lot of eggs to make an omelette. Speaking of, Gabe found a broken
version.rb and fixed it (1e47af0).
Another doc week for clearance where Gabe Berke-Williams (gabebw) observed that we test it against Rails 3.1.0 (f7c5e3b) and Matthew Burket (Mab879) noted that you must migrate the database before running
rake, when testing (39a6ac5 and 8b9e89b).
New features in our Braintree fake object, appropriately named fake_braintree! Gabe Berke-Williams (gabebw) added support for
FakeBraintree.generated_transaction (d1bbcb7, 917a235, 4fc470d, and 4cb5cb0),
Braintree::Subscription.update (fab3c92), and
Braintree::Customer.delete (c2aa516). Joe Ferris (jferris) started work on add-ons (312cfac).
Gabe also did some lovely documenting; now you can learn about how to use this in Cucumber (c163c4d), how to avoid calling
FakeBraintree.activate (dff3e51), whether the build is broken (499cb05 and 1b1a532), and what the difference is between declining and verifying a card (625993a). Additionally the
Subscription class was refactored (3ed090e), the tests were made more explicit (a23a61c), and the tests pass (0a12182).
We’ve been slowly transitioning all our gems to use Gemfiles and bundler’s gem tasks, but Gabe Berke-Williams (gabebw) is finally laying down the law. Welcome to the New Order: limerick_rake, paul_revere, cocaine, suspenders, pacecar, appraisal, shoulda-matchers, bourne, shoulda, high_voltage, flutie, paperclip, shoulda-context, and factory_girl_rails are now in line.
This provides a reliable and unified way for developers to check out, test, and release our gems:
bundle install && bundle exec rake && bundle exec rake release
Among other things, this keeps our CI clean and means we can’t forget to add Git tags for each release.
Bryan Ash (bryan-ash) fixed a kumade bug when trying to push to non-existent remotes: 397604d.
Vasiliy Ermolovich (nashby) fixed suspenders to correctly create the database in the context of the bundle: da63a014.
Tom Milewski (tmilewski) added a new matcher to shoulda’s matcher collection:
should serialize, allowing you to quickly test serialized ActiveRecord fields. This was introduced in a3fa2f9.
Blake Thomson, Mike Burns (mike-burns), and Gabe Berke-Williams (gabebw) fixed some development and testing issues to get the shoulda builds passing in 7660061, d38edbd, and f9d5c63.
Gabe Berke-Williams (gabebw) cleaned up high_voltage a bit by removing some extra comments in 505f98a.
Gabe Berke-Williams (gabebw) updated the bourbon documentation (aaabf77) and switched from plain Ruby to Rake for generation: a647cff.
Matthias Schmidt (MSchmidt) removed font families from buttons to let the application’s fonts shine through (3d18d51) and Mark Sonnabaum (msonnabaum) restored a missing import to make column mixins available (9b826ac).
Gabe Berke-Williams (gabebw) fixed flutie to expose the running version: 7151672.
Gabe Berke-Williams (gabebw) updated the pacecar documentation: 84e1fe7.
Shinya Kasatani (kasatani) fixed paperclip to support more options in the styles hash: b66833e.
Mike Burns (mike-burns) merged mpd’s (xxx) fixes for handling files with question marks (ff48f68) and Daniel Vartanov’s (DanielVartanov) style optimizations: b09b05b.
Prem Sichanugrist (sikachu) fixed Paperclip rake tasks to ignore default_scope in ActiveRecord: 0e8b874.
Jon Yurek (jyurek) fixed an expiring URL bug (75a5dbc).
Mike Burns (mike-burns) merged Wojciech Wnętrzak’s (morgoth) factory_girl fixes for factory names with uppercase letters: 463028d
Joshua Clayton (joshuaclayton) fixed a bug concerning build classes: 845a76a
Harold (hgimenez) forgot to take his medicine and submitted 218d7bed but he stopped himself in time.
Gabe Berke-Williams (gabebw) and Joe Ferris (jferris) added support to our braintree fake for more of the Braintree API and changed behavior to be more realistic in 0dd6471, 3d758a1, c57cde3, 45b5e62, bab770a, 0c02a8e, 707b336, and 36f2b5e. They also cleaned up fake_braintree internals with a number of improvements in 1811656, e055191, 3ada7a3, 9304ea0, 210835c, 0a647db, ad3c6ab, 6c284b5, eab8d78, 7a7e153, 5970f68, ebab395, 58a1e89, d3097c5, 638a38b, ebeab46, and 47d00aa.
Ben Orenstein (r00k) came through with a documentation update: b6befa2.
This week, Gabe Berke-Williams (gabebw) earned the prestigious “Committed more than is reasonably plausible in a forty-hour work week” award for getting his name in this post more often than the word “the.”
Kudos to Mike Burns (mike-burns) for earning the “Pull Request Vacuum” award. How many merged pull requests does it take to get to the center of the Earth? Mike is well on his way to finding out.
Small bug fix in the kumade Heroku deployer from Gabe Berke-Williams (gabebw). Apps are now restarted after deployment (7c5a6c6). This led to version 0.8.1 of kumade (eed756a).
Read my lips: no new features; that’s the tale for suspenders this week. Instead, the app generator got some internal improvements from Gabe Berke-Williams (gabebw) and Harold Giménez (hgimenez). Gabe moved suspenders over to the bundler gem tasks, reducing the
Rakefile size immensely (b66f34a and 43f0a68). Harold fought with aruba timeouts (e9dc22b, f41153f, bc48b45, 920989d) but, after the dust had cleared, he ran bundler after the project’s Gemfile has changed (7e06fe7). To keep tests green he put it on Travis (cca000d and 7b1c1de).
New feature in the bourbon Sass Mixins this week: CSS3 columns. You got your
@column-width, and don’t forget the classic
@column-rule-width. It’s all columns here, thanks to Phil LaPier (plapier) (540f05e).
Aside from that are a bunch of documentation updates. If you were confused before, you should be marginally less confused now: Gabe Berke-Williams (gabebw) fixed formatting and grammar (1d187fe, 34e8eac, and 19c32d9) and Phil documented the
@border-radius changes from before (fd17cdf).
No new features in factory_girl this week, but it’s now using bundler’s rake tasks (cad4bdb and 5133fa9) and the quick-start guide is slightly more clear (565ff1c), thanks to Gabe Berke-Williams (gabebw).
Wild times in appraisal land: version 0.4.0 comes with support for multiple gem sources, specifying sources as symbols instead of strings, and preserving the dependency order (yes!). Let’s name some names:
Josh Nichols (technicalpickles) sent us the pull request for specifying symbols for source names, like
source :rubygems c73d05f and 35c8f58). Joe Ferris (jferris) preserved the dependency order, so the gemfiles are not re-written every time you run your tests on Ruby 1.8 (193e375 and e7cacd4). Joe also added support for zero or more sources (2d7616b).
Internally—relevant to all appraisal hackers out there—Joe moved appraisal to use the bundler rake tasks (1137175), set up rspec for the project (ca2d12f), sped up the integration tests by removing a call to
bundle install (f5da0ba and 96ac443), and cleaned up some of the Cucumber feature files (d50f30e).
Additionally, Joe noted that he believes that the
Gemfile.lock should be checked into version control (508f760) and he was the one who released version 0.4.0 (2388945).
The mock object for the Braintree credit card processor, fake_braintree, hit version 0.0.5 this week, with support for
Braintree::TransparentRedirect. Gabe Berke-Williams (gabebw) added the
Braintree::Customer.find support (32ad3cc) and released version 0.0.5 (a4ce340); Joe Ferris (jferris) added the
Braintree::TransparentRedirect support (a5943a7 and e69e9a7).
Gabe and Joe both did some refactoring too; Gabe moved the test CC number into a constant (70af61e) and added a test for recording the billing address (26cbdd3). Joe split the
.activate! method into two discrete parts, which reads better (e52a874); he also used TimeCop to avoid erratic test failures, which I’m sure were bugging him (7c4795a). Oh hey get this, he replaced ShamRack with a
Capybara::Server, which I didn’t know you could do (b345058).
Gabe had his usual documentation fun, fixing formatting (e50ba56) and also documenting the heck out of the API methods (602774a).