Created
August 27, 2013 01:44
-
-
Save paganotoni/6348786 to your computer and use it in GitHub Desktop.
Script to init Ruby static Heroku site.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
init_static_site(){ | |
PROJECT_NAME=$1 | |
if [[ -z "$PROJECT_NAME" ]] then | |
PROJECT_NAME="site" | |
echo "| You didn't define a name for the site folder, setting it to 'site' by default" | |
fi | |
mkdir -p $PROJECT_NAME/public/{images,js,css} | |
touch $PROJECT_NAME/{config.ru,public/index.html}i | |
cd $PROJECT_NAME && touch Gemfile && echo "source \"https://rubygems.org\"\ngem 'rack'" >> Gemfile | |
echo "use Rack::Static, :urls => [\"/images\", \"/js\", \"/css\"],:root => \"public\"\nrun lambda { |env|\n[200, {'Content-Type' => 'text/html', 'Cache-Control' => 'public, max-age=86400' },File.open('public/index.html', File::RDONLY)]}" >> config.ru | |
bundle install | |
cd .. | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment