Compass author Chris Eppstein describes a new trend in the stylesheet framework world towards adhering to semantic markup and maintaining the separation between content and style. He shows how Compass and Sass can untangle stylesheets and allow reusable styles, classes, and designs without imposing on the markup.
“Overriding attributes in form helpers seem to be skipped, and the attributes in the database are used instead. Is there a reason this behavior makes sense?”
Adam will be submitting a patch that allows overriding of attributes. It as mentioned that the existing behavior might be useful in the error case of a pre-coerced form.
- v802 of RubyMine does not auto save when focus is lost. A bug report has been submitted. Along those same lines, RubyMine is nearing a public release, now is your chance to vote up any features you want to see. Cucumber support was explicitly mentioned.
- Rails has been selected for Google’s Summer of Code. While we may not be students, there are opportunities to be a mentor.
- Be wary of an ad provider: Some ads will redirect your users to unwanted destinations. Placing the ad inside an iframe will let the ad do what it wants to do, without hurting your user’s experience.
AutoTagger is a gem that helps you automatically create a date-stamped tag for each stage of your deployment, and deploy from the last tag from the previous environment.
Let’s say you have the following workflow:
- Run all test on a Continuous Integration (CI) server
- Deploy to a staging server
- Deploy to a production server
You can use the
autotag command to tag releases on your CI box, then use the capistrano tasks to auto-tag each release.
gem sources -a http://gems.github.com sudo gem install zilkey-auto_tagger
To contribute, you can fork the github repository.
You can also visit the tracker project
The autotag executable
Installing the gem creates an executable file named autotag, which takes two arguments: the stage, and optionally the path to the git repo:
$ autotag demo # => creates a tag like demo/200804041234 in the current directory $ autotag demo . # => same as above $ autotag demo /Users/me/foo # => cd's to /Users/me/foo before creating the tag
Running autotag does the following:
$ git fetch origin --tags $ git tag <stage>/<timestamp> $ git push origin --tags
AutoTagger comes with 2 capistrano tasks:
release_tagger:set_branchtries to set the branch to the last tag from the previous environment.
release_tagger:create_tagruns autotag for the current stage
require 'release_tagger' # The :stages variable is required set :stages, [:ci, :staging, :production] # The :working_directory variable is optional, and defaults to Dir.pwd # :working_directory can be an absolute or relative path set :working_directory, "../../" task :production do # In each of your environments that need auto-branch setting, you need to set :current_stage set :current_stage, :production end task :staging do # If you do not set current_stage, it will not auto-set your branch # set :current_stage, :staging end # You need to add the before/ater callbacks yourself before "deploy:update_code", "release_tagger:set_branch" after "deploy", "release_tagger:create_tag"
Assume you have the following tags in your git repository:
The deployments would look like this:
cap staging deploy # => sets branch to ci/01 cap production deploy # => sets branch to staging/01
You can override with with the -Shead and -Stag options
cap staging deploy -Shead=true # => sets branch to master cap staging deploy -Stag=staging/01 # => sets branch to staging/01
- DOES NOT work with capistrano ext multi-stage
- It will accept invalid tag names (if you specify a tag name with a space, it will blow up when you try to create the tag)
I have this working on a single project, and there is a fairly complete spec suite, but use at your own risk. It’s probably worth setting up on a demo project before adding it to a production repo.
Over time it would be nice to add other scms like subversion as well, so that you have a single way of tagging, regardless of scm.
Special thanks to Brian Takita, who gave me an initial implementation. Another useful link is http://codeintensity.blogspot.com/2008/06/changelogs-and-deployment-notification.html.
Ask for Help
“What’s the best way to get gems for forked repos?”
There was quite a discussion on this. The specific issue is that the team is trying to use Compass (Chris Eppstein gave a talk on Compass at Pivotal on 3/18-look for the future video on our Talks Page.) For the moment, since compass depends on the edge version of sass you must first manually install sass before installing the compass gem.
- One suggestion was to submit a fix for the gem. This is not a good solution in this case since the new version of sass/haml is expected to be released soon, fixing compass and simplifying its installation.
- Pivotal will likely host its own internal gem server at some point to deal with issues like this.
- The Has My Gem Built Yet? service might be useful in some situations, but not for this specific problem.
As I’ve mentioned before, I’ll be giving a talk at RailsConf on how I “got more agile” once I was able to practice every day. The goal is for my story to help you in your career, telling some good stories in the process.
To celebrate/entice you to come to RailsConf & my talk, (Tuesday, 2:50pm, Ballroom A) and to thank those of you who contributed your own tips, I have two things for you.
First is a promise of Pivotal Labs swag (content TBD) to anyone who submitted a tip & to the first five comment authors who claim it below and identify themselves at the actual session – no sneaking off to Scott’s Advanced Git talk.
Second, for everyone, is a RailsConf discount of 15% in case you haven’t registered yet. When you register, use the promo code
RC09FOS. Note that as of yesterday, the Hilton’s room rate has dropped to $99 a night.
Ask for Help
“How do you test request headers? The request object is frozen…”
The team is using rspec to test an OAuth implementation and needs better access to the request object.
- Possibly modify the request environment prior to running the test -or-
- Instantiate a new, non-frozen request object.
We consider it critically important to keep each project’s build green (i.e. successful) at all times. A build is the heartbeat of the project: if it’s green, everything is healthy; if it turns red (i.e. fails), the team is encouraged to jump on the problem and get it back to green right away. We want red builds to go away quickly; the longer a build stays red, the longer it takes to track down the problem and the more likely it is that additional tests will be broken (the “broken windows effect”).
In order to facilitate this level of discipline, we’ve learned over the years that making the status of our CI environments obvious and visible to the team is critical. If a team isn’t acutely aware of the status of its build, it’s unlikely that a red build will get noticed and fixed quickly. You can have the CI server email the team, but that doesn’t work very well when the whole team is pairing all day: it might be a few hours before someone notices the email. You can install plugins in your browser or system tray that show build status, which helps, but still, they’re not always obvious enough. The best way we’ve found to keep the team informed is to display the status of the build high on a wall near the team as a big red or green indicator. That way, even when you’re busy coding, it’s easy to notice the build going red. These days we use 2 wide screen TVs, positioned in the office so that one is easily seen from any developer station.
When there’s only a single project going on, we’ve found that a screen that’s simply all red or all green is effective. At Pivotal Labs, though, we have many projects going on at once. Rather than putting numerous TVs up on the wall, we’ve created an application that aggregates each project’s CI status into one page. It’s only visible internally, of course. It displays the build status of each of our projects – all the client projects, internal projects, and open source projects that Pivotal Labs is involved with.
Recently we decided to bring up an external instance of the aggregator that shows the status of our open source projects. We’ve also pulled in the status of some of the open source projects that Pivotal depends on (e.g. Rails, CCrb). It’s available at ci.pivotallabs.com. The idea is to provide the same level of visibility into build status for open source developers, or teams that rely on their products, as we have internally at Pivotal Labs. Feel free to display the page on a monitor/TV/projector in your office! It refreshes itself every 30 seconds.
If you have an open source project and you’d like us to run your build and display its status, or if you already have a build and you’d like us to add it to the page, there’s no charge – just let us know (email firstname.lastname@example.org).
Pivot Corey gave a brown-bag lunch talk titled “There is No Such Thing as a CSS Class” (slides and notes) where he describes establishing a project specific “CSS System.” This excellent presentation complements the “Consistent and Effective CSS” talk (video and live demo available) given by Pivots Corey, Ryan, and Chris.
- Branches + JsUnit + CI + IE = :-( : Apparently it is difficult to manage IE’s cache in CI. One project apparently has a bat file on CI that clears the cache every 30 minutes. Another team solved this by making the cache directory read only. Often browser/OS combinations have some technique for disabling caching.
Ask for Help
“AR attribute appears to be skipped by text field helper?!” Apparently the model method is bypassed by the text field helper if a column of the same name is present in the underlying table. This was experienced in Rails 2.2.
Others have apparently experienced this in the past but a clear answer did not surface.
Problem: every since I upgraded to Safari 4 I’ve been annoyed that zooming in and out seems to confuse GMail and and Google Reader. When you zoom out, GMail refuses resize its panels, leaving a big blank space on the right side; when you zoom in, Google Reader loses its button panel at the bottom of the main area if you’re in a feed with a lot of entries.
Solution: go to the “View” menu and select “Zoom Text Only”.
New problem: the other setting is cooler for other sites, since it magnifies images and keeps non-fluid layouts from wrapping stupidly when you really need the text to be a little bit bigger. I wish there were a way to set it per site, but it’s a global setting. Oh well, no big deal, at least now I know where it is if it comes up.
- Rubymine Build 784 has the Weirdest. Bug. Ever.: This may only be a problem if you work on a mac and you need to enter capital letters in rubymine dialogs like find and replace ;-). Many of us are fans of intellij/rubymine, but we wish they had a better test process. To be fair, rubymine is in public preview, so expect the occasional bug or two.
Lew Cirne, CEO of New Relic, outlines how they use their own RPM product to maintain and improve the performance of their application, which processes billions of transactions per month with the average response time under 40ms.
Last week, Wolfram Arnold of RubyFocus interviewed Edward Hieatt, our VP of Engineering, and Davis Frank, one of our engineers, to try to get at the heart of how you build a scalable software development team.
The interview is posted on RailsLab, at
It’s a nice piece. We look forward to the second installment.