-
Notifications
You must be signed in to change notification settings - Fork 3
Installing VMWare and running Ruby
First things, first, download this: http://webwork.cs.rpi.edu/RPI_Webwork_VM.zip
Now, open up the VMware player. If you're using windows, it should look like this:
Click "Open a Virtual Machine" and navigate to RPI_Webwork_VM\RPI_Webwork\rpi_webwork, add the file "rpi_webwork.vmx". It will prompt you to "Take Ownership". Click that button.
If it asks you whether you copied or moved it, click "I copied it". (I'm not sure how much this really matters, but this is a comprehensive guide)
If you've opened and run the .vmx correctly, you should be brought to a boot menu. Select the top option, or wait and it will select itself.
You should be at a login screen now, it will look like this:
The password is 'wwadmin', because we here at RCOS are pioneers of creative security measures.
Congrats, you've made it to the desktop.
Now we need to install Ruby and make sure you're reasonably well versed in Linux command line Git and Ruby. If this sounds very difficult and intimidating, don't worry, it's not nearly as bad as you think it is.
Click the button in the upper left, then click Terminal.
It is recommended that you use rvm (Ruby Version Manager) to install Ruby.
It is possible that you already have Ruby installed using your system's package manager. This isn't recommended because often the version of Ruby is old but in some cases you may be able to get away with it. To check if you have Ruby already installed, run this command:
ruby -v
If this command returns an error (such as "command not found"), skip to the section titled Installation by RVM. If this command displays the version of Ruby you have, then you already have Ruby installed. If the version displayed is 2.0.0 or greater, you are all set with this step and can skip down to Grapefruit Installation. Otherwise, if the version is something lower than 2.0, you should uninstall your existing Ruby. The command to do that on Ubuntu is:
sudo apt-get remove ruby
After running, do a quick ruby -v
and verify that the command is not found. Then, proceed to the next section.
The command to install RVM as well as Ruby is:
\curl -sSL https://get.rvm.io | bash -s stable --ruby=2.0.0
Simply append --rails
to install Rails as well (recommended).
Note that this is the all-in-one command to install both Ruby and RVM. If you have trouble installing both at once, or are interested in other installation options, check out rvm's installation guide.
Now that Ruby is installed and ready it is time to set up Grapefruit. You will have your own development server running the Grapefruit platform.
First, you have to get your own copy of the code. We use git
for source code management. Open up a terminal in the directory where you want the code and run this command:
git clone https://github.com/grahamcracker/grapefruit.git
You can now cd grapefruit/
and you will be in the grapefruit directory.
The first step of getting Grapefruit up and running is to configure your database. There is an example database file in config/database-example.yml
. You can copy this to be your own configuration file using this command (or, alternatively, use the file browser):
cp config/database-example.yml config/database.yml
The example configuration is not suitable for use so you have to edit it. Using your editor of choice, open config/database.yml
.
It's the best practice to use the same database setup in production as in development. We use MySQL in production but it's a bit involved to set up on your local machine. If you want to try and set up MySQL, I will update the guide at one point to include that, but for now just use SQLite. Replace development:
and all of the indented lines directly under it with this:
development:
adapter: sqlite3
database: db/development.sqlite3
pool: 5
timeout: 5000
Ruby (and Rails) use things called "gems" which are libraries that can easily be added to a project as a dependency. You have to install the latest version of Grapefruit's gems. To do this, run this command:
bundle install
This step is often where things go wrong. If you get an error message (basically anything in red text) and aren't sure what is going on, post an Issue on GitHub.
Next, you have to create the database and fill in with our initial data set. To do this, run this command:
rake db:create db:schema:load db:seed
You're almost there! The last step is to start the server. Run this command:
rails s
The command should hang if everything starts correctly. To test, open http://localhost:3000/ in your web browser. You should see Grapefruit.