Skip to content

Instantly share code, notes, and snippets.

@tobyhede
Forked from peter/creating-edgerails-app.sh
Created December 31, 2012 06:54
Show Gist options
  • Select an option

  • Save tobyhede/4417946 to your computer and use it in GitHub Desktop.

Select an option

Save tobyhede/4417946 to your computer and use it in GitHub Desktop.

Revisions

  1. @peter peter revised this gist Oct 5, 2012. 1 changed file with 4 additions and 1 deletion.
    5 changes: 4 additions & 1 deletion creating-edgerails-app.sh
    Original file line number Diff line number Diff line change
    @@ -20,7 +20,7 @@ rvm --rvmrc --create 1.9.3@myapp

    # 4. (Optional) Install gem dependencies and put binaries under ./bin
    # If you skip this step you need to prefix commandline commands with "bundle exec"
    # I had to do the following on my mac for the gcc compiler to be found when the json gem was installed:
    # NOTE: I had to do the following on my mac for the gcc compiler to be found when the json gem was installed:
    # sudo ln -s /usr/bin/llvm-gcc-4.2 /usr/bin/gcc-4.2
    bundle install --binstubs

    @@ -50,6 +50,9 @@ gem install bundler --pre # Needed to specify ruby 1.9.3 for Heroku
    # Add config.assets.initialize_on_precompile = false to config/application.rb # Avoid db connect on asset precompile
    RAILS_ENV=production bin/rake assets:precompile
    # (See https://devcenter.heroku.com/articles/rails3x-asset-pipeline-cedar for more info)
    # NOTE: to get eventmachine (thin dependency) to install on my Mac (Mountain Lion) I had to do:
    # sudo ln -s /usr/bin/llvm-g++-4.2 /usr/bin/g++-4.2
    # See: https://github.com/eventmachine/eventmachine/issues/325
    bundle install
    echo "web: bundle exec rails server thin -p \$PORT -e \$RACK_ENV" > Procfile
    git add .; git commit -m "Preparations for Heroku deploy"; git push
  2. @peter peter revised this gist Oct 5, 2012. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions creating-edgerails-app.sh
    Original file line number Diff line number Diff line change
    @@ -20,6 +20,8 @@ rvm --rvmrc --create 1.9.3@myapp

    # 4. (Optional) Install gem dependencies and put binaries under ./bin
    # If you skip this step you need to prefix commandline commands with "bundle exec"
    # I had to do the following on my mac for the gcc compiler to be found when the json gem was installed:
    # sudo ln -s /usr/bin/llvm-gcc-4.2 /usr/bin/gcc-4.2
    bundle install --binstubs

    # 5. Set up PostgreSQL database
  3. @peter peter revised this gist Oct 4, 2012. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions creating-edgerails-app.sh
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,8 @@
    # 0. Make sure you have Ruby 1.9.3 installed, and optionally RVM and PostgreSQL

    # 0.2 If you are on the Mac, make sure you have a c compiler by installing XCode Command Line Tools or gcc4.2 with homebrew
    # https://github.com/mxcl/homebrew/wiki/Custom-GCC-and-cross-compilers

    # 0.5 Make sure you have bundler version ~> 1.2 as Rails depends on it
    gem install bundler

  4. @peter peter revised this gist Oct 4, 2012. 1 changed file with 4 additions and 1 deletion.
    5 changes: 4 additions & 1 deletion creating-edgerails-app.sh
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,8 @@
    # 0. Make sure you have Ruby 1.9.3 installed, and optionally RVM and PostgreSQL

    # 0.5 Make sure you have bundler version ~> 1.2 as Rails depends on it
    gem install bundler

    # 1. Get edge Rails source (master branch)
    git clone https://github.com/rails/rails.git

    @@ -50,4 +53,4 @@ git push heroku master
    heroku run rake db:migrate
    heroku restart
    heroku apps:open
    heroku logs --tail
    heroku logs --tail
  5. @peter peter renamed this gist Jun 30, 2012. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  6. @peter peter revised this gist Jun 30, 2012. 1 changed file with 6 additions and 4 deletions.
    10 changes: 6 additions & 4 deletions gistfile1.sh
    Original file line number Diff line number Diff line change
    @@ -24,7 +24,8 @@ bin/rake db:create
    bin/rails generate scaffold Post title:string body:text
    bin/rake db:migrate
    bin/rails server
    open http://localhost:3000/posts
    # Add root to: 'posts#index' in config/routes.rb
    open http://localhost:3000

    # 7. Create repo on github
    # Browse to http://github.com to click the "New repository" button
    @@ -38,14 +39,15 @@ git push -u origin master
    gem install bundler --pre # Needed to specify ruby 1.9.3 for Heroku
    # Add gem 'thin' to Gemfile # Typical web server for Heroku deploy
    # Add ruby '1.9.3' to Gemfile (after the source directive)
    # Add config.assets.initialize_on_precompile = false to config/application.rb # Avoid db connect on asset precompile
    RAILS_ENV=production bin/rake assets:precompile
    # (See https://devcenter.heroku.com/articles/rails3x-asset-pipeline-cedar for more info)
    bundle install
    echo "web: bundle exec rails server thin -p \$PORT -e \$RACK_ENV" > Procfile
    git add .; git commit -m "Added Procfile and ruby 1.9.3 and thin in Gemfile"; git push
    git add .; git commit -m "Preparations for Heroku deploy"; git push
    heroku apps:create peter-myapp # myapp was taken...
    git push heroku master
    heroku run rake db:migrate
    heroku restart
    heroku apps:open
    heroku logs --tail

    # https://devcenter.heroku.com/articles/rails3x-asset-pipeline-cedar
  7. @peter peter revised this gist Jun 30, 2012. 1 changed file with 9 additions and 7 deletions.
    16 changes: 9 additions & 7 deletions gistfile1.sh
    Original file line number Diff line number Diff line change
    @@ -35,15 +35,17 @@ git remote add origin [email protected]:peter/myapp.git # use the URL from github h
    git push -u origin master

    # 8. Deploy to Heroku
    gem install bundler --pre # http://railsapps.github.com/rails-heroku-tutorial.html
    # Add gem 'thin' to Gemfile
    # Add ruby '1.9.3' to Gemfile
    gem install bundler --pre # Needed to specify ruby 1.9.3 for Heroku
    # Add gem 'thin' to Gemfile # Typical web server for Heroku deploy
    # Add ruby '1.9.3' to Gemfile (after the source directive)
    bundle install
    echo "web: bundle exec rails server thin -p \$PORT -e \$RACK_ENV" > Procfile
    git add .; git commit -m "Added Procfile and ruby 1.9.3 in Gemfile"; git push
    heroku apps:create myapp
    # https://devcenter.heroku.com/articles/rails3x-asset-pipeline-cedar
    git add .; git commit -m "Added Procfile and ruby 1.9.3 and thin in Gemfile"; git push
    heroku apps:create peter-myapp # myapp was taken...
    git push heroku master
    heroku run rake db:migrate
    heroku restart
    heroku apps:open
    heroku logs --tail
    heroku logs --tail

    # https://devcenter.heroku.com/articles/rails3x-asset-pipeline-cedar
  8. @peter peter revised this gist Jun 30, 2012. 1 changed file with 6 additions and 3 deletions.
    9 changes: 6 additions & 3 deletions gistfile1.sh
    Original file line number Diff line number Diff line change
    @@ -6,10 +6,10 @@ git clone https://github.com/rails/rails.git
    # 2. Create the rails app
    # The --edge option will point the Gemfile to rails on github (the tip of the master branch, i.e. EdgeRails)
    # Use the --dev option to insated point your Gemfile to your local rails checkout (useful for experimentation)
    rails/railties/bin/rails new myapp --edge --database=postgresql --skip-test-unit --skip-index-html
    cd myapp
    rails/railties/bin/rails new myapp --edge --skip-bundle --database=postgresql --skip-test-unit --skip-index-html

    # 3. (Optional) Create rvm gemset on Ruby 1.9.3 (Rails 4 requires Ruby 1.9.3)
    # This step will isolate the gem dependencies of the app from other gems installed on your system
    rvm --rvmrc --create 1.9.3@myapp

    # 4. (Optional) Install gem dependencies and put binaries under ./bin
    @@ -23,11 +23,14 @@ bin/rake db:create
    # 6. Scaffold some model to test that the app works
    bin/rails generate scaffold Post title:string body:text
    bin/rake db:migrate
    bin/rails server
    open http://localhost:3000/posts

    # 7. Create repo on github
    # Browse to http://github.com to click the "New repository" button
    git init
    git add .
    git commit -m "First commit"
    git remote add origin [email protected]:peter/myapp.git # use the URL from github here
    git push -u origin master

    @@ -43,4 +46,4 @@ git push heroku master
    heroku run rake db:migrate
    heroku restart
    heroku apps:open
    heroku logs --tail
    heroku logs --tail
  9. @peter peter created this gist Jun 30, 2012.
    46 changes: 46 additions & 0 deletions gistfile1.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,46 @@
    # 0. Make sure you have Ruby 1.9.3 installed, and optionally RVM and PostgreSQL

    # 1. Get edge Rails source (master branch)
    git clone https://github.com/rails/rails.git

    # 2. Create the rails app
    # The --edge option will point the Gemfile to rails on github (the tip of the master branch, i.e. EdgeRails)
    # Use the --dev option to insated point your Gemfile to your local rails checkout (useful for experimentation)
    rails/railties/bin/rails new myapp --edge --database=postgresql --skip-test-unit --skip-index-html
    cd myapp

    # 3. (Optional) Create rvm gemset on Ruby 1.9.3 (Rails 4 requires Ruby 1.9.3)
    rvm --rvmrc --create 1.9.3@myapp

    # 4. (Optional) Install gem dependencies and put binaries under ./bin
    # If you skip this step you need to prefix commandline commands with "bundle exec"
    bundle install --binstubs

    # 5. Set up PostgreSQL database
    createuser myapp
    bin/rake db:create

    # 6. Scaffold some model to test that the app works
    bin/rails generate scaffold Post title:string body:text
    bin/rake db:migrate

    # 7. Create repo on github
    # Browse to http://github.com to click the "New repository" button
    git init
    git add .
    git remote add origin [email protected]:peter/myapp.git # use the URL from github here
    git push -u origin master

    # 8. Deploy to Heroku
    gem install bundler --pre # http://railsapps.github.com/rails-heroku-tutorial.html
    # Add gem 'thin' to Gemfile
    # Add ruby '1.9.3' to Gemfile
    echo "web: bundle exec rails server thin -p \$PORT -e \$RACK_ENV" > Procfile
    git add .; git commit -m "Added Procfile and ruby 1.9.3 in Gemfile"; git push
    heroku apps:create myapp
    # https://devcenter.heroku.com/articles/rails3x-asset-pipeline-cedar
    git push heroku master
    heroku run rake db:migrate
    heroku restart
    heroku apps:open
    heroku logs --tail