|
Post by dejohnny on Jul 29, 2012 18:35:26 GMT -5
I wanted to create a quick and easy way to generate a URL segment so that I can rename the application id after I've created an app on Heroku.
So, for example, when you create an app on Heroku using the command:
Heroku create --stack cedar
Heroku will create a randomly generated URL that looks like this:
aptune-geohiisgth.herokuapp.com
You can rename that URL to something meaningful like for example:
myapp-rhfgsa.herokuapp.com
The code:
def idGenerator(word, n) shuffled = ('a'..'z').to_a.shuffle[0..n].join return word + "-" + shuffled end
So, the command:
$ Heroku app:rename idGenerator("apple", 7)
Should rename the Heroku app to apple plus some random character:
apple-egadhs.herokuapp.com
|
|