Stagecoach¶ ↑
Not recommended for actual use! This was one of my first ever coding projects and the code quality is almost zero. I only keep it visible because about once every two years somebody finds in in a {stackoverflow answer I wrote in 2013}[https://stackoverflow.com/a/16146258/979091] and asks me about it. - @omnikron
Original README:¶ ↑
stagecoach works in two stages, init and deploy. The init stage creates a branch based on a redmine/planio issue, and the deploy stage merges and (yes!) deploys it.
In between you can use stagecoach -p to push changes from your current branch to your remote repo. This creates a remote branch for you if one does not exist already.
You should always run stagecoach from the root directory of your repo Otherwise it may (will) break.
The first time you run stagecoach it will ask you for some information, namely your redmine/planio repo URL and your API key for this repo. It will also install a custom commit-msg git hook (if you ask it to) - for more information, see below.
All stagecoach config is saved in /path/to/your/repo/.stagecoach~ which is created at initial setup and added to your global .gitignore. This is a yaml file with fairly obvious syntax so if you need to remove a branch or edit the issue number that a branch points to, it is possible (although not necessarily recommended) to edit it.
Init Stage¶ ↑
stagecoach -r[edmine] 4115 (OR) -g[ithub] 525 -b[ranch] my_new_branch (optional: -f[rom] original_branch, default => master)
You can also just run stagecoach without any flags and it will allow you to enter this stuff manually.
The -f flag allows you to choose which branch you would like to branch out from. The default is master.
To get started, all stagecoach needs from you is the issue number you are working on (redmine/planio or github) and a new branch name. You /can/ use an existing branch if it is up to date with your chosen original branch. If it is not, stagecoach will squawk and die and you will have to bring the branch up to date, or use a new one.
If you are working from a redmine/planio issue, stagecoach sets the issue to ‘In Progress’. Currently it does not assign the issue to you, but you have the option to view the issue in your browser and do this manually. It also sets up a git issue for you to reference in your commits (see commit-msg githook).
If you are working from a github issue, we can all get on with our lives.
Coding Stage¶ ↑
Future versions of stagecoach may do the coding for you, but at the moment you have to do this part manually. Just code and commit, code and commit until your feature or fix is ready.
Commit-msg githoo: If you opt to install the commit-msg githook during initial setup (stagecoach -s) then your commit messages will be automatically referenced to the github issue of the branch you are in (this only applies to branches created or registered in Stagecoach).
-
to reference a different issue from a commit, simply refer to it as normal with ‘#xxx` in the commit message. The git-hook will leave your message alone.
-
to make no reference at all, you can use the ‘#noref` tag in the commit message.
-
to close an issue with a commit, use the ‘#closes` tag.
For more information, see
-
the githook itself at ‘/path/to/your/repo/.git/hooks/commit-msg`
Deploy Stage¶ ↑
stagecoach -d[eploy]
This automates the entire deploy workflow for you as follows:
git checkout [chosen deploy branch] git pull git merge task_name git push origin staging cap staging deploy set redmine/planio ticket to 'feedback' status (if applicable)
Sample usage:
stagecoach -r 4115 -b new_branch_name -f branch_to_branch_out_from [code, commit until feature or fix is complete] stagecoach -d staging
Flags
--branch, -b: Enter your new branch name here, eg. stagecoach -b new_branch (optional) --deploy, -d: Use this option to skip straight to push & deploy if you have already pulled from master and created your new branch --from, -f: Set the original branch from which you would like to make your new branch. Default is 'master' --github, -g: Enter your github issue number here, eg. stagecoach -g 1234 (optional) --help, -h: Shows your help --push, -p: Push the current branch to remote. Creates a remote branch if none exists. --redmine,-r: Enter your planio issue number here, eg. stagecoach -p 1234 (optional) --setup, -s: Use this the first time you run stagecoach to save your redmine repository/api key and install the commit-msg githook if desired --version, v: Prints the current version