These instructions should get you up and running on your local machine for development and testing purposes.
Open the Terminal app to run the install and configuration commands below.
First, you need to install Homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Next, install Ruby Version Manager RVM, which will also install Ruby and RubyGems.
\curl -sSL https://get.rvm.io | bash -s stable --ruby
Then install version 2.6.5
rvm install 2.6.5
Next, set version 2.6.5 as your default
rvm --default use 2.6.5
Finally, create a gemset to hold the gems you install for the project
rvm gemset create meetup
And set your terminal to use the gemset
rvm use 2.6.5@meetup
Install PostgresApp. Click download at the site and install to your applications.
Next, install the Command Line Tools.
You may need to close your Terminal window and open a new one for the changes to take affect. Any time you open a new Terminal window, you need to reset your rvm gemset again:
rvm use 2.6.5@meetup
See the After Install instructions below to run the app.
The following are untested by me, but should get you up and running on Windows. You also have the option of installing a Virtual Machine and running Ubuntu on Windows. Many also seem to be using Docker, which has a nice video tutorial here:
That will install the Ruby on Rails framework, which we are not using, but it has most of the same setup needs. And it won't hurt to have it to play with. Note, we are using Ruby 2.3.7 currently, so you may want to install that than the version in the example.
If you find that Docker will not work for you, try some of these options below for running Ruby in the Windows environment.
Windows 10 and higher apparently have a pretty good command line tool built in that works with linux apps. But if you are on an an older version, try:
Download Ruby Installer and follow the documentation to install version 2.3.7. This should also install the RubyGems package manager:
URU helps you to manage multiple versions of Ruby on Windows.
You should be able to register the version of ruby you installed above with URU. If you install other versions, register them as well. Then follow the directions to switch between them.
Install PostgreSQL for Windows. This will include a graphical interface you can use to drop, create and view your database.
Once everything is installed, from the command line, navigate to the directory of this project.
Bundler is a gem that conveniently manages our package installs. You must first install it from the command line:
gem install bundler
Next, you can run the bundle command:
bundle
This should install all the gems we'll be using for the project. If you run into errors and need help, email me at ryan@websuasion.com.
If you are using PostgresApp for mac with the commend line tools, run:
createdb meetup_api
Likewise, you can drop (delete) your database with:
dropdb meetup_api
Likewise, you can use the pgAdmin UI and add or drop your database as well.
In the files for both the config.ru and pry.rb files, you will need to change your username for postgres:
DataMapper.setup(:default, 'postgres://yourusername:@localhost/meetup_api')
Next, we just need to start the server up:
rerun "puma ./config.ru"
You can now hit the server with any HTTP Client. I recommend using Postman
You can also start up your app with Pry and explore your classes and objects from the command line.
pry -r ./pry.rb
Once it starts, you can try the following to see that it's working:
cd User
ls
Follow along with the videos here: