Skip to content

Commit

Permalink
!#1 Add: script for makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
luismayta committed Apr 7, 2017
1 parent a412840 commit e664f73
Show file tree
Hide file tree
Showing 14 changed files with 120 additions and 6 deletions.
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
- repo: [email protected]:pre-commit/pre-commit-hooks
sha: 96fb7fa10f2f4c11ed33482a9ad7474251e5e97f
sha: 5bf6c09bfa1297d3692cadd621ef95f1284e33c0
hooks:
- id: detect-private-key
files: ^(?!\.?git-crypt)
Expand Down Expand Up @@ -27,28 +27,28 @@
- id: requirements-txt-fixer
- id: name-tests-test
- repo: git://github.com/pre-commit/mirrors-pylint
sha: v1.6.4
sha: v1.6.4.post1
hooks:
- id: pylint
args:
- --rcfile=.pylintrc
- repo: git://github.com/pre-commit/mirrors-scss-lint
sha: v0.50.2
sha: v0.52.0
hooks:
- id: scss-lint
files: \.(scss)$
- repo: [email protected]:pre-commit/pre-commit
sha: v0.9.4
sha: b63748f5572682e7bf8b30b12d67b293b2eae3dc
hooks:
- id: validate_config
- id: validate_manifest
- repo: git://github.com/FalconSocial/pre-commit-python-sorter
sha: 1.0.4
sha: b57843b0b874df1d16eb0bef00b868792cb245c2
hooks:
- id: python-import-sorter
args:
- --silent-overwrite
- repo: git://github.com/detailyang/pre-commit-shell
sha: 1fdffa0434cde2b87f19ad258201d3e81481af5f
sha: 75af325c913743d7abf2ff6fd71dfbf9490bd8b4
hooks:
- id: shell-lint
17 changes: 17 additions & 0 deletions script/bootstrap.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bash
# -*- coding: utf-8 -*-

export PROJECT_NAME=ansible-role-monit
export PYTHON_VERSION=2.7.9
export PYENV_NAME="${PROJECT_NAME}"

export GRIP_PORT=6430

# Vars Dir
export ROOT_DIR
ROOT_DIR=$(pwd)
export RESOURCES_DIR="$ROOT_DIR/resources"
export RESOURCES_DB_DIR="$RESOURCES_DIR/db"
export PROVISION_DIR="$ROOT_DIR/provision/ansible"
export SOURCE_DIR="${ROOT_DIR}/"
export REQUIREMENTS_DIR="${SOURCE_DIR}/requirements/"
11 changes: 11 additions & 0 deletions script/clean.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash
# -*- coding: utf-8 -*-

# shellcheck source=/dev/null
[ -r "script/bootstrap.sh" ] && source "script/bootstrap.sh"

{
rm -rf -- **/**/*__pycache__
rm -rf -- **/**/*.pyc
rm -rf -- **/**/*.swp
} >> /dev/null 2>&1
10 changes: 10 additions & 0 deletions script/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash
# -*- coding: utf-8 -*-

# shellcheck source=/dev/null
[ -r "script/bootstrap.sh" ] && source "script/bootstrap.sh"

ansible-playbook "${FILE_PLAYBOOK}" -i "${PATH_INVENTORY}" -v \
--user="${USER}" --private-key="${PRIVATE_KEY}" \
--extra-vars "${EXTRA_VARS}" \
--vault-password-file ~/.vault_pass.txt
7 changes: 7 additions & 0 deletions script/grip.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash
# -*- coding: utf-8 -*-

# shellcheck source=/dev/null
[ -r "script/bootstrap.sh" ] && source "script/bootstrap.sh"

grip --pass "${GITHUB_API_TOKEN}" "${GRIP_PORT}"
8 changes: 8 additions & 0 deletions script/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
# -*- coding: utf-8 -*-

# shellcheck source=/dev/null
[ -r "script/bootstrap.sh" ] && source "script/bootstrap.sh"

pyenv activate "${PYENV_NAME}" >> /dev/null 2>&1 || echo 'Oh Yeah!!'
pip install -r "${REQUIREMENTS_DIR}/dev.txt"
6 changes: 6 additions & 0 deletions script/linguist.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash
# -*- coding: utf-8 -*-

[ -r "script/bootstrap.sh" ] && source "script/bootstrap.sh"

bundle exec linguist --breakdown
8 changes: 8 additions & 0 deletions script/lintcode.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
# -*- coding: utf-8 -*-

# shellcheck source=/dev/null
[ -r "script/bootstrap.sh" ] && source "script/bootstrap.sh"

pre-commit install -f --install-hooks
pre-commit run --all-files
15 changes: 15 additions & 0 deletions script/pyenv.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash
# -*- coding: utf-8 -*-

# shellcheck source=/dev/null
[ -r "script/bootstrap.sh" ] && source "script/bootstrap.sh"

# load source files externals
if [ -e "$HOME/.pyenv" ]; then
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
fi

cd "${ROOT_DIR}" || exit

pyenv virtualenv "${PYTHON_VERSION}" "${PYENV_NAME}" >> /dev/null 2>&1 || echo 'Oh Yeah!!'
8 changes: 8 additions & 0 deletions script/roles_ansible.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
# -*- coding: utf-8 -*-

# shellcheck source=/dev/null
[ -r "script/bootstrap.sh" ] && source "script/bootstrap.sh"

ansible-galaxy install -r requirements.yml \
--roles-path "${PROVISION_DIR}"/roles/contrib --force
4 changes: 4 additions & 0 deletions script/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env bash
# -*- coding: utf-8 -*-

[ -r "script/bootstrap.sh" ] && source "script/bootstrap.sh"
5 changes: 5 additions & 0 deletions script/sync.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash
# -*- coding: utf-8 -*-

# shellcheck source=/dev/null
[ -r "script/bootstrap.sh" ] && source "script/bootstrap.sh"
8 changes: 8 additions & 0 deletions script/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
# -*- coding: utf-8 -*-

# shellcheck source=/dev/null
[ -r "script/bootstrap.sh" ] && source "script/bootstrap.sh"

ansible-playbook tests/test.yaml -i tests/inventory --syntax-check
ansible-playbook -i tests/inventory tests/test.yaml --connection=local
7 changes: 7 additions & 0 deletions script/watch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash
# -*- coding: utf-8 -*-

# shellcheck source=/dev/null
[ -r "script/bootstrap.sh" ] && source "script/bootstrap.sh"

cd "${SOURCE_DIR}" || exit

0 comments on commit e664f73

Please sign in to comment.