Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use a Makefile to build and test this project #25

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,56 @@
# ansible module file
library/

# test files
test/ansible/data/kube-manager-test.yaml
test/ansible/data/kube-manager-test.yaml.orig
test/ansible/data/noexist*
test/ansible/data/foo.yml
test/ansible/data/foo.yml.orig

# VIM tmp files
*.swp

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
.hypothesis/

# virtualenv
.venv
venv/
ENV/
22 changes: 22 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
ANSIBLE_MODULE_FILE=library/yedit.py


all: ansible test


test: test-style test-unit test-ansible

test-style:
pylint yedit

test-unit:
PYTHONPATH=. python test/units.py

test-ansible:
ANSIBLE_STDOUT_CALLBACK=actionable ansible-playbook test/ansible/*.yml

ansible:
stickytape yedit/__main__.py > $(ANSIBLE_MODULE_FILE)

clean:
rm -f $(ANSIBLE_MODULE_FILE)
33 changes: 29 additions & 4 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,37 @@ I didn't see a good method of editing yaml files and config managing them throug
== Directory Structure

----
yedit
├── roles Contains the ansible role for lib_yaml_editor
├── test python unit tests for yedit
yedit/
├── yedit/
│  ├── __init__.py
│  ├── __main__.py ansible module
│  ├── yedit.py the actual python code, which does the heavy lifting
├── test/
│   ├── ansible/ integration tests as ansible playbooks
│   └── units.py unit tests for the yedit class
├── library/ target directory for ansible module
----

== Examples:
== Usage

To use this module with ansible create the module file first:

```
$ make ansible
$ file library/yedit.py
library/yedit.py: Python script, ASCII text executable
```

The resulting file can be copied or symlinked into your project.

== Development

1. install dependencies: `pip install -r requirements.txt`
2. make your changes in `yedit/*.py`
3. run `make` to build and test your changes
4. commit them and send us a PR :)

== Examples

Sometimes it is necesarry to config manage .yml files.
[source,yaml]
Expand Down
6 changes: 6 additions & 0 deletions pylintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[MESSAGES CONTROL]
disable=locally-disabled,missing-docstring

[FORMAT]
max-line-length=119

4 changes: 4 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
pyyaml
ansible
stickytape
pylint
17 changes: 0 additions & 17 deletions roles/lib_yaml_editor/build/doc/license

This file was deleted.

124 changes: 0 additions & 124 deletions roles/lib_yaml_editor/build/doc/yedit

This file was deleted.

44 changes: 0 additions & 44 deletions roles/lib_yaml_editor/build/generate.py

This file was deleted.

19 changes: 0 additions & 19 deletions roles/lib_yaml_editor/build/src/base.py

This file was deleted.

13 changes: 0 additions & 13 deletions roles/lib_yaml_editor/build/test/foo.yml

This file was deleted.

4 changes: 0 additions & 4 deletions roles/lib_yaml_editor/build/test/someyaml.yml

This file was deleted.

2 changes: 0 additions & 2 deletions roles/lib_yaml_editor/build/test/test1.yml

This file was deleted.

2 changes: 0 additions & 2 deletions roles/lib_yaml_editor/build/test/test2.yml

This file was deleted.

1 change: 0 additions & 1 deletion roles/lib_yaml_editor/library/.gitignore

This file was deleted.

9 changes: 0 additions & 9 deletions roles/lib_yaml_editor/library/test.py

This file was deleted.

Loading