-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Arik Kfir
committed
Sep 19, 2017
1 parent
cda2794
commit 027ee5a
Showing
7 changed files
with
150 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.iml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
language: generic | ||
sudo: required | ||
services: | ||
- docker | ||
|
||
before_script: | ||
- docker login -u "${DOCKERHUB_USERNAME}" -p "${DOCKERHUB_PASSWORD}" | ||
script: | ||
- docker build -t infolinks/slugger:${TRAVIS_COMMIT} . | ||
- | | ||
if [[ ${TRAVIS_TAG} =~ ^v[0-9]+$ ]]; then | ||
docker tag infolinks/slugger:${TRAVIS_COMMIT} infolinks/slugger:${TRAVIS_TAG} | ||
docker push infolinks/slugger:${TRAVIS_TAG} | ||
docker tag infolinks/slugger:${TRAVIS_COMMIT} infolinks/slugger:latest | ||
docker push infolinks/slugger:latest | ||
fi | ||
after_script: | ||
- | | ||
if [[ "${TRAVIS_BRANCH}" == "master" ]]; then | ||
docker run infolinks/github-release:v3 \ | ||
--token="${GITHUB_ACCESS_TOKEN}" \ | ||
--repo="${TRAVIS_REPO_SLUG}" \ | ||
--commit="${TRAVIS_COMMIT}" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Contributor Covenant Code of Conduct | ||
|
||
## Our Pledge | ||
|
||
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. | ||
|
||
## Our Standards | ||
|
||
Examples of behavior that contributes to creating a positive environment include: | ||
|
||
* Using welcoming and inclusive language | ||
* Being respectful of differing viewpoints and experiences | ||
* Gracefully accepting constructive criticism | ||
* Focusing on what is best for the community | ||
* Showing empathy towards other community members | ||
|
||
Examples of unacceptable behavior by participants include: | ||
|
||
* The use of sexualized language or imagery and unwelcome sexual attention or advances | ||
* Trolling, insulting/derogatory comments, and personal or political attacks | ||
* Public or private harassment | ||
* Publishing others' private information, such as a physical or electronic address, without explicit permission | ||
* Other conduct which could reasonably be considered inappropriate in a professional setting | ||
|
||
## Our Responsibilities | ||
|
||
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. | ||
|
||
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. | ||
|
||
## Scope | ||
|
||
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. | ||
|
||
## Enforcement | ||
|
||
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at dev@infolinks.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. | ||
|
||
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. | ||
|
||
## Attribution | ||
|
||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] | ||
|
||
[homepage]: http://contributor-covenant.org | ||
[version]: http://contributor-covenant.org/version/1/4/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Contributing | ||
|
||
When contributing to this repository, please first discuss the change | ||
you wish to make via issue, email, or any other method with the owners | ||
of this repository before making a change. | ||
|
||
Please note we have a code of conduct, please follow it in all your | ||
interactions with the project. | ||
|
||
## Pull Request Process | ||
|
||
1. Include updates to README.md with details of the change, including | ||
new environment variables or mounts, preferably with examples. | ||
2. Undocumented code will be rejected, as well as over-documented code :) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
FROM alpine:3.6 | ||
MAINTAINER Arik Kfir <arik@infolinks.com> | ||
RUN apk --no-cache --update add bash | ||
COPY slug.sh /usr/local/bin/ | ||
RUN chmod a+x /usr/local/bin/slug.sh | ||
ENTRYPOINT ["/usr/local/bin/slug.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Slugger | ||
|
||
Slugger is a small script to create a slug from a given input. | ||
|
||
Slugger is distributed as a Docker container, so you can run it anywhere | ||
and get a consistent slug back - like this: | ||
|
||
$ docker run infolinks/slugger "Custom branch for my feature" | ||
custom-branch-for-my-feature | ||
|
||
To save it in a Bash variable: | ||
|
||
$ SLUG=$(docker run infolinnks/slugger "My Feature") | ||
$ echo ${SLUG} | ||
my-feature | ||
|
||
Slugger will change colons, spaces, backslashes, dots, etc into dashes. | ||
|
||
**NOTE:** slugger _will not_ print a new-line at the end of the slug. | ||
So if you try this in an interactive Bash environment (not when using a | ||
script) you might see a `%` at the end of the line, similar to this: | ||
|
||
$ docker run infolinks/slugger "Custom branch for my feature" | ||
custom-branch-for-my-feature% | ||
|
||
Don't worry about that `%` at the end of the output - it's just the | ||
terminal complaining about the missing end-of-line. | ||
|
||
## Contributions | ||
|
||
Any contribution to the project will be appreciated! Whether it's bug | ||
reports, feature requests, pull requests - all are welcome, as long as | ||
you follow our [contribution guidelines for this project](CONTRIBUTING.md) | ||
and our [code of conduct](CODE_OF_CONDUCT.md). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/usr/bin/env bash | ||
|
||
# shows script usage and exits with exit-code 1 | ||
function show_usage() { | ||
[[ ! -z "${1}" ]] && echo ${1} >&2 | ||
echo "usage: $(basename $0) <string>" >&2 | ||
exit 1 | ||
} | ||
|
||
# converts given string to a slug | ||
function make_slug() { | ||
STR=${1} | ||
STR=${STR//: /-} | ||
STR=${STR//\//-} | ||
STR=${STR//:/-} | ||
STR=${STR//\\/-} | ||
STR=${STR// /-} | ||
STR=${STR//./-} | ||
echo -n ${STR} | ||
} | ||
|
||
# create a tag with the branch version | ||
STR="${1}" | ||
[[ -z "${STR}" ]] && show_usage "missing string parameter" | ||
echo -n "$(make_slug "${STR}")" | tr '[:upper:]' '[:lower:]' |