Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fixes #91

Merged
merged 5 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 21 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@


# Jimmy-Gym-Buddy-Finder-App


Expand All @@ -17,10 +18,11 @@ To get started with the project, follow these steps:
```
2. **Install Dependencies.** Ensure you have rbenv, ruby and bundler installed.
```bash
sudo apt install rbenv
rbenv install 3.3.4
sudo apt install rbenv
rbenv install 3.3.4
gem install bundler
bundle config set --local without 'production'
bundle install
```
3. **Setup Database.** Set up the database by running:
```bash
Expand All @@ -31,7 +33,7 @@ To get started with the project, follow these steps:

The app uses Omniauth for Google authentication. To configure Google OAuth:

- Follow the Google OAuth setup documentation.
- Follow the Google OAuth setup documentation for Rails app - [OAuth on Rails](https://github.com/tamu-edu-students/Google-Auth-Ruby-By-JD).
- Make sure to create a Google Developer Console project, set up OAuth credentials, and configure the redirect URI to match your Heroku app's domain.
- The required gems and corresponding configuration has been done already and can be found in `config/initializers/omniauth.rb`.
- The following environment variables are to setup in Rails credentials in order for omniauth to work:
Expand All @@ -42,7 +44,7 @@ To get started with the project, follow these steps:
```

5. **Setup Secrets**
- To add environment variables securely in Rails credentials, use the following command:
- To add any environment variables (Google Omniauth client_id and client_secret) securely in Rails credentials, use the following command:
```bash
EDITOR="vim" rails credentials:edit
```
Expand Down Expand Up @@ -109,40 +111,46 @@ To store profile images, you'll need to create an Amazon S3 bucket.

## 1. Heroku Application Setup


1. Log in to your Heroku account using the CLI:

1. Create an account on [Heroku](https://signup.heroku.com/) and install [Heroku CLI](https://devcenter.heroku.com/articles/heroku-cli).
2. Log in to your Heroku account using the CLI:

```bash
heroku login
```
2. Create a new Heroku app:
3. Create a new Heroku app:

```bash
heroku create <app-name>
```
- This will create a new Heroku app on your Heroku account.
- It also generates a new Heroku Git remote linked to the app.
3. Take generated remote URI and add it to git remote:
4. Add Heroku as a Git remote:
After creating the Heroku app, you will receive a **Git remote URL**. You will need to add this URL as a remote in your Git configuration.
To add it, run the following command:
```bash
git remote add <remote-name> <remote-uri>
```
4. Check the added Git remotes:
- Replace `<remote-url>` with the Git remote URL provided by Heroku (e.g., `https://git.heroku.com/<app-name>.git`).
- The remote is named `heroku` by default, but you can change the name if needed.
5. Check the added Git remotes:
To check that the Heroku remote was added successfully, run the following command:
```bash
git remote -v
```
- This will list all remotes in your local repository.
- Ensure the `heroku` remote is pointing to the correct Heroku app repository.
5. Set the Rails `master.key` on Heroku:
The `master.key` is required to decrypt the `credentials.yml.enc` file during runtime. Add it to Heroku using the following command:
7. Set the Rails `master.key` on Heroku:
The `master.key` is required to decrypt the `credentials.yml.enc` file during runtime. Typically, this key is stored in the `config/master.key` file in your local project. To set this key in Heroku’s environment, run:
```bash
heroku config:set RAILS_MASTER_KEY=$(cat config/master.key) --remote <remote-name>
```

6. Push your local project to Heroku:
8. Push your local project to Heroku:
```bash
git push <remote-name> main
```

This will push your local `main` branch to the Heroku remote repository, deploying your app.

## 2. Add Deployment URL to Google Developer Console

Expand Down
4 changes: 2 additions & 2 deletions app/controllers/user_matches_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ def organize_user_response(filtered_users, ordered_ids)
def fetch_matched_users(user_id)
matched_user_ids = UserMatch.where(user_id: user_id, status: "matched").pluck(:prospective_user_id)
prospective_user_ids = UserMatch.where(prospective_user_id: user_id, status: "matched").pluck(:user_id)

# Get the intersection of both lists to find bidirectional matches
bidirectional_matched_ids = matched_user_ids & prospective_user_ids

User.where(id: bidirectional_matched_ids).select(:id, :username, :email, :age, :gender)
end

Expand Down
16 changes: 16 additions & 0 deletions features/support/env.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,22 @@
require 'rack_session_access/capybara'
require 'capybara/cuprite' # Require Cuprite

require 'selenium-webdriver'

Capybara.register_driver :chrome do |app|
options = Selenium::WebDriver::Chrome::Options.new
options.add_argument('--headless') # Uncomment for headless mode
options.add_argument('--disable-gpu') # Disable GPU acceleration
options.add_argument('--no-sandbox') # Disable sandboxing for Docker environments

# Optionally, set the path to ChromeDriver if it's not in your PATH
# options.driver_path = "/path/to/chromedriver"

Capybara::Selenium::Driver.new(app, browser: :chrome, options: options)
end

Capybara.javascript_driver = :chrome

World(Rack::Test::Methods)

Capybara.default_max_wait_time = 5 # Adjust as needed for your app
Expand Down
Loading