Skip to content

Instantly share code, notes, and snippets.

@Rhoxio
Last active July 17, 2018 02:42
Show Gist options
  • Save Rhoxio/66442b01f2baab650635eb31590e97fb to your computer and use it in GitHub Desktop.
Save Rhoxio/66442b01f2baab650635eb31590e97fb to your computer and use it in GitHub Desktop.

Setting Up Ruby

    1. Install Ruby from: https://rubyinstaller.org/downloads/
    • You should install 'Ruby+Devkit 2.4.4-2' and either the 32 or 64 bit version dependent on your OS.
    1. After installing, open up Powershell (with elevated permissions by running it as Admin) and send the command ruby -v. You should get a ruby version back. If you do not, try restarting your computer.
    • If everything is installed correctly, you should be able to send the 'irb' command to open up the ruby shell and play around with some basic code. You can do 3+4 or "string".gsub('i', 'o') or something.
    1. You save Ruby files with the extension '.rb'. You run Ruby files by calling ruby /path/to/file.rb.
    • The easiest way to check this is to put something like p "Hello World!" in a .rb file and simply trying to run it.

Getting Started with Git Source Control

    1. Install Git from here: https://git-scm.com/download/win
    1. Follow the directions to get your user account set up properly: https://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup
    1. Be sure that you have a Github account created. (https://github.com/)
    • At this point, you can either clone down an existing repo or create your own repository and clone that down. Either way, you are going to be using git clone some_url, or for the current project folder it would be: git clone https://github.com/Rhoxio/Portfolio321.git. This will copy the entire directory structure down and initialize source control on it.
    1. You will be on the 'master' branch initially after cloning the repo down. You can switch to a new branch by running git checkout -b new_branch_name. The -b parameter stands for 'new branch'. Now you can make changes to your new branch without making uncomitted changes directly on the master branch itself.
    1. Once you make changes, you can commit them using the git commitcommand. If you didn't set a text editor path in step 2, you can add your commit message inline by using git commit -m 'commit message goes here'. I would recommend using -m all the time as it helps keep commit descriptions concise.
    1. Once your changes are comitted to your current branch locally, you can push the code to GitHub by using git push origin new_branch_name. git push is the git command itself that tells it to push to the remote, which is origin in this case, to the new_branch_name branch. It should push the refs and be available on GitHub immediately after.
More advanced usage of git like resetting the write head, switching remotes, doing pull requests in your editor and fixing merge conflicts will be explained as they come up.

Windows Setup Note

After going through the installation process from scratch on my PC, I ran across a few small things that we need to check. If you didnt mess with your ruby installation, it should be fine. Otherwise, you may need to run ridk install.

Pulling Down the Repo and Installing Dependencies

I added you as a contributor to our GitHub. The link is: https://github.com/Rhoxio/Portfolio321/invitations. You should be able to pull the repo down once you have accepted. Take a look at the repo page (you can ignore the readme right now) and click the 'Clone or Download' button. Copy the URL in the box and open up Powershell as Admin.

Install Google Chrome

Also, make sure you have a current version of Google Chrome installed right now. The webdriver uses it. (Can swap later if we want to with very little overhead if we have problems.)

Next, we are going to pull it down to your current directory. It will clone the entire filesystem of the project including the top-most parent. This means that you don't have to create a folder specifically for app files, but will have the full structure pulled into the current directory.

  • Now, use the command git clone <url> substituing for the clone link you copied earlier. This should get you all of the project files.
  • Navigate to the folder you just cloned down and run gem install bundler. This is Ruby's package manager. This parses documentation for a while, it took mine like 2 mins to finish.
  • Run bundle install to install all of the project files. This command installs all of the gems (libraries) listed in the Gemfile in the root directory of the project.

Running the MVP test script.

Assuming everything installed correctly, you should be able to run the functionality test!

  • Navigate to the ./lib directory from the Porfolio321 folder.
  • A file called 'portfolio321.rb' should be present.
  • You can execute this file by running the command ruby portfolio321.rb.

You should see a Chrome window open and automatically log into Portfolio123. It will go to a specific page and cycle through tabs until the program is interrupted. You can do this using ctrl+c.

If you are able to do that, you are good to go. I'll get more of the backbone pieces (environment variables, other utility libraries, etc) set up and ping you. I also need to review the specs you sent me and start looking at what types of functionality we need.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment