Here's some advice on why you should probably publish the source code for your startup: http://tom.preston-werner.com/2011/11/22/open-source-everything.html
For Rails guys, Open Source Rails is an excellent place to start with. There's a concise format of that site here.