Almost a Space Game (A2SG)

Archive for the 'Ruby on Rails' category

Getting RestfulX and HerokuGarden to Play Nice

March 16, 2009 11:53 pm

If you’re using the very awesome HerokuGarden (or Heroku, for that matter) and are wanting to use the amazing RestfulX with it on an existing application there are a couple of not-exactly-obvious additional steps one needs to take in order to enable the HerokuGarden + RestfulX joy:

  1. herokugarden create your_app_name
  2. herokugarden clone your_app_name
  3. cd your_app_name
  4. mkdir lib
  5. mkdir lib/tasks
  6. mkdir vendor
  7. edit config/heroku.yml to hide the heroku toolbar (otherwise the heroku toolbar covers the action buttons. One could also adjust one’s Flex app to be shorter, I s’pose.)

    My heroku.yml, for example, looks like this:
    toolbar_collaborators: false
    toolbar_public: false
  8. It would be sweet to be able to run rake gems:unpack at this point but I wasn’t able to get that to work properly so I’ve been using the following workaround until I can figure that out (and check it into github):

    Create an entirely separate rails app on your local machine:

  9. cd ..
  10. rails temporary_application
  11. cd temporary_application
  12. add config.gem 'restfulx' to environment.rb
  13. rake gems:unpack
  14. Copy the entire vendor directory into your HerokuGarden app: (OSX/linux version)

  15. cp -R ./vendor/* ../your_app_name/vendor
  16. Delete the temporary application:

  17. cd ..
  18. rm -rf temporary_application
  19. Finish configuring your app:

  20. cd your_app_name
  21. add config.gem 'restfulx' to environment.rb
  22. script/generate rx_config
  23. git add .
  24. git commit -m "Added the RestfulX sekrit sauce"
  25. git push
  26. Resume down the standard RestfulX path of development joy:

  27. touch db/model.yml
  28. edit model.yml to your liking
  29. script/generate rx_yaml_scaffold
  30. rake db:refresh
  31. rake rx:flex:build
  32. git add .
  33. git commit -m "Created awesome RestfulX sample application"
  34. git push

If you’re aware of a better way to do this then please let me know so I can update these directions.

san_jose_hackfest_on_steroids

June 16, 2008 5:25 pm

Several of us from not_joseph’s San Jose Ruby Hackfest Meetup have been getting together fairly frequently to hack. I’ve created a Google Group for folks in the South Bay area to announce when/where they’re hacking so that it’d be easier to set up impromtu hackfests and get to know other Ruby/Rails folks.

Please consider joining. :)

Susser Rox! (Fanboy Silliness)

June 1, 2008 10:30 am

I went to Josh Susser’s session The Great Test Framework Dance-Off yesterday afternoon. It was a great survey of Rails Test Frameworks and I appreciate his take, which I summarize as “if it helps you write tests, then use it.” Exactly!

During his presentation, someone suggested turning down the lights so that it’d be easier to see his slides. Susser joked: “Hey, if we do that they you won’t be able to see me!”I shouted “we don’t need to see you, ’cause I have a tattoo of you on my arm.*”

Susser retorted “it’s nice to have fans!” and resumed his outstanding presentation.

I was sitting next to my new friend Harlan and asked him if he’d draw a smiley face on my arm (with eyebrows and a subtle eyebrow piercing) and put “Susser Rox!” underneath it. When the presentation was over, I went up to Susser and said “dude, I’m serious… check out my tattoo!” and rolled up my sleeve.

Harlan took this picture, which I think clearly shows how Susser responded:

Susser Rox!

I really love being a tiny guppy in the huge Rails Community lake.

* I think I did my standard “stammering” thing, so I may not have actually said precisely this, but it’s definitely what I meant.

A Thorough Whooping

May 30, 2008 11:20 pm

Today at RailsConf I got my ass kicked… in the good way.

The first whooping came during TJ Murphy’s session: Flexible Scaling: How to Handle 1 Billion Pageviews. Strong blows include:

  • “SELECT-less Reads”
  • Tons of interesting info. about using the Amazon Cloud
  • His monthly server costs for Warbook (an awesome game built in RoR which has a bazillion Facebook users) and their monthly income (more than the server costs)
  • Caching/memcache, ActiveRecord tweaking
  • He essentially did Warbook by himself, assisted by the almighty power of Google and folks who are willing to help by providing pointers to good info.

I got a chance to talk to him for a moment afterwards and told him that I really enjoyed playing Warbook until the jackass 13-year-old gangs started to beat my solo-self to a pulp repeatedly. I also mentioned that I was grateful for that because that experience took my smack-talking to the next level. :)

The second bit of major beatdown came during Erik Kastner’s session: Microapps for Fun and (Micro) Profit (his addition, not mine!).

  • Learning and self-gratification (in terms of making what you want to make) is personally profitable, and a worthwhile endeavor. I cheered inside when he said that his microapps have made $7 with Google AdSense. :)
  • Limiting your project to one day makes you toss features that aren’t actually needed and gets something into the world.
  • Rails isn’t the hammer for every web application nail… there are good reasons to use Camping, Sinatra, Merb, etc. (and even better… sample code demonstrating how to use Sinatra.

The especially painful Chuck Norris Roundhouse kicks were Erik’s comments regarding get your stuff out in the world now. Pare down, do the minimum you have to, get your alpha OUT. (As he pointed out, this is nothing new… Getting Real, “Real Artists Ship,” etc., etc.) It was a message I needed to hear.

Amy Hoy also chimed in about shipping now vs. entering analysis paralysis and relayed some personal anecdotes that I’d paraphrastically summarize as:

  • It made me feel good to get something done and out.
  • It made me more credible… I’ve shipped, so I don’t have to feel like a hypocrite when I (rightly) encourage others to ship.
  • It’s just straight-up badass to deploy something you’ve worked on.

I miss my RailsConf2007 posse, but I’m having a great time with my RailsConf2008 posse. I’ve met TONS of cool people, and we’re only half-way into it.

New Functionality - Warps

February 25, 2008 11:51 pm

SVN checkin #2 for A2SG includes enhanced warp functionality… now they can be stable or unstable… including the time when they’ll expire.  There’s some model logic which will automatically create a random expiration date if the stable flag is set and the expiration time wasn’t already specified.  Perhaps the last sentence only truly means anything to me… good times.

This checkin also includes a nifty Rails plugin called “Manage Fixtures” which, quite unsurprisingly, helps one manage one’s fixtures.  It’ll take a current table (or a set) or all of your tables and convert them to YAML fixtures. Quite handy!

Off to a Good Start

February 24, 2008 3:27 pm

The latest/greatest version of my A2SG code is now all safe and sound in a Subversion repository. :)

I ran rcov on it and I feel ok about my test coverage, though there’s definitely more to do.

For the first time ever I’ve written custom Rake tasks thanks to the Rake Tutorial written by Gregg from RailsEnvy. A couple of things that I think I “figured out” (meaning “I’m not sure this is the orthodox way to do this, but it works…”) are:

  1. An example of creating a rake task that calls other tasks and also allows use of the application’s models:

    task :do_this => [:a_subtask, :environment] do

    end

    That calls :a_subtask and also allows use of the application’s odels in the rake tast by specifying the environment.

  2. This is a way to call multiple subtasks:

    task :do_this => [:a_subtask, :another_subtask, :yet_another_subtask, son_of_the_second_cousin_of_the_son_of_subtasks, :environment] do

    end