Skip to content

Commit

Permalink
refractor
Browse files Browse the repository at this point in the history
  • Loading branch information
bitranox committed Aug 15, 2020
1 parent adc2074 commit 58416b9
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 33 deletions.
2 changes: 1 addition & 1 deletion .docs/README_template.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ igittigitt
==========


Version v1.0.6 as of 2020-08-15 see `Changelog`_
Version v2.0.0 as of 2020-08-15 see `Changelog`_


.. include:: ./badges.rst
Expand Down
22 changes: 10 additions & 12 deletions .docs/description.rst
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
A spec-compliant gitignore parser for Python

forked from https://github.com/mherrmann/gitignore_parser we might join later ....


Suppose `/home/michael/project/.gitignore` contains the following:
Suppose `/home/bitranox/project/.gitignore` contains the following:

.. code-block:: python
# /home/michael/project/.gitignore
# /home/bitranox/project/.gitignore
__pycache__/
*.py[cod]
Expand All @@ -19,14 +16,14 @@ Then:
>>> import igittigitt
>>> parser = igittigitt.IgnoreParser()
>>> parser.parse_rule_file(pathlib.Path('/home/michael/project/.gitignore'))
>>> parser.match(pathlib.Path('/home/michael/project/main.py'))
>>> parser.parse_rule_file(pathlib.Path('/home/bitranox/project/.gitignore'))
>>> parser.match(pathlib.Path('/home/bitranox/project/main.py'))
False
>>> parser.match(pathlib.Path('/home/michael/project/main.pyc'))
>>> parser.match(pathlib.Path('/home/bitranox/project/main.pyc'))
True
>>> parser.match(pathlib.Path('/home/michael/project/dir/main.pyc'))
>>> parser.match(pathlib.Path('/home/bitranox/project/dir/main.pyc'))
True
>>> parser.match(pathlib.Path('/home/michael/project/__pycache__'))
>>> parser.match(pathlib.Path('/home/bitranox/project/__pycache__'))
True
Expand All @@ -36,8 +33,9 @@ I couldn't find a good library for doing the above on PyPI. There are
several other libraries, but they don't seem to support all features,
be it the square brackets in `*.py[cod]` or top-level paths `/...`.

forked from https://github.com/mherrmann/gitignore_parser because I
need to move on faster ... we might join the projects again after stabilisation
inspired by https://github.com/mherrmann/gitignore_parser but in fact I needed to
throw away almost everything, because of serious matching bugs and unmaintainable spaghetti code.


igittigitt
----------
Expand Down
9 changes: 9 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@ TODO:
- add nested .gitignore files
- documentation

v2.0.0
--------
2020-08-14:
- complete redesign
- get rid of regexp matching
- more tests
- now correct matching in subdirs, directory names,
filenames, etc ...

v1.0.6
--------
2020-08-14:
Expand Down
35 changes: 21 additions & 14 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ igittigitt
==========


Version v1.0.6 as of 2020-08-15 see `Changelog`_
Version v2.0.0 as of 2020-08-15 see `Changelog`_

|travis_build| |license| |jupyter| |pypi| |black|

Expand Down Expand Up @@ -48,14 +48,11 @@ Version v1.0.6 as of 2020-08-15 see `Changelog`_

A spec-compliant gitignore parser for Python

forked from https://github.com/mherrmann/gitignore_parser we might join later ....


Suppose `/home/michael/project/.gitignore` contains the following:
Suppose `/home/bitranox/project/.gitignore` contains the following:

.. code-block:: python
# /home/michael/project/.gitignore
# /home/bitranox/project/.gitignore
__pycache__/
*.py[cod]
Expand All @@ -67,14 +64,14 @@ Then:
>>> import igittigitt
>>> parser = igittigitt.IgnoreParser()
>>> parser.parse_rule_file(pathlib.Path('/home/michael/project/.gitignore'))
>>> parser.match(pathlib.Path('/home/michael/project/main.py'))
>>> parser.parse_rule_file(pathlib.Path('/home/bitranox/project/.gitignore'))
>>> parser.match(pathlib.Path('/home/bitranox/project/main.py'))
False
>>> parser.match(pathlib.Path('/home/michael/project/main.pyc'))
>>> parser.match(pathlib.Path('/home/bitranox/project/main.pyc'))
True
>>> parser.match(pathlib.Path('/home/michael/project/dir/main.pyc'))
>>> parser.match(pathlib.Path('/home/bitranox/project/dir/main.pyc'))
True
>>> parser.match(pathlib.Path('/home/michael/project/__pycache__'))
>>> parser.match(pathlib.Path('/home/bitranox/project/__pycache__'))
True
Expand All @@ -84,8 +81,9 @@ I couldn't find a good library for doing the above on PyPI. There are
several other libraries, but they don't seem to support all features,
be it the square brackets in `*.py[cod]` or top-level paths `/...`.

forked from https://github.com/mherrmann/gitignore_parser because I
need to move on faster ... we might join the projects again after stabilisation
inspired by https://github.com/mherrmann/gitignore_parser but in fact I needed to
throw away almost everything, because of serious matching bugs and unmaintainable spaghetti code.


igittigitt
----------
Expand Down Expand Up @@ -207,7 +205,7 @@ Usage
.. code-block:: python
>>> parser = igittigitt.IgnoreParser()
>>> parser.add_rule('*.py[cod]', base_path='/home/michael')
>>> parser.add_rule('*.py[cod]', base_path='/home/bitranox')
--------------------------------

Expand Down Expand Up @@ -369,6 +367,15 @@ TODO:
- add nested .gitignore files
- documentation

v2.0.0
--------
2020-08-14:
- complete redesign
- get rid of regexp matching
- more tests
- now correct matching in subdirs, directory names,
filenames, etc ...

v1.0.6
--------
2020-08-14:
Expand Down
4 changes: 2 additions & 2 deletions igittigitt/__init__conf__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "igittigitt"
title = "A spec-compliant gitignore parser for Python"
version = "v1.0.6"
version = "v2.0.0"
url = "https://github.com/bitranox/igittigitt"
author = "Robert Nowotny"
author_email = "[email protected]"
Expand All @@ -15,7 +15,7 @@ def print_info() -> None:
A spec-compliant gitignore parser for Python
Version : v1.0.6
Version : v2.0.0
Url : https://github.com/bitranox/igittigitt
Author : Robert Nowotny
Email : [email protected]"""
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def get_line_data(line: str) -> str:

setup_kwargs: Dict[str, Any] = dict()
setup_kwargs["name"] = "igittigitt"
setup_kwargs["version"] = "v1.0.6"
setup_kwargs["version"] = "v2.0.0"
setup_kwargs["url"] = "https://github.com/bitranox/igittigitt"
setup_kwargs["packages"] = find_packages()
setup_kwargs["package_data"] = {"igittigitt": ["py.typed", "*.pyi", "__init__.pyi"]}
Expand Down
6 changes: 3 additions & 3 deletions tests/test_pytest.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
@pytest.fixture(scope="function")
def base_path():
if platform.system() == "Windows":
return pathlib.Path("C:/Users/michael").resolve()
return pathlib.Path("C:/Users/bitranox").resolve()
else:
return pathlib.Path("/home/michael").resolve()
return pathlib.Path("/home/bitranox").resolve()


@pytest.fixture(scope="function")
Expand Down Expand Up @@ -210,7 +210,7 @@ def doctest_examples():
# add_rule_Example{{{
>>> parser = igittigitt.IgnoreParser()
>>> parser.add_rule('*.py[cod]', base_path='/home/michael')
>>> parser.add_rule('*.py[cod]', base_path='/home/bitranox')
# add_rule_Example}}}
Expand Down

0 comments on commit 58416b9

Please sign in to comment.