-
Notifications
You must be signed in to change notification settings - Fork 38
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
configuration with command-line arguments #14
Comments
Hi X1011. I recently came across your script and it suits me -almost- well. My syntax is currently like this About your cons:
About your questions:
Cheers |
I think this is a fantastic idea! I'd actually started writing a fork of this script to remove configuration bits (and do some other stuff that probably doesn't matter), but this makes me want to drop my fork and come back to this project. I agree with @LeonardDrs about the defaults for those three arguments; they're totally sane.
Here're a couple of ideas that might make things even more flexible, robust, and mitigate some of the cons for ad-hoc usage:
This'd let users run the script with the existing "the script's defaults work for me" and "my environment vars are fine" assumptions, plus let "project-specific" environments and ad-hoc command-line'ing override/replace the more generally-scoped vars. Would totally make sense to punt "add support for |
@matro, cool, that all sounds good. Have at it! |
1. If `.env` exists in the current path, it gets sourced. 2. If `-c $FILE` or `--config-file $FILE` is specified, `$FILE` gets sourced. Values set earlier get overriden by those set later. Fixes part of X1011#14.
1. If `.env` exists in the current path, it gets sourced. 2. If `-c $FILE` or `--config-file $FILE` is specified, `$FILE` gets sourced. Values set earlier get overriden by those set later. Fixes part of X1011#14.
I think there are pull requests for all three aspects of this now. |
I'm game for trying to get the args-parsing into its own function with test coverage as well... should we take that to a separate issue/PR, or keep this thread going? |
I'm gonna say keep this thread going, as all the PRs are in support of this goal. Then, the last PR out can close this issue. |
So I've learned a bit about writing bats tests, and have some new test files added to both PRs. I put them in Should I pop my new test files up to the project root, or would it make sense to put all tests in the tests folder? |
I think you have too many tests now. Most of the variables are being parsed the exact same way, so the tests aren't testing unique behaviors, and the extra tests aren't adding much value, but they complicate maintenance and onboarding, increase run time, etc.
The rest i think we can do without. That may change how you want to organize the tests into files, but I'm gonna say once we end up with 4 or more .bats test files in the root, then let's put them in their own folder. And don't forget to update Also, i don't know if you've noticed the 'pseudo groups' i've created using clever whitespace in the test names. I was going for an RSpec/Mocha-style format. What do you think, is it worth continuing that style? |
Okay, I'll pair down and consolidate things a bit. This is my first time actually writing unit tests of any kind, so I'm kind of learning as I go. I was also trying to tease out any more weird cases like I did notice the 'pseudo groups' thing you did. I think it's definitely worth continuing. I haven't tried to follow it so far because I'm not how to logically group this stuff yet. Definitely makes more legible output. |
So #20 looks good to me now. Things turned out pretty simple, once some of this other stuff was done and I had some clue about what I'm doing. I'm tempted to take the "make |
yea, i say take |
Did these command line arguments ever get implemented? I'm trying to setup automated deployment of a subfolder to a I've defined the following script: ./deploy.sh ./app gh-pages https://$GITHUB_TOKEN@github.com/USER/REPO.git
# Where 'USER' and 'REPO' are filled in ofc 😇
# $GITHUB_TOKEN is available as a secure travis env variable As you can see it's following the Here's the output: Deploy directory 'dist' does not exist. Aborting.
Script failed with status 1 As you can see, even though I've specified I'm unsure, there seems to be a pull request (#20) that's ready to go — but it's open 🤔 and hasn't been touched since 2015. I'm gonna add a question in hereThe README file was a little vague to me. Would it be possible to just set env variables and the script would pick up on them? I'm talking about these variables:
|
I'm thinking about changing how the configuration is specified. Rather than having users modify the script or set environment variables, the script would take additional command-line arguments. I would do this for
deploy_directory
,deploy_branch
, andrepo
. I would eliminatedefault_username
anddefault_email
and just require the user to have git sufficiently configured beforehand.I'm considering a syntax like this:
deploy.sh [<options>] [<directory> [<branch> [<repository>]]]
pros:
deploy_directory
is relative to the current working directory, eliminating the need to mention this in the readmecons:
questions:
deploy.sh [-d <directory>] ...
)Let me know if you think this is a good or bad idea.
The text was updated successfully, but these errors were encountered: