Corey Innis's blog



Corey InnisCorey Innis
New York Standup 03/19/2009
edit Posted by Corey Innis on Thursday March 19, 2009 at 02:35PM

Interesting

  • We've created a Pivotal fork of the Ctags bundle for TextMate (the original).

    Ctags provides a mechanism for indexing your source code files for the purpose of locating and navigating between bits of code; something IntelliJ/RubyMine is very good at, while TextMate is found lacking.

    The forked bundle aims to be more inline with Pivotal practices, where developers are often switching between IDE/editor worlds. For example, code completion has been re-mapped to ctrl-space, to be more like IntelliJ.

    Have you played with Ctags? Take a look at the bundle; see what you think.

Help Wanted

  • We're on the hunt for quality burritos in NYC. Ben gave Burrito Loco a try last night; thought the burritos were "supple". Dave is desperately seeking breakfast burritos.

    Suggestions?

Corey InnisCorey Innis
New York Standup 03/12/2009
edit Posted by Corey Innis on Friday March 13, 2009 at 02:59AM

Interesting

  • Ben noted, you can give your Ruby command-line tools some (RDoc::)usage
  • Rails Boost, where one may "generate a ... bootstrapped Rails app", now includes fixjour as an option to the generator
  • Joe and Ryan recently created a Pivotal fork of Pat's acts_as_fu to get it to play nicely with your application and its database connections

Corey InnisCorey Innis
New York Standup 03/11/2009
edit Posted by Corey Innis on Wednesday March 11, 2009 at 06:59PM

Help Wanted

  • We're interested in running some sort of javascript validation and syntax checking suite on one of our projects. JSLint looks reasonable for the framework and can be run from the command line with Rhino.

    If you have experience with or thoughts about the idea, please share.

Corey InnisCorey Innis
New York Standup, Overdue from the Week of 03/02/2009
edit Posted by Corey Innis on Wednesday March 11, 2009 at 01:13PM

Interesting Things

  • An EngineYard-hosted project had an issue with monit attempting to restart mongrel too often. It turned out that the mongrel processes were not dropping pid files soon enough. The EngineYard-suggested fix:

    • Upgrade mongrel to 1.1.5.1 (patched to drop the pid file faster)
    • Upgrade to monit 5.0 beta 6
    • Update to the latest ey-monit-scripts
  • FiveRuns dash is a cool, customizable metrics service. Pat created a plug-in for sending continuous integration stats there: dash-ci.
  • Using Cucumber to test Capistrano deployment:

    cap --dry-run will run Capistrano without completing the actual task (e.g., deployment). Cucumber can then be used to write some nice, story-like deployment expectations that search the Capistrano output to document your project's deployment process and ensure the documentation remains valid. Something like:

    Feature: Deployment
      In order to deploy the application
      As an administrator
      I should run Capistrano commands
    
    
      Scenario: Deploying
        Given I am working from the RAILS_ROOT directory
          And the parent directory is a Git repository
        When  I run a deployment task
        Then  'scm_user' for the deployment should be derived from the Git config for the remote origin
    
    
      Scenario: Deploying to demo
        Given I am working from the RAILS_ROOT directory
        When  I run 'cap demo deploy'
        Then  the deploy should succeed
          And the deployed code matches the latest 'web/stable' tag
          And the deployed code should be marked with a new 'web/demo' tag
    

    More on this to come.

  • Using Selenium to ensure unique IDs in your DOM:

    # ----------------------------------------------------------------------
    # The examples below illustrate the technique with the Prototype and
    # jQuery libraries, respectively.  Both use Pat Nakajima's selenium
    # helper for executing javascript in the tested browser window.
    # 
    # For more on that helper, see:
    # http://pivotallabs.com/users/patn/blog/articles/717-run-javascript-in-selenium-tests-easily-
    # ----------------------------------------------------------------------
    
    
    # ----------------------------------------------------------------------
    # with prototype
    # note the exception catching... prototype chokes on invalid IDs
    # e.g., "invalid_id[][]"
    # ----------------------------------------------------------------------
    def assert_unique_ids
      audit_json = run_javascript <<-JS
        audit_ids = function() {
          var results = {};
          $A($$('*[id]')).each(function(element) {
            if(element.id.replace(' ', '').length > 0) {
              try {
                if($$('#' + element.id ).length > 1) {
                  if( ! results.duplicates) {
                    results.duplicates = {};
                  }
                  var count = results.duplicates[element.id] || 0;
                  count ++;
                  results.duplicates[element.id] = count;
                }
              }
              catch(err) {
                // uncomment to capture invalid IDs
                // var invalid = results.invalid || [];
                // invalid.push(element.id);
                // results.invalid = invalid;
              }
            }
          });
          return ($H(results).toJSON());
        }
        audit_ids();
      JS
      assert_equal({}, JSON.parse(audit_json)), 'Expected no duplicate IDs')
    end
    
    
    # ----------------------------------------------------------------------
    # with jQuery
    # additionally depends on the jquery-json plugin:
    # http://code.google.com/p/jquery-json/
    # ----------------------------------------------------------------------
    def assert_unique_ids
      audit_json = run_javascript <<-JS
        audit_ids = function() {
          var results = {};
          $('*[id]').each(function() {
            if(this.id.replace(' ', '').length > 0) {
              if($('*[id=' + this.id + ']').length > 1) {
                if( ! results.duplicates) {
                  results.duplicates = {};
                }
                var count = results.duplicates[this.id] || 0;
                count ++;
                results.duplicates[this.id] = count;
              }
            }
          });
          return $.toJSON(results);
        }
        audit_ids();
      JS
      assert_equal({}, JSON.parse(audit_json)), 'Expected no duplicate IDs')
    end
    

Help Wanted

  • One project recently moved from Rimu to EngineYard, only to find their Mongrel processes double in memory consumption. Any thoughts on why?