Harrington Web

Setup Sinatra Application on Hostmonster.

Monday, January 27, 2014

Step 1 - Environment Setup

Make sure that you have ruby installed on environment, and have SSH access. To your account.

Step 2 - Create Ruby on Rails Environment

  1. Login to your Hostmonster C-Panel.
  2. Click Ruby on Rails icon.
  3. Fill out form with your information

Step 3 - Setup Directory Link

SSH into your account and goto where you would like the base of your app to be in. For example if you have website www.example.com and you want it hosted at www.example.com/myApp

ln -s ~/rails_apps/myApp ~/public_html/myApp

Step 4 - Clean up automatic Rails files.

rm -Rf ~/rails_apps/myApp/*

Once you have cleaned up the directory copy your sinatra files to ~/rails_apps/myApp

If you have a Gemfile this would also be a good time to run a "bundle install" while you are in the directory. If you don't get your gems loaded you will experience problems.

Step 5 - Setup your .htaccess file

Open up your .htaccess file for the myApp directory and make it look like this. Make sure that you replace the sections that say "yourAccount" and "myApp" with the appropriate names for your domain and application.

<IfModule mod_passenger.c>
  Options -MultiViews
  Allow from all
  PassengerResolveSymlinksInDocumentRoot on
  #Set this to whatever environment you'll be running in
  RailsEnv production
  RackBaseURI /
  PassengerAppRoot /home1/yourAccount/rails_apps/myApp
  SetEnv GEM_HOME /home1/yourAccount/ruby/gems
</IfModule>

Step 6 - Restart your app

touch ~/rails_apps/myApp/tmp/restart.txt
Remember this little trick to restart the app. This allows you to restart the Sinatra application without having to restart apache.

Set Git to stop tracking file

Thursday, January 23, 2014

I have found the need to ignore a file with out using the .gitignore. In my case its because of a chrome driver that we using for Cucumber and Watir. The office has a standard setup with a certain repository, however on my Mac chrome likes to update. This causes an issue with versioning of the driver. So I wanted to put a new chromedriver in my repository folder but not ignore it from the repository. To do this little trick I can update the index and tell it to assume the file is unchanged.

git update-index --assume-unchanged <file>

If you have the need to reverse the tracking of the file.

git update-index --no-assume-unchanged <file>

Git Autocomplete

Monday, January 13, 2014

Step 1

Run this command to get the .git-completion.bash file downloaded to your home directory.

curl https://raw.github.com/git/git/master/contrib/completion/git-completion.bash -o ~/.git-completion.bash

Step 2

Add the following code to your .bash_profile which is located in the root of your home directory.

if [ -f ~/.git-completion.bash ]; then
  . ~/.git-completion.bash
fi

Now when you open up your shell you will be able to use the TAB key for your Git commands.

What Isaiah might say.

Monday, January 6, 2014
During my daily bible study I came upon Isaiah 1:1-20 and thought wow this sounds really familiar. I thought to myself... I wonder what it would sound like if Isaiah the prophet lived in the United States and saw all the things that are happening today. What would he say. This is my take. Maybe this could inspire you to take a crack at it on your own.
Ladies and Gentlemen of the United States of America please take this to your heart. The sons and daughters of current and future generations are revolting against the Lord God Most High. We have lost the common knowledge of whom we serve, and placed and idol of money, and property in His glorious place. We are the richest sinful nation in the world, and are weighed down by the luxurious appeal of corruption and iniquity of others. We have abandoned the Lord, have no regret for the sin in our hearts and have completely turned away from him. When will this rebellion end? When will we see that the pain and suffering of bad health, depression, social decay and lack of compassion is wrong. From one end of the universe to the other there is not one good thing that can come from the rebellion against God. Our land is becoming a wasted land being devoured by strangers that our founding fathers were against. Thankfully God has left good people in our land or it would be completely destroyed like Sodom and Gomorrah of old. It is time for us all to learn to do good, seek justice, and remove the ruthless malice in our hearts. Let us defend the helpless and lift up our fellow believers and non believers. Let us show compassion, and that we can make mistakes, yet admit that we made the mistakes and repent for them as sins. Let us reason together with the lord and say “Though your sins are as scarlet, they will be white as snow; Though they are red like crimson, they will be like wool”. If we consent and obey we may have the best of the land. However if we refuse we will loose it all.