Skip to content

Commit faffc18

Browse files
committed
Initial release
0 parents  commit faffc18

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+7372
-0
lines changed

.appveyor.yml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
build: false
2+
clone_depth: 1
3+
platform: x86
4+
5+
environment:
6+
matrix:
7+
- PHP_DOWNLOAD_FILE: php-7.0.16-nts-Win32-VC14-x86.zip
8+
9+
cache:
10+
- c:\php -> .appveyor.yml
11+
- '%LOCALAPPDATA%\Composer'
12+
13+
init:
14+
- SET PATH=c:\php;%PATH%
15+
- SET COMPOSER_NO_INTERACTION=1
16+
- SET PHP=1
17+
- SET ANSICON=121x90 (121x90)
18+
- git config --global core.autocrlf input
19+
20+
install:
21+
- IF EXIST c:\php (SET PHP=0) ELSE (mkdir c:\php)
22+
- cd c:\php
23+
- IF %PHP%==1 appveyor DownloadFile http://windows.php.net/downloads/releases/archives/%PHP_DOWNLOAD_FILE%
24+
- IF %PHP%==1 7z x %PHP_DOWNLOAD_FILE% -y > 7z.log
25+
- IF %PHP%==1 echo @php %%~dp0composer.phar %%* > composer.bat
26+
- appveyor DownloadFile https://getcomposer.org/composer.phar
27+
- copy php.ini-production php.ini /Y
28+
- echo date.timezone="UTC" >> php.ini
29+
- echo extension_dir=ext >> php.ini
30+
- echo extension=php_openssl.dll >> php.ini
31+
- echo extension=php_curl.dll >> php.ini
32+
- echo extension=php_mbstring.dll >> php.ini
33+
- echo extension=php_fileinfo.dll >> php.ini
34+
- cd %APPVEYOR_BUILD_FOLDER%
35+
- composer update --no-progress --ansi
36+
37+
test_script:
38+
- cd %APPVEYOR_BUILD_FOLDER%
39+
- composer test

.editorconfig

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
; This file is for unifying the coding style for different editors and IDEs.
2+
; More information at http://editorconfig.org
3+
4+
root = true
5+
6+
[*]
7+
charset = utf-8
8+
indent_size = 4
9+
indent_style = space
10+
end_of_line = lf
11+
insert_final_newline = true
12+
trim_trailing_whitespace = true
13+
14+
[*.md]
15+
trim_trailing_whitespace = false
16+
17+
[*.yml]
18+
indent_style = space
19+
indent_size = 2

.gitattributes

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
* text=auto eol=lf
2+
3+
.appveyor.yml export-ignore
4+
.editorconfig export-ignore
5+
.gitattributes export-ignore
6+
.gitignore export-ignore
7+
.gitmessage export-ignore
8+
.gub export-ignore
9+
.php_cs export-ignore
10+
.travis.yml export-ignore
11+
CHANGELOG.md export-ignore
12+
CONDUCT.md export-ignore
13+
CONTRIBUTING.md export-ignore
14+
LICENSE.md export-ignore
15+
phpunit.xml.dist export-ignore
16+
README.md export-ignore
17+
tests/ export-ignore

.gitignore

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.DS_Store
2+
.php_cs.cache
3+
/vendor
4+
/coverage-reports
5+
composer.lock
6+
phpunit.xml
7+
TODO.md

.gitmessage

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Subject line
2+
3+
# - Capitalise the subject line and do not end it with a period
4+
# - Use the imperative mood in the subject line
5+
# - Summarise changes in around 50 (soft limit, hard limit at 69)
6+
# characters or less in the subject line
7+
# - Separate subject line from body with a blank line
8+
Optional subject body
9+
# - Capitalise the subject body
10+
# - Use the subject body to explain what and why vs. how
11+
# - Wrap the subject body at 72 characters

.php_cs

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
$finder = PhpCsFixer\Finder::create()
4+
->in(__DIR__);
5+
6+
$cacheDir = getenv('TRAVIS') ? getenv('HOME') . '/.php-cs-fixer' : __DIR__;
7+
8+
$rules = [
9+
'psr0' => false,
10+
'@PSR2' => true,
11+
'ordered_imports' => ['alpha'],
12+
];
13+
14+
return PhpCsFixer\Config::create()
15+
->setRules($rules)
16+
->setFinder($finder)
17+
->setCacheFile($cacheDir . '/.php_cs.cache');

.travis.yml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
language: php
2+
3+
git:
4+
depth: 2
5+
6+
matrix:
7+
include:
8+
- php: hhvm
9+
- php: nightly
10+
- php: 7.1
11+
- php: 7.0
12+
env:
13+
- LINT=true
14+
fast_finish: true
15+
16+
cache:
17+
directories:
18+
- $HOME/.composer/cache
19+
20+
before_script:
21+
- phpenv config-rm xdebug.ini || true
22+
- travis_retry composer self-update
23+
- travis_retry composer install --no-interaction
24+
25+
script:
26+
# Verify application version and Git tag match on tagged builds
27+
- if [[ ! -z "$TRAVIS_TAG" ]]; then
28+
composer application-version-guard;
29+
fi
30+
- if [[ $LINT = true ]]; then
31+
composer cs-lint;
32+
fi
33+
- composer test

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Changelog
2+
3+
#### v1.0.0 `2017-04-03`
4+
- First release.

CONDUCT.md

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
In the interest of fostering an open and welcoming environment, we as
6+
contributors and maintainers pledge to making participation in our project and
7+
our community a harassment-free experience for everyone, regardless of age, body
8+
size, disability, ethnicity, gender identity and expression, level of experience,
9+
nationality, personal appearance, race, religion, or sexual identity and
10+
orientation.
11+
12+
## Our Standards
13+
14+
Examples of behavior that contributes to creating a positive environment
15+
include:
16+
17+
* Using welcoming and inclusive language
18+
* Being respectful of differing viewpoints and experiences
19+
* Gracefully accepting constructive criticism
20+
* Focusing on what is best for the community
21+
* Showing empathy towards other community members
22+
23+
Examples of unacceptable behavior by participants include:
24+
25+
* The use of sexualized language or imagery and unwelcome sexual attention or
26+
advances
27+
* Trolling, insulting/derogatory comments, and personal or political attacks
28+
* Public or private harassment
29+
* Publishing others' private information, such as a physical or electronic
30+
address, without explicit permission
31+
* Other conduct which could reasonably be considered inappropriate in a
32+
professional setting
33+
34+
## Our Responsibilities
35+
36+
Project maintainers are responsible for clarifying the standards of acceptable
37+
behavior and are expected to take appropriate and fair corrective action in
38+
response to any instances of unacceptable behavior.
39+
40+
Project maintainers have the right and responsibility to remove, edit, or
41+
reject comments, commits, code, wiki edits, issues, and other contributions
42+
that are not aligned to this Code of Conduct, or to ban temporarily or
43+
permanently any contributor for other behaviors that they deem inappropriate,
44+
threatening, offensive, or harmful.
45+
46+
## Scope
47+
48+
This Code of Conduct applies both within project spaces and in public spaces
49+
when an individual is representing the project or its community. Examples of
50+
representing a project or community include using an official project e-mail
51+
address, posting via an official social media account, or acting as an appointed
52+
representative at an online or offline event. Representation of a project may be
53+
further defined and clarified by project maintainers.
54+
55+
## Enforcement
56+
57+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
58+
reported by contacting the project team. All
59+
complaints will be reviewed and investigated and will result in a response that
60+
is deemed necessary and appropriate to the circumstances. The project team is
61+
obligated to maintain confidentiality with regard to the reporter of an incident.
62+
Further details of specific enforcement policies may be posted separately.
63+
64+
Project maintainers who do not follow or enforce the Code of Conduct in good
65+
faith may face temporary or permanent repercussions as determined by other
66+
members of the project's leadership.
67+
68+
## Attribution
69+
70+
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.4,
71+
available at [http://contributor-covenant.org/version/1/4](http://contributor-covenant.org/version/1/4/).

CONTRIBUTING.md

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# How to contribute
2+
3+
Thanks for considering to contribute to `git-user-bend`. While doing so please follow these single guidelines:
4+
5+
- All code __MUST__ follow the PSR-2 coding standard. Please see [PSR-2](http://www.php-fig.org/psr/psr-2/) for more details.
6+
7+
- Coding standard compliance __MUST__ be ensured before committing or opening pull requests by running `composer cs-fix` or `composer cs-lint` in the root directory of this repository.
8+
9+
- Commits __MUST__ use the provided [commit message template](../.gitmessage), which follows the [rules](http://chris.beams.io/posts/git-commit/) described by Chris Beams. It can be configured via `composer configure-commit-template` prior to committing.
10+
11+
- All upstreamed contributions __MUST__ use [feature / topic branches](https://git-scm.com/book/en/v2/Git-Branching-Branching-Workflows) to ease merging.

LICENSE.md

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2017 Raphael Stolt
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

README.md

+91
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
git-user-bend
2+
================
3+
[![Build Status](https://travis-ci.org/raphaelstolt/git-user-bend.svg?branch=master)](https://travis-ci.org/raphaelstolt/git-user-bend)
4+
[![Build Status](https://ci.appveyor.com/api/projects/status/github/raphaelstolt/git-user-bend?svg=true)](https://ci.appveyor.com/api/projects/status/github/raphaelstolt/git-user-bend)
5+
[![Version](http://img.shields.io/packagist/v/stolt/git-user-bend.svg?style=flat)](https://packagist.org/packages/stolt/git-user-bend)
6+
![PHP Version](http://img.shields.io/badge/php-7.0+-ff69b4.svg)
7+
8+
The `git-user-bend` CLI is an utility tool for managing the Git user configuration (i.e. name and email) of a given Git repository. With it you can create a set of __personas__ and easily __bend__ them when doing company work, open source development, or __pair__ programming sessions.
9+
10+
#### Known relatives
11+
This CLI is influenced by the [Gas](https://github.com/walle/gas) Ruby gem and might also contain elements of [pair](https://github.com/square/pair).
12+
13+
#### Installation
14+
``` bash
15+
composer global require stolt/git-user-bend
16+
```
17+
18+
Make sure that `~/.composer/vendor/bin` is on your `$PATH`. This way the `git-user-bend` executable can be located.
19+
20+
Since the default name of the CLI is quite a mouthful, an alias which can be placed in `~/.aliases`, `~/.zshrc` or the like might come in handy.
21+
22+
``` bash
23+
alias gub='$HOME/.composer/vendor/bin/git-user-bend $@'
24+
```
25+
26+
## Usage
27+
Just run the `git-user-bend whoami` CLI within a Git repository (or an argumented one) and it will allow you to view the currently used persona respectively the Git user configuration details.
28+
29+
The personas and their usage frequencies are stored in a JSON based global storage file called `.gub.personas` in the `$HOME` directory of your system.
30+
31+
Via a `.gub` dotfile it's also possible to add the details of __single__ persona directly into a project repository. This is mostly oriented for repository maintainers working on multiple machines and with multiple personas.
32+
33+
#### Available commands
34+
To create a new persona the `add` command is available. It allows you to define an alias linked to persona details, which are basically the user name and email. Every added persona is stored in the global storage.
35+
``` bash
36+
git-user-bend add <alias> <name> <email>
37+
git-user-bend add "oss" "Raphael Stolt" "[email protected]"
38+
git-user-bend add "com" "Raphael Stolt" "[email protected]"
39+
```
40+
41+
To create a persona from a local `.gub` dotfile, local Git repository user details, or from global Git user details the `import` command can be used. When a persona should be created from the Git user details its alias has to be provided.
42+
``` bash
43+
git-user-bend import [<alias>] [<directory>] [--from-dotfile]
44+
```
45+
46+
To create a local `.gub` dotfile from an existing persona the `export` command is available.
47+
``` bash
48+
git-user-bend export <alias> [<directory>]
49+
```
50+
51+
To remove a defined persona from the global storage the `retire` command can be used.
52+
``` bash
53+
git-user-bend retire "oss"
54+
```
55+
56+
To view all defined personas the `personas` command is at your service.
57+
``` bash
58+
git-user-bend personas
59+
```
60+
61+
To bend the persona of a Git repository, the `use` command is there to change the Git user configuration to the aliased user details. When using the `--from-dotfile` option the persona defined in a `.gub` dotfile is used. When an aliased persona from the global storage should be used its alias has to be provided. When a pair should be used their aliases have to be provided.
62+
``` bash
63+
git-user-bend use [<alias>|<aliases>] [<directory>] [--from-dotfile]
64+
```
65+
66+
To start a pair programming session, which will be identifiable in the Git commits, the `pair` command merges the user details of several personas into one pair. The email of the first argumented persona alias will be used for the Git `user.email` configuration.
67+
``` bash
68+
git-user-bend pair "paul" "sarah" [<directory>]
69+
```
70+
71+
To check the persona, pair or respectively the Git user configuration of a repository the `whoami` command is a pleasant shortcut.
72+
``` bash
73+
git-user-bend whoami [<directory>]
74+
```
75+
76+
#### Running tests
77+
``` bash
78+
composer test
79+
```
80+
81+
#### License
82+
This library and its CLI are licensed under the MIT license. Please see [LICENSE](LICENSE.md) for more details.
83+
84+
#### Changelog
85+
Please see [CHANGELOG](CHANGELOG.md) for more details.
86+
87+
#### Code of Conduct
88+
Please see [CONDUCT](CONDUCT.md) for more details.
89+
90+
#### Contributing
91+
Please see [CONTRIBUTING](CONTRIBUTING.md) for more details.

0 commit comments

Comments
 (0)