Skip to content

Instantly share code, notes, and snippets.

@looztra
Last active February 27, 2019 13:42
Show Gist options
  • Save looztra/6648975e49f17881f4db60993c909cb7 to your computer and use it in GitHub Desktop.
Save looztra/6648975e49f17881f4db60993c909cb7 to your computer and use it in GitHub Desktop.
Bootstrap repo config
---
version: 2.1
jobs:
eclint:
working_directory: ~/docker-eclint/
docker:
- image: qima/eclint:circleci-2.8.1-7c65341
steps:
- checkout
- run:
name: Validate Editor Config rules
command: |
set -x
ls -l
git ls-files
eclint check $(git ls-files)
workflows:
version: 2
workflow:
jobs:
- eclint
# EditorConfig is awesome: https://EditorConfig.org
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
max_line_length = 120
trim_trailing_whitespace = true
# Matches multiple files with brace expansion notation
# Set default charset
[*.{js,py}]
charset = utf-8
# 4 space indentation
[*.py]
indent_style = space
indent_size = 4
max_line_length = 79
# Tab indentation (no size specified)
[Makefile]
indent_style = tab
[*.{tf,tfvars}]
indent_size = 2
indent_style = space
max_line_length = none
[*.{yml,yaml}]
indent_size = 2
indent_style = space
max_line_length = none
[*.md]
trim_trailing_whitespace = false
max_line_length = none
# Matches the exact files either package.json or .travis.yml
[{package.json,.travis.yml}]
indent_style = space
indent_size = 2
* @asiainspection/techops
function bootstrap-project-techops -d 'bootstrap project with default common config'
set -l gist_id 6648975e49f17881f4db60993c909cb7
set -l tmpdir (mktemp -d /tmp/tmp.gist-{$gist_id}-XXXXXXXX)
git clone --quiet https://gist.github.com/looztra/{$gist_id} $tmpdir >/dev/null
echo "Creating .circleci directory"
mkdir -p .circleci .github
echo "Creating .circleci/config.yml if it doesn't exist"
if not test -f .circleci/config.yml
mv $tmpdir/.circleci--config.yml .circleci/config.yml
else
echo ".circleci/config.yml already exists, skipping"
echo "Diff of existing vs gist"
echo "---"
diff .circleci/config.yml $tmpdir/.circleci--config.yml
echo "---"
end
echo "Creating .editorconfig if it doesn't exist"
if not test -f .editorconfig
mv $tmpdir/.editorconfig .editorconfig
else
echo ".editorconfig already exists, skipping"
echo "Diff of existing vs gist"
echo "---"
diff .editorconfig $tmpdir/.editorconfig
echo "---"
end
echo "Creating .github/CODEOWNERS if it doesn't exist"
if not test -f .github/CODEOWNERS
mv $tmpdir/.github--CODEOWNERS .github/CODEOWNERS
else
echo ".github/CODEOWNERS already exists, skipping"
echo "Diff of existing vs gist"
echo "---"
diff .github/CODEOWNERS $tmpdir/.github--CODEOWNERS
echo "---"
end
rm -rf $tmpdir
end
alias bootstrap_project="git clone --quiet https://gist.github.com/looztra/6648975e49f17881f4db60993c909cb7 > /dev/null \
&& mkdir -p .circleci .github\
&& mv 6648975e49f17881f4db60993c909cb7/.circleci--config.yml .circleci/config.yml \
&& mv 6648975e49f17881f4db60993c909cb7/.editorconfig .editorconfig \
&& mv 6648975e49f17881f4db60993c909cb7/.github--CODEOWNERS .github/CODEOWNERS \
&& rm -fr 6648975e49f17881f4db60993c909cb7"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment