Different versions of the Guess The Number game for TechLadies pre-bootcamp workshop #2
Guess the Number is a basic ruby application built on top of Sinatra for the purposes of TechLadies pre-bootcamp workshop #2, which covers the basics of the web, HTML and CSS. We will also cover some basic Git concepts and how to deploy the app onto Heroku. Given that everyone may be using different machines with different operating systems, we will be using CodeAnywhere as our development environment.
- GitHub (for version control)
- CodeAnywhere (an online editor)
- Heroku (for deploying your application)
You are encouraged to keep this page open, for easy reference, and also to make it easier to copy and paste certain commands, where necessary.
- Sign up for a GitHub account.
- Go to the Guess The Number project repository and fork it by clicking the Fork button in the top right corner (ask for help if you can't find it).
- Leave this window open as you will need to perform further set up actions to integrate smoothly with CodeAnywhere.
- Sign up for a CodeAnywhere account by clicking on the Sign up in the top right corner.
- Fill in an email address and password, resolve the CAPTCHA checkbox and click on Register.
- You will see a welcome message informing you your account has been created successfully.
- Check the email with which you used to sign up for Codeanywhere. You should receive an email from Codeanywhere Team that asks you to verify your account. Please do so (check your spam folder if you cannot find this email).
- After clicking the verify link in the email, it should lead you to a page that says you have successfully verified your account. Click the link to take you to the editor at the bottom of the message.
- You will see a Connection Wizard.
- Select the GitHub (second option on the sidebar), click on Connect your GitHub Account in the middle of the window.
- Depending on the browser you are using, you may or may not see a pop-up. If your browser has blocked the pop-up, please allow pop-ups for
codeanywhere.com
. - Authorise Codeanywhere to access your GitHub account by clicking the green Authorize codeanywhere button.
- You will be redirected back to Codeanywhere and you should be able to see the guess-the-number-sinatra repository in the window. Select it and the ruby icon will turn red. Click the tiny Next button in the bottom-right of the window.
- You will see a message called Create Container, it will run for a few minutes before closing itself.
- When all is done, you should be able to see a list of files in the left sidebar. And you're all set up.
- On the left sidebar, right-click guess-the-number-sinatra and select the second option: SSH Terminal.
- Run
bundle install
to install the required ruby dependencies. To do so, please typebundle install
in the terminal and press enter. - Then run
ruby app.rb -p 3000 -o 0.0.0.0
. To do so, please typeruby app.rb -p 3000 -o 0.0.0.0
in the console and press enter. - You should see something like this in the terminal
[2018-06-26 22:32:35] INFO WEBrick 1.3.1
[2018-06-26 22:32:35] INFO ruby 2.1.2 (2014-05-08) [x86_64-linux]
== Sinatra (v1.4.7) has taken the stage on 3000 for development with backup from WEBrick
[2018-06-26 22:32:35] INFO WEBrick::HTTPServer#start: pid=1383 port=3000
- Right-click guess-the-number-sinatra on the left sidebar again, and click on Info (should be the 6th option down the list).
- Scroll down until you see the line To access an application running on your Container use the following link (ports 1024-9999 available).
- Copy the link into a new browser window and add
:3000
at the end of the URL without any spaces (please ask the assistant coaches for help if you can't get this to work). It should look like this:http://guess-the-number-sinatra-huijing.codeanyapp.com:3000
- You should be able to see the Guess The Number app, and any changes you make to your code will be reflected when you refresh the page.
- Sign up for a Heroku account by clicking Sign Up in the top right corner.
- After verifying your email and setting your password, proceed to the dashboard.
- Click on the New button on the top right, click Create New App button, leave the defaults and click Create App.
- For Deployment Method, select the Connect to GitHub option.
- Click the Connect to Github button and authorise Heroku to have access to your GitHub account information.
- Search for the guess-the-number-sinatra repository and click the Connect button.
- If you choose to Enable Automatic Deploy, then every time you commit a change to your repository, Heroku will deploy those changes.
- You can also choose to manually deploy your app.