-
Notifications
You must be signed in to change notification settings - Fork 136
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 --environment
flag to dsl
/gem
commands
#979
Conversation
lib/tapioca/cli.rb
Outdated
@@ -318,9 +333,15 @@ def __print_version | |||
end | |||
|
|||
no_commands do | |||
sig { returns(T::Boolean) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ohh is it working now? Maybe we can move back the methods from cli_helper
then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems to be working just fine. I can make that refactor afterwards, too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah ok, the runtime is failing because of this: sorbet/sorbet#5786
I'll move it to CliHelper
instead.
Tapioca is primarily a development tool, and thus, should be used to load applications/gems in `development` mode by default. Up to now, however, we assumed that we could just be not opinionated about this, which led to mismatch between the output of the commands locally and on CI system (which usually run in `test` environment). By adding an `--environment` flag that defaults to `development`, we can allow users to use the sensible default, but also to override it.
So that we can add a signature to it without having Thor think it is a command. Because of: sorbet/sorbet#5786
extend T::Sig | ||
extend T::Helpers | ||
|
||
requires_ancestor { Thor } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why can't it be under cli_helper
if we depend on Thor to get the options?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because CliHelper
is messed up. It requires Thor::Shell
as an ancestor, which doesn't expose options
, and we can't change that to Thor
since it is included by the base command as well 😱 .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Urgh alright, let's keep a note that we need to fix this as well 😱
@paracycle I've been thinking about this for a little while, and I wonder why this is the assumption. I think there's an argument to be made that it should only load gems from your Would love to hear your thoughts on this. |
Motivation
Fixes #657
Tapioca is primarily a development tool, and thus, should be used to load applications/gems in
development
mode by default. Up to now, however, we assumed that we could just be not opinionated about this, which led to mismatch between the output of the commands locally and on CI system (which usually run intest
environment).By adding an
--environment
flag that defaults todevelopment
, we can allow users to use the sensible default, but also to override it.Implementation
Add the flag to
dsl
andgem
commands and set environment variables forRAILS_ENV
andRACK_ENV
as early as possible with that value.Tests
Added CLI tests for the default value and supplied value of the environment flag.