Metadata-Version: 2.1
Name: runif
Version: 0.0.2
Summary: Idempotent and minimal python library for rapid scripting.
Home-page: https://gioorgi.com/2020/runif/
Author: Giovanni Giorgi
Author-email: jj@gioorgi.com
Maintainer: Giovanni Giorgi
Maintainer-email: jj@gioorgi.com
License: BSD-3-Clause
Project-URL: Documentation, https://github.com/daitangio/runif
Project-URL: Code, https://github.com/daitangio/runif
Project-URL: Issue tracker, https://github.com/daitangio/runif/issues
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Requires-Python: >=3.6

.. contents::
   :depth: 3
..

Runif
=====

Idempotent and *minimal* python 3 library for rapid scripting. Provide
support for creating file, adding data to them, patching and so on.

Why?
====

(Ba)sh scripting is very easy to setup. So we end up using it all the
time for simple procedural script.

Sometimes is it useful to have idempotent script, like Ansible and
Saltstack teach use, this script should only do an action if needed.

I have this need for a complex set of migration procedures. I was unable
to do it bash It was an overkilll using Java

So runif popped out

Try the examples running them from the root directory

The run() function is very handy to fire direct command, like you would
do in a bash script, like running git pull or so on

Note: runif it is NOT a replacement for Gradle, GNU Make, Maven, etc.

Launch example
==============

Install the package with > python setup.py install

Here an example of what happen if you run twice the *same* script:

::

   $  python examples/stepByStep.py
   [INFO] runif.py.run_if_missed demo ===> step1
   [INFO] runif.py.run_if_missed demo/demofile.txt ===> step2
   [INFO] runif.py.run_if_missed demo/demofile2.c ===> step2
   [INFO] runif.py.run_if_unmarked demo/demofile.txt ===> Step3
   [INFO] runif.py.run_if_present demo/demofile.txt ===> <lambda>
   demo/demofile.txt present!
   [INFO] runif.py.run_each demo\demofile2.c ===> <lambda>
   ** demo\demofile2.c

   $  python examples/stepByStep.py
   [INFO] runif.py.run_if_present demo/demofile.txt ===> <lambda>
   demo/demofile.txt present!
   [INFO] runif.py.run_each demo\demofile2.c ===> <lambda>
   ** demo\demofile2.c

Unstable interfaces / Dev notes
===============================

::

   run_each               is still unstable
   run_if_modified        is brand new and not tested on a huge set of test cases. it is NOT thread safe

See ./CHANGELOG.md for the last modification

Tests
=====

Install py.test with

::

   pip install pytest

run with PYTHONPATH=. pytest

The PYTHONPATH variable is used to ensure you are using the current
version and not another possibly installed one on your env

See https://docs.pytest.org/en/latest/example/index.html for usage
examples

RELEASE HISTORY
===============

v0.0.1 - May 2020 First public release


