Archive for category Technology

Rails 3.0 on Heroku after trying Rails 3.2

So I was playing with Rails this weekend making all sorts of progress until I tried to get it running on Heroku. Everything worked fine locally but a variety of errors plagued me up on the servers.

I figured out 4 main issues i was having

  • Bamboo stack instead of Cedar
  • Rails 3.2 instead of 3.0
  • Forcing a push to Github
  • sqlite3 instead of pg

First off I had updated to the latest Rails version but it seems you need to jump through hoops on Heroku if you want to use the latest and greatest. I also looked at using 3.1 on Heroku but this also wasn’t out of the box. So I opted for the tried and true Rails 3.0 on Heroku/Cedar.

Bamboo stack instead of Cedar

When I setup my app this weekend I just used the default Heroku Create syntax. Many of the tutorials neglect to include the –stack option. So after I figured out I wanted to be on cedar instead of bamboo I created my application  on Heroku using:

$ heroku create --stack cedar

Rails 3.2 instead of 3.0

The only problem was I had updated my local rails version to 3.2 and now I need to roll back to version 3.0.

Well I didn’t need to, I could have used the gem _version_ convention. Specifically the Gem setup has a wrapper for executables like rake and rails. That executable supports a _version_ parameter to specify a particular version . I could have used: $ rails _3.0_ new myProject all the time, but that’s just more things for me to forget and I really just wanted a base setup.

The first thing I needed to do was get Rails 3.0 installed. For that I called:

$ gem install rails --version "3.0"

Once installed 3.2 was still being used so I uninstalled it:

$ gem uninstall rails

Since I had two copies installed at this point it asked me which to uninstall, I choose 3.2

Unfortunately my project was already setup using 3.2 so I had to get it clean up back to 3.0. I could have edited the Gemfile, but again I wanted a clean base setup. I trashed the project and rebuilt it with 3.0 scaffolding.

Forcing a push to Github

I added the remote github repo and tried to push but there were conflicts. I honestly  didn’t care at this point so I forced the push not typically advised but I was running out of patience:

$ git push -f origin master

sqlite3 instead of pg

All good so far now I could deploy

$ git push heroku master

but there were errors. DOH I forgot that they use postgress on Heroku not sqlite3. I wasn’t ready to install postgress locally so I opted for a split DB setup. Again this is not advised, I should be using the same DB locally and in prod. I just wanted to get this running though.

Time to update my Gemfile from

gem 'sqlite3'

To this:

group :development, :test do
 gem 'sqlite3-ruby', :require => 'sqlite3'
end
group :production do
 gem 'pg'
end

Once that’s saved I went back to a little tip about –without production and ran:

$ bundle install --without production

Then I continued with the deployment and ran

$ heroku run rake db:migrate

and everthing worked fine.

Now I can focus on writing the code and not worrying about the environment setup.

, , , , ,

Leave a Comment

Coffee Notes: Want Better Quality? Fire Your QA team

Ok maybe don’t go that far but this is a great read on holding developers accountable.

I love the last paragraph.

Work_Pic_normal.jpgJim Highsmith (@jimhighsmith)
2/21/11 4:00 PM
Want Better Quality? Fire Your QA Team. | Forrester Blogs http://bit.ly/fn3vij

Leave a Comment

Coffee Notes: features vs quality

Here’s an interesting article on the value of internal quality.

gravatar_normal.jpegDavid Bernstein (@agile_design)
2/21/11 3:08 PM
Software mgr? Read this!! @martinfowler: features vs code quality: http://martinfowler.com/bliki/TradableQualityHypothesis.html

Leave a Comment

Spike: Unit Testing Static Methods

Previously we began discussing how great it is to use mocks and stubs. We showed how you can use dependency injection to set a stubbed out service instead of the real one. We also reviewed how you can use mocks to verify methods were acted upon from withing the method under test.  However you may come along a scenario where you need to test a method that requires you to call a static method on some other object. Regular mocking won’t suffice. Now it’s time for PowerMock

PowerMock is a nice add on to Mockito (and others) that supercharges what you can do with your tests. Read the rest of this entry »

, , , , , ,

Leave a Comment

Coffee Notes: A Better Word for Software Craftsman

I ran accross this post by Krishna Kumar today discussing how the goal of the Software Craftsman is great but that programmers today don’t care. He notes that many of today’s programmers are in it for the paycheck and not interested in being the best they can be. Kumar discusses how the term Software Craftsman can be perceived as elitist and unapproachable for programmers just in it for the job. I thought this was an interesting point. We want our developers to best the best the can be but are we providing options that are approachable and interesting enough for what they are really focused on.

Krishna continues on noting that organizations need to foster this growth as well. Its one thing thing to have an interested and driven individual, its another to have an organization that fosters and nurtures growth and development rather than simply factory style, assembly line code.

Good read with multiple points. Take time to read the whole thing.

http://java.dzone.com/articles/get-better-word-software

 

,

1 Comment

Follow

Get every new post delivered to your Inbox.

Join 477 other followers