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

--base and --gruntfile joint usage is unexpected #112

Open
timolehto opened this issue Mar 23, 2017 · 2 comments
Open

--base and --gruntfile joint usage is unexpected #112

timolehto opened this issue Mar 23, 2017 · 2 comments

Comments

@timolehto
Copy link

When this fix db61cee was merged for back in the days for v0.1.12, things worked nice and clear.
--base specified the base dir
--gruntfile specified the gruntfile, and if no base was given base was inferred from gruntfile, just as if you hadn't specified it at all

Then two days later came 0.1.13 with c60e419 and ruined it
--base specifies the base dir only if no gruntfile specified, otherwise it's silently ignored
--gruntfile specifies the base dir and gruntfile

I find this decision to opt out of the IMHO much more logical 0.1.12 logic very strange and in clear violation of POLA. Perhaps there's a valid reason, but I just can't see it. I would personally like to see this reverted.

However, at the very least I think this should definitely be more clearly communicated. It should warn (or even error?) if the extraneous --base option is provided when --gruntfile is specified and this should definitely be communicated in the --help docs more clearly, (which) currently say:

                            --base  Specify an alternate base path. By default,
                                    all file paths are relative to the         
                                    Gruntfile. (grunt.file.setBase) *          
                       --gruntfile  Specify an alternate Gruntfile. By default,
                                    grunt looks in the current or parent       
                                    directories for the nearest Gruntfile.js or
                                    Gruntfile.coffee file.      

Which leads one to believe Gruntfile is default and base can override. In light of the docs the current behaviour is quite strange.

We actually have some old deployment scripts/tools that have been built to rely on the capability to provide Gruntfile and base dir separately and this means we are locked to using grunt-cli 0.1.12. It is quite a coincident that the person who wrote the damn thing happened to have that particular grunt-cli version installed, but so it appears to be. :)

@timolehto
Copy link
Author

Or if this can't be changed due to backwards incompatibility in some cases, then maybe there could be another cmd option, something like --force-base which could be used to set the base even if gruntfile is provided.

@thuva4
Copy link

thuva4 commented Nov 1, 2017

Any update on this issue?

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

2 participants