-
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
1 parent
4188bfd
commit 6b237df
Showing
6 changed files
with
71 additions
and
14 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 |
---|---|---|
@@ -1,8 +1,7 @@ | ||
- id: django-migrate | ||
name: django-migrate | ||
name: django migrate | ||
description: Check a django app for missing migrations | ||
entry: hook/django_migrate.sh | ||
language: script | ||
types: [shell] | ||
entry: django-migrate | ||
language: python | ||
always_run: true | ||
verbose: true |
This file was deleted.
Oops, something went wrong.
Empty file.
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,17 @@ | ||
import subprocess | ||
import os | ||
from pathlib import Path | ||
|
||
def main(): | ||
exitcode = 0 | ||
cp = subprocess.run( | ||
["python", "manage.py", "makemigrations", "--dry-run", "/dev/null"], | ||
capture_output=True | ||
) | ||
if cp.stdout: | ||
if not cp.stdout.__contains__("No changes detected"): | ||
exitcode = 1 | ||
return exitcode | ||
|
||
if __name__ == "__main__": | ||
exit(main()) |
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,26 @@ | ||
[metadata] | ||
name = hooks | ||
version = 0.0.1 | ||
description = Checks for missing django migrations | ||
license = MIT | ||
license_file = LICENSE | ||
classifiers = | ||
License :: OSI Approved :: MIT License | ||
Programming Language :: Python :: 3 | ||
Programming Language :: Python :: 3 :: Only | ||
Programming Language :: Python :: 3.6 | ||
Programming Language :: Python :: 3.7 | ||
Programming Language :: Python :: 3.8 | ||
Programming Language :: Python :: Implementation :: CPython | ||
Programming Language :: Python :: Implementation :: PyPy | ||
|
||
[options] | ||
packages = find: | ||
python_requires = >=3.6.1 | ||
|
||
[options.entry_points] | ||
console_scripts = | ||
django-migrate = hooks.django_migrate:main | ||
|
||
[bdist_wheel] | ||
universal = True |
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 @@ | ||
# Always prefer setuptools over distutils | ||
from setuptools import setup | ||
setup() | ||
# from setuptools import setup, find_packages | ||
|
||
|
||
# setup( | ||
# name='django-migrations', | ||
# version='0.0.1', | ||
# packages=find_packages(), | ||
# entry_points = { | ||
# 'console_scripts': ['django_migrate=django_migrate:check_migrations'], | ||
# }, | ||
# url='https://github.com/caktus/django-migrations', | ||
# author='Caktus Group', | ||
# author_email='', | ||
# description='A pre-commit hook to check a django app for migrations', | ||
# python_requires='>=3.5', | ||
# classifiers=[ | ||
# 'Intended Audience :: Developers', | ||
# 'Topic :: Software Development :: Build Tools', | ||
# 'License :: OSI Approved :: BSD License', | ||
# 'Programming Language :: Python :: 3', | ||
# ] | ||
# ) |