Other Pages

Expand All

Get A Sticker

Step 1: Have a volunteer check your tool versions

Find a volunteer and have them watch the next steps.

Verify tool installation

Most of the time, the version numbers don't have to match exactly. In general, if the first two numbers match, or if the full number you have is greater than the one below, then you're cool.

If you're on OSX or Linux:

Type this in the terminal:
rvm -v
Approximate expected result:
rvm 1.x.x by Wayne E. Seguin (wayneeseguin@gmail.com) [https://rvm.io/]
The greyed-out text may differ and is not important.

On all operating systems:

Type this in the terminal:
ruby -v
Approximate expected result:
ruby 1.9.3p125 (2022-02-16 revision 34643) [x86_64-darwin11.3.0]
The greyed-out text may differ and is not important.
Type this in the terminal:
bundle -v
Approximate expected result:
Bundler version 1.x.x
The greyed-out text may differ and is not important.
Type this in the terminal:
rails -v
Approximate expected result:
Rails 4.0.x
The greyed-out text may differ and is not important.

The RailsBridge curriculum is written for Rails 4, so if you still have Rails 3.x, you need to install Rails 4 with gem install rails.

Verify git

Make sure you're still in the sticker directory.

Type this in the terminal:
git init
Expected result:
Initialized empty Git repository in /home/steven/Code/ruby/sticker/.git/
Type this in the terminal:
git add -A
Type this in the terminal:
git status
Expected result:
# On branch master
#
# Initial commit
#
# Changes to be committed:
#   (use "git rm --cached <file>..." to unstage)
#
#       new file:   .gitignore
#       new file:   Gemfile
#       new file:   Gemfile.lock
#       new file:   README.rdoc
#       new file:   Rakefile
# ...most output omitted for brevity...
Type this in the terminal:
git commit -m "Getting that sticker"
Expected result:
[master (root-commit) 8cd0e44] Getting that sticker
 54 files changed, 1531 insertions(+)
 create mode 100644 .gitignore
# ...most output omitted for brevity...
 create mode 100644 test/unit/helpers/drinks_helper_test.rb
 create mode 100644 vendor/assets/javascripts/.gitkeep
 create mode 100644 vendor/assets/stylesheets/.gitkeep
 create mode 100644 vendor/plugins/.gitkeep
Type this in the terminal:
git status
Expected result:
# On branch master
nothing to commit (working directory clean)

Verify heroku deploy

Each application has its own Gemfile. Be sure you're opening the one inside your sticker app's folder.

Use your editor to open the Gemfile (C:\sites\sticker\Gemfile or ~/sticker/Gemfile) and find the line containing:

gem 'sqlite3'

Remove this line and replace it with:

group :development, :test do
  gem 'sqlite3'
end
group :production do
  gem 'pg'
  gem 'rails_12factor'
end
Type this in the terminal:
bundle install --without production
Expected result:
Fetching gem metadata from https://rubygems.org/.........
# ...most output omitted for brevity...
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
Type this in the terminal:
git add -A
git commit -m "Add pg gem for Heroku."
Expected result:
[master 4a275be] Add pg gem for Heroku.
 2 files changed, 6 insertions(+)

The name of your heroku app will be different. That is fine.

Type this in the terminal:
heroku create
Expected result:
Creating evening-wind-5284... done, stack is cedar
http://evening-wind-5284.heroku.com/ | git@heroku.com:evening-wind-5284.git
Git remote heroku added
Type this in the terminal:
git push heroku master
Expected result:
Counting objects: 7, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 453 bytes, done.
Total 4 (delta 3), reused 0 (delta 0)
-----> Heroku receiving push
-----> Ruby/Rails app detected
-----> Detected Rails is not set to serve static_assets
       Installing rails3_serve_static_assets... done
-----> Configure Rails 3 to disable x-sendfile
       Installing rails3_disable_x_sendfile... done
-----> Configure Rails to log to stdout
       Installing rails_log_stdout... done
-----> Gemfile detected, running Bundler version 1.0.7
       Unresolved dependencies detected; Installing...
       Using --without development:test
# ...most output omitted for brevity...
-----> Compiled slug size is 6.1MB
-----> Launching...
Type this in the terminal:
heroku run rake db:migrate
Expected result:
Migrating to CreateDrinks (20120428044153)
==  CreateDrinks: migrating ===================================================
-- create_table(:drinks)
   -> 0.0084s
==  CreateDrinks: migrated (0.0085s) ==========================================
Type this in the terminal:
heroku open
Expected result:
Opening http://evening-wind-5284.heroku.com/

Append drinks to the end of your heroku url. For example, if your url was http://evening-wind-5284.heroku.com/, then change it to http://evening-wind-5284.heroku.com/drinks.

You should see the same screen as you did at http://localhost:3000/drinks and be able to click "New Drink" and "Create Drink" as expected.

If this works -- find a volunteer and show them

Step 2: Congratulations!

You get a sticker! (Or a high-five if there aren't any stickers).

Next Step:

Back to Create And Deploy A Rails App

If you find something that could be improved, please make a pull request or drop us a note via GitHub Issues (no technical knowledge required).

Source: https://github.com/RailsBridge-CapeTown