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

Add more specific instructions for working on this gem locally #15

Merged
merged 1 commit into from
Dec 12, 2024

Conversation

zjohl
Copy link

@zjohl zjohl commented Dec 12, 2024

This adds some instructions for getting tests running on this gem locally. There may be some gaps in the process we need to fill but this is the majority of the steps that I followed


- If you don't already have ruby 3.2 installed locally, one option is using rbenv via the following:

1. Install [rbenv](https://github.com/rbenv/rbenv?tab=readme-ov-file#homebrew) via homebrew
Copy link
Author

@zjohl zjohl Dec 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why I have rbenv locally, it may have been for another app that didn't use nix, but it seems to do the trick aside from the libyaml issues (see note below)


2. Set a CONN_STR with the connection details: `set CONN_STR=DRIVER={PostgreSQL ANSI};SERVER=127.0.0.2;PORT=5432;DATABASE=foo_development;UID=USERNAME_HERE;password=PASSWORD_HERE`

- Using `DSN`
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have a ton of confidence in this approach because I used the CONN_STR

Tests do pass locally if I use the DSN env var but I don't understand how because we're not providing credentials...

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works for me too.

@zjohl
Copy link
Author

zjohl commented Dec 12, 2024

@kevin-j-m Do you happen to know anything about how the bundler cache works here? I'm assuming clearing the cache would fix things because we can install things properly without the cache but I don't understand where that mythical cache exists

README.md Outdated

- Using `CONN_STR`:

1. Create a postgres database to use or get the configuration details for an existing one

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we add instructions for how to do this?

README.md Outdated Show resolved Hide resolved

2. Set a CONN_STR with the connection details: `set CONN_STR=DRIVER={PostgreSQL ANSI};SERVER=127.0.0.2;PORT=5432;DATABASE=foo_development;UID=USERNAME_HERE;password=PASSWORD_HERE`

- Using `DSN`

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works for me too.

3. `rbenv local 3.2.0`

- Note: if you are using nix for local development of other apps, the version of libyaml installed by this method can interfere with the building of native extensions for those apps. To fix that, you'll need to run `brew uninstall --ignore-dependencies libyaml` and re-run your bundle install inside of that nix shell. You'll then need to reinstall libyaml via homebrew if you want to work on this gem.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something else you need is unixodbc.

brew install unixodbc

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah great, I knew there was something else but couldn't find it in my terminal history (or notes...)

README.md Outdated

- Note: if you are using nix for local development of other apps, the version of libyaml installed by this method can interfere with the building of native extensions for those apps. To fix that, you'll need to run `brew uninstall --ignore-dependencies libyaml` and re-run your bundle install inside of that nix shell. You'll then need to reinstall libyaml via homebrew if you want to work on this gem.

2. Run `bundle install` in this directory to install the relevant gems

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had some issues installing ruby-odbc. In order to resolve this, I used this answer.

brew list unixodbc
gem install ruby-odbc -- --with-odbc-dir=/opt/homebrew/Cellar/unixodbc/2.3.12

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't going to work verbatim because...OS differences, but...CI is seeing the same error I was locally that this resolves.

Weird that it wasn't happening before though.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you happen to know anything about how the bundler cache works here?

Does this answer your questions?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regarding CI, see #17.

@zjohl zjohl force-pushed the zj-local-dev-instructions branch 2 times, most recently from 7cff42e to e1ee35f Compare December 12, 2024 21:08
@zjohl zjohl force-pushed the zj-local-dev-instructions branch from e1ee35f to e0866f7 Compare December 12, 2024 21:09
@zjohl zjohl merged commit 3462ac3 into main Dec 12, 2024
2 checks passed
@zjohl zjohl deleted the zj-local-dev-instructions branch December 12, 2024 21:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants