From 1a375a53598cd0b6e137b35f96c9d344d0ad8765 Mon Sep 17 00:00:00 2001
From: Adar Nimrod <nimrod@shore.co.il>
Date: Tue, 24 Jan 2017 16:12:38 +0200
Subject: [PATCH] - Forked from ansible-pre-commit.

---
 .pre-commit-config.yaml | 16 +---------------
 .travis.yml             |  6 +++++-
 LICENSE.txt             |  2 +-
 README.rst              | 38 ++++++++------------------------------
 VERSION                 |  2 +-
 ansible-syntax-check    |  6 ------
 ansible-vault-check     |  7 -------
 hooks.yaml              | 18 ++++++------------
 requirements.txt        |  3 ---
 setup.py                |  6 +++---
 10 files changed, 25 insertions(+), 79 deletions(-)
 delete mode 100755 ansible-syntax-check
 delete mode 100755 ansible-vault-check
 delete mode 100644 requirements.txt

diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 740fbfa..030b17c 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -4,18 +4,4 @@
     -   id: check-added-large-files
     -   id: check-yaml
     -   id: check-merge-conflict
--   repo: https://www.shore.co.il/git/shell-pre-commit/
-    sha: v0.1.0
-    hooks:
-    -   id: shell-lint
-        files: ansible-syntax-check|ansible-vault-check
--   repo: local
-    hooks:
-    -   id: piprot
-        name: piprot
-        description: Check up-to-date Python requirements
-        language: system
-        entry: piprot
-        args: ['--quiet', '--outdated']
-        files: requirements.txt
-        always_run: true
+    -   id: flake8
diff --git a/.travis.yml b/.travis.yml
index bd44fad..2e3294c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,6 +1,6 @@
 ---
 language: python
-python: "2.7"
+python: ["2.7", "3.3", "3.4", "3.5", "3.6"]
 dist: trusty
 sudo: false
 group: beta
@@ -9,8 +9,12 @@ cache:
   - directories:
       - $HOME/.pre-commit
 
+install:
+  - pip install pre-commit
+
 script:
   - pre-commit run --all-files
+  - pip install .
 
 notifications:
   email: false
diff --git a/LICENSE.txt b/LICENSE.txt
index 26259f8..21f83f9 100644
--- a/LICENSE.txt
+++ b/LICENSE.txt
@@ -1,6 +1,6 @@
 MIT License
 
-Copyright (c) 2016 Adar Nimrod
+Copyright (c) 2017 Adar Nimrod
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
diff --git a/README.rst b/README.rst
index 441f532..8ece22c 100644
--- a/README.rst
+++ b/README.rst
@@ -1,21 +1,12 @@
-Ansible pre-commit hooks
-########################
+Python pre-commit hooks
+#######################
 
-.. image:: https://travis-ci.org/adarnimrod/ansible-pre-commit.svg?branch=master
-    :target: https://travis-ci.org/adarnimrod/ansible-pre-commit
+.. image:: https://travis-ci.org/adarnimrod/python-pre-commit.svg?branch=master
+    :target: https://travis-ci.org/adarnimrod/python-pre-commit
 
 Ansible `pre-commit <http://pre-commit.com/>`_ hooks.
 
-- ansible-syntax-check: The hook runs
-  :code:`ansible --syntax-check` against playbooks declared.
-- ansible-vault-check: The hook verifies that files that have :code:`vault` in
-  the filename are indeed vaulted.
-
-Dependencies
-------------
-
-- Ansible.
-- Pre-commit.
+- :code:`piprot`: Checks your requirements files for out of date packages.
 
 Installation
 ------------
@@ -24,23 +15,10 @@ Add the following to your :code:`.pre-commit-config.yaml`:
 
 .. code:: yaml
 
-    - repo: https://www.shore.co.il/git/ansible-pre-commit/
-      sha: v0.4.0
+    - repo: https://www.shore.co.il/git/python-pre-commit/
+      sha: v0.1.0
       hooks:
-      - id: ansible-syntax-check
-        # In case you want to specify other playbook files:
-        files: playbook.yml
-      - id: ansible-vault-check
-
-And run :code:`pre-commit autoupdate` to update the hooks. In case your
-:code:`roles` directory isn't in the same directory as the playbook you're
-testing or at :code:`/etc/ansible/roles` you need to declare the roles search
-path in :code:`ansible.cfg` in the root of the repo like so:
-
-.. code::
-
-    [defaults]
-    roles_path=path/to/roles/directory:path/to/another/roles/directory
+      - id: piprot
 
 License
 -------
diff --git a/VERSION b/VERSION
index 8f0916f..6e8bf73 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.5.0
+0.1.0
diff --git a/ansible-syntax-check b/ansible-syntax-check
deleted file mode 100755
index e933723..0000000
--- a/ansible-syntax-check
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/sh
-set -eu
-for playbook in $@
-do
-    ansible-playbook --inventory=localhost, --syntax-check "$playbook"
-done
diff --git a/ansible-vault-check b/ansible-vault-check
deleted file mode 100755
index 41aa16c..0000000
--- a/ansible-vault-check
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/sh
-set -eu
-for filename in $@
-do
-    grep -q ANSIBLE_VAULT "$filename" || \
-        (echo "$filename is not vaulted." && exit 1)
-done
diff --git a/hooks.yaml b/hooks.yaml
index 593d42e..84e445f 100644
--- a/hooks.yaml
+++ b/hooks.yaml
@@ -1,14 +1,8 @@
 ---
-- id: ansible-syntax-check
-  name: Syntax check Ansible playbooks
-  description: Check Ansible playbooks for syntax errors.
+- id: piprot
+  name: Check requirements for out of date packages.
+  description: Check requirements for out of date packages.
   language: python
-  entry: ansible-playbook
-  files: playbook.yml
-  args: ['--inventory=localhost,', '--syntax-check']
-- id: ansible-vault-check
-  name: Verify vaulted files
-  description: Verify that Ansible Vault files are vaulted.
-  language: script
-  entry: ansible-vault-check
-  files: vault
+  entry: piprot
+  args: ['--outdated']
+  files: 'requirements.*\.txt$'
diff --git a/requirements.txt b/requirements.txt
deleted file mode 100644
index d700ebe..0000000
--- a/requirements.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-ansible==2.2.1.0
-pre-commit==0.11.0
-piprot==0.9.7
diff --git a/setup.py b/setup.py
index 0e5dcfa..5134384 100644
--- a/setup.py
+++ b/setup.py
@@ -2,7 +2,7 @@ from setuptools import setup
 
 
 setup(
-        name='pre_commit_ansible_dummy_package',
-        version='0.1.0',
-        install_requires=['ansible==2.2.1.0'],
+        name='pre_commit_python_dummy_package',
+        version=open('VERSION', 'r').read().strip(),
+        install_requires=['piprot', 'docutils'],
 )
-- 
GitLab