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 ability to configure the BASE_COMMAND #295

Open
pusewicz opened this issue Mar 18, 2024 · 2 comments
Open

Add ability to configure the BASE_COMMAND #295

pusewicz opened this issue Mar 18, 2024 · 2 comments

Comments

@pusewicz
Copy link

Currently, the BASE_COMMAND is hardcoded to bin/rails test.

It would be wonderful to be able to configure this command to something else.

Use case

Using tilt, docker-compose or similar solution requires prefixing most of the commands in order to execute them in the container.

Having the ability to configure this command would allow for easier integration with the tools mentioned above.

One could have a custom bin/docker-rails script available that would do the path transformation and run the bin/rails test command in the correct container.

@Earlopain
Copy link
Contributor

It would be best to develop in an environment where rails is able to run. The best option I know for this would be DevContainers, however personally I'm not a huge fan of them, stuff just tends to break on me, so I find myself outside most of the time anyways.

You could add the following to your .bashrc or similar:

bin/rails () {
  if [ "$PWD" == "/path/to/your/project" ] && [ "$1" == "test" ]; then
    shift;
    # I have a service called tests which just calls bin/rails test
    docker compose run --rm tests "$@"
  else
    ./bin/rails "$@"
  fi;
}

The runner which currently provides schema hints will also requires rails to be able to run, so that will just not work. Overall I find this pretty hacky and not very portable but hey, at least tests will do their thing.

@andyw8 andyw8 added railsconf-hackday Issues intented for working on during RailsConf 2024 Hack Day and removed railsconf-hackday Issues intented for working on during RailsConf 2024 Hack Day labels May 2, 2024
@okan-instrumentl
Copy link

We have a very similar workflow, running rails on docker; so it'd be really great if we can customize the command. At the moment, all testing features are unusable for us.

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

No branches or pull requests

4 participants