{ "info": { "author": "Valeriy Manenkov", "author_email": "v.manenkov@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Environment :: Console", "License :: OSI Approved :: MIT License", "Programming Language :: Python", "Programming Language :: Python :: 3" ], "description": "wa\r\n==\r\n\r\n.. image:: https://badge.fury.io/py/wa.svg\r\n :target: https://pypi.python.org/pypi/wa\r\n\r\n**wa is a prototype and development is not planned. This version is likely to contain errors. It is recommended to use Python 3.x, work in Python 2 not tested.**\r\n\r\nwa (workflow automation) \u2014 simple cross-platform tool created to automate routine tasks in the development process. For example, it can be used to quickly create a skeleton project from a previously created template or perform complex tasks in a single command.\r\n\r\nThe goal of wa is to allow us to share best practice in software development and simplify the reuse of code in their software projects. The manifest file in YAML format contains the commands and corresponding actions, and preparation of the source code files are stored as templates. The manifest and templates can be distributed along the source code of your project.\r\n\r\n.. contents:: Conents\r\n :depth: 3\r\n\r\nInstallation\r\n------------\r\nUsing pip\r\n\r\n.. code-block:: bash\r\n \r\n pip install wa\r\n\r\nUsing easy_nstall\r\n\r\n.. code-block:: bash\r\n \r\n easy_install wa\r\n\r\nfrom source code\r\n\r\n.. code-block:: bash\r\n \r\n git clone https://github.com/char16t/wa.git\r\n cd wa\r\n make install\r\n\r\nQuick start\r\n-------------\r\nwa may be called from console\r\n\r\n.. code-block:: bash\r\n \r\n wa\r\n wa: workflow automation tool\r\n \r\nwa takes as command arguments, which are mapped to actions. Describing one command :code:`startproject` you can call it as follows:\r\n\r\n.. code-block:: bash\r\n \r\n wa startproject\r\n\r\nCommands unlimited nesting are supported. You can also describe the commands :code:`python startproject`, :code:`startproject cpp` or :code:`startproject cpplib`. You can call them so:\r\n\r\n.. code-block:: bash\r\n \r\n wa startproject python\r\n wa startproject cpp\r\n \r\nThe commands are described in the files :code:`.wa` in YAML format. For the examples above it might look like this:\r\n\r\n.. code-block:: yaml\r\n\r\n startproject:\r\n python:\r\n - input PROJECTNAME\r\n - mkdir ${PROJECTNAME}\r\n - mkdir ${PROJECTNAME}/tests ${PROJECTNAME}/${PROJECTNAME}\r\n - touch ${PROJECTNAME}/tests/__init__.py\r\n - touch ${PROJECTNAME}/${PROJECTNAME}/__init__.py\r\n cpp:\r\n - input PROJECTNAME\r\n - mkdir ${PROJECTNAME}\r\n - mkdir ${PROJECTNAME}/src ${PROJECTNAME}/tests ${PROJECTNAME}/include\r\n - touch ${PROJECTNAME}/CMakeLists.txt\r\n - touch ${PROJECTNAME}/src/${PROJECTNAME}.cpp\r\n - touch ${PROJECTNAME}/include/${PROJECTNAME}.hpp\r\n cpplib:\r\n - cp /home/user/mypath/templates/cpplib .\r\n\r\nThe file :code:`.wa` can be located in the root of your project and in your home directory. wa will first try to do a search of the requested command in the root of your project, and then, if the command is not found, will return to the file :code:`.wa` in your home directory and looks for there. That is, by creating the file :code:`.wa` as in the above example in your home directory, you will be able to perform\r\n\r\n.. code-block:: bash\r\n \r\n $ wa startproject python\r\n\r\nYou are prompted to enter a value for the variable :code:`PROJECTNAME`\r\n \r\n.. code-block:: bash\r\n \r\n $ wa startproject python\r\n $ PROJECTNAME=_\r\n\r\nLet it be :code:`helloworld`:\r\n\r\n.. code-block:: bash\r\n \r\n $ wa startproject python\r\n $ PROJECTNAME=helloworld\r\n\r\nand deploy the skeleton of a Python project :code:`helloworld` in any directory. Please note that in the current directory, perhaps it should also create an empty file :code:`.wa`. It will be a signal to wa that it is the root of the project. Now, if you go in a subdirectory of the current directory and attempt to execute an arbitrary command, the search will be done first in that file that is one level higher in the directory tree.\r\n\r\nwa does exactly that: search a file in the current directory first, then in the directory above and so on until the root file system. If the file is :code:`.wa` was not found, the search will continue in your home directory.\r\n\r\nIn the file :code:`.wa` lying at the root of your project you can override any command (for example, :code:`python startproject` from the listings above). That is, you can redistribute it and :code:`.wa`-file along with the code of your project and to help other developers, for example, to quickly create the skeleton of the class, formatted according to the standards of the project.\r\n\r\nwa also allows you to work with files and directories relative to the root of your project. By specifying a vertical line before the path to the file or directory\r\n\r\n.. code-block:: yaml\r\n \r\n newclass:\r\n - input CLASSNAME\r\n - cp |.code_templates/class.cpp |src/${CLASSNAME}.cpp\r\n - cp |.code_templates/header.cpp |include/${CLASSNAME}.hpp\r\n \r\n\r\nIn the execution of the above example copies the file :code:`.code_templates/class.cpp` and :code:`.code_templates/header.hpp` with the specified name in the directory :code:`src` and :code:`include`, respectively. The main thing here is that you can be in any directory of your project, but a copy will be made relative to the root project, because it is explicitly specified with a vertical bar :code:`|`.\r\n\r\nIn the example below, a vertical bar at the beginning of the second there are no arguments\r\n\r\n.. code-block:: yaml\r\n \r\n newclass:\r\n - input CLASSNAME\r\n - cp |.code_templates/class.cpp ${CLASSNAME}.cpp\r\n - cp |.code_templates/header.cpp ${CLASSNAME}.hpp\r\n\r\nWhen running this example will copy all the files with the specified names in the current directory. For example, if you are in the directory :code:`my_great_cpp_app/legacy`, the files will be copied into it, and if you're in :code:`my_great_cpp_app/legacy/tests` on it.\r\n\r\nA vertical bar at the beginning of the paths to files and folders can be used in any commands.\r\n\r\n\r\nThe available commands (API)\r\n----------------------------\r\n\r\nYou can use the following commands. For each command an example of using.\r\n\r\nset\r\n~~~\r\n:code:`set ` sets the value for the variable. After that, in any commands, you can use a variable like :code:`${variable}`. The variable names are defined case-sensitive.\r\n\r\n.. code-block:: yaml\r\n \r\n create_file_and_directory:\r\n - set PREFIX mysuperpupuer\r\n - touch ${PREFIX}_file.txt\r\n - mkdir ${PREFIX}_dir\r\n\r\ninput\r\n~~~~~\r\n:code:`input ` requests for input from the user variable\r\n\r\n.. code-block:: yaml\r\n \r\n startproject:\r\n - input PROJECTNAME\r\n - mkdir ${PROJECTNAME}\r\n - touch ${PROJECTNAME}/README.txt\r\n\r\ncd\r\n~~\r\n:code:`cd ` goes to the specified path.\r\n\r\n.. code-block:: yaml\r\n \r\n startproject:\r\n - input PROJECTNAME\r\n - mkdir ${PROJECTNAME}\r\n - cd ${PROJECTNAME}\r\n - touch README.txt\r\n\r\nmkdir\r\n~~~~~\r\n:code:`mkdir [ []]` creates dirs with the specified names.\r\n\r\n.. code-block:: yaml\r\n \r\n mkdirs:\r\n - mkdir one two three/four\r\n\r\ntouch\r\n~~~~~\r\n:code:`touch [ []]` creates files with the specified names\r\n\r\n.. code-block:: yaml\r\n \r\n touchs:\r\n - touch one two three/four\r\n\r\nrm\r\n~~\r\n:code:`rm [ []]` removes files and folders with the specified names.\r\n\r\n.. code-block:: yaml\r\n \r\n clean:\r\n - rm build\r\n - rm dist\r\n\r\ncp\r\n~~\r\n:code:`cp >` copies from source to target.\r\n\r\n.. code-block:: yaml\r\n \r\n license:\r\n - input LICENSE_NAME\r\n - cp /home/user/templates/${LICENSE_NAME}.template |LICENSE\r\n\r\ncptpl\r\n~~~~~\r\n:code:`cptpl ` copies from source to target with replacement :code:`[[variable]]` on the value of the variable in file names and folders and :code:`<<>>` the value of the variable in the contents of the files.\r\n\r\n.. code-block:: yaml\r\n \r\n license:\r\n - input PROJECT_NAME PROJECT_DESCRIPTION PROJECT_LICENSE\r\n - cptpl /home/user/templates/cpp_lib |.\r\n\r\nThe first argument specifies the folder that contains the template, and the second argument the path where the template will be copied. For example, for the Python project template might look like this: create directory :code:`/home/user/templates/python` with the following content\r\n\r\n.. code-block::\r\n \r\n [[PROJECT_NAME]]\r\n __init__.py\r\n [[PRPJECT_NAME]].py\r\n tests\r\n __init__.py\r\n\r\nInsert to file :code:`[[PRPJECT_NAME]].py` this content:\r\n\r\n.. code-block::\r\n \r\n # This file is a part of <<>>\r\n # Licensed under MIT. See LICENSE file for details\r\n # (c) 2015 <<>> <<<>>>\r\n \r\n def main():\r\n pass\r\n \r\n if __name__ == \"__main__\":\r\n main()\r\n\r\nNow when you call wa will be prompted to enter the values of the variables, and then the template will be copied. It looks like :code:`.wa`-file\r\n\r\n.. code-block:: yaml\r\n \r\n pyscaffold:\r\n - cptpl /home/user/templates/python |.\r\n\r\n\r\nPlease note that in the example above are not required to ask the user to input the required variables. The prompt will happen automatically as soon as encountered unknown variable.\r\n\r\nNow you need to run in console\r\n\r\n.. code-block:: bash\r\n\r\n $ wa pyscaffold\r\n $ PROJECT_NAME=helloworld\r\n $ PROJECT_AUTHOR=Foo Bar\r\n $ AUTHOR_EMAIL=foo@bar.com\r\n\r\nAs a result, it will create the following directory structure\r\n\r\n.. code-block::\r\n \r\n helloworld\r\n __init__.py\r\n helloworld.py\r\n tests\r\n __init__.py\r\n\r\nAnd the file :code:`helloworld/helloworld.py` will have the following content\r\n\r\n.. code-block::\r\n \r\n # This file is a part of helloworld\r\n # Licensed under MIT. See LICENSE file for details\r\n # (c) 2015 Foo Bar \r\n \r\n def main():\r\n pass\r\n \r\n if __name__ == \"__main__\":\r\n main()\r\n\r\ncptpljinja2\r\n~~~~~~~~~~~\r\n:code:`cptpljinja2 >` copy from source to target with replacement :code:`[[variable]]` on the value of the variable in file names and folders and compiles content from Jinja2 templates that are in the source files.\r\n\r\n.. code-block:: yaml\r\n \r\n license:\r\n - input PROJECT_NAME PROJECT_DESCRIPTION PROJECT_LICENSE\r\n - cptpljinja2 /home/user/templates/cpp_lib |.\r\n\r\nmv\r\n~~\r\n:code:`mv ` moves the files and folders from source to destination..\r\n\r\n.. code-block:: yaml\r\n \r\n to_legacy:\r\n - input CLASS\r\n - mv |src/${CLASS}.cpp |legacy/src/${CLASS}.cpp\r\n - mv |include/${CLASS}.hpp |legacy/include/${CLASS}.hpp\r\n\r\necho\r\n~~~~\r\n:code:`echo ` displays a message on the screen.\r\n\r\n.. code-block:: yaml\r\n \r\n copy_large_file:\r\n - cp /home/12Gb.raw |.\r\n - echo Ok, copied\r\n\r\nexec\r\n~~~~\r\n:code:`exec ` executes the command on the command line of the operating system.\r\n\r\n.. code-block:: yaml\r\n \r\n test:\r\n - cd |.\r\n - exec make test\r\n\r\npy\r\n~~\r\n:code:`py ` execute function from file in Python interpreter.\r\n\r\n.. code-block:: yaml\r\n \r\n test:\r\n - cd |.\r\n - py runtests.py main\r\n\r\n\r\nIssues\r\n------\r\nAbout any errors, problems, any questions or with any suggestions you can write to v.manenkov (at) gmail.com or create a issue in Github Issues https://github.com/char16t/wa/issues\r\n\r\nLicense\r\n-------\r\nSource code licensed under MIT. \u0422\u0435\u043a\u0441\u0442 \u043b\u0438\u0446\u0435\u043d\u0437\u0438\u0438 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u0444\u0430\u0439\u043b\u0435 LICENSE. The license text is in the LICENSE file.", "description_content_type": null, "docs_url": null, "download_url": "https://github.com/char16t/wa/archive/master.tar.gz", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/char16t/wa", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "wa", "package_url": "https://pypi.org/project/wa/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/wa/", "project_urls": { "Download": "https://github.com/char16t/wa/archive/master.tar.gz", "Homepage": "https://github.com/char16t/wa" }, "release_url": "https://pypi.org/project/wa/0.1.0/", "requires_dist": null, "requires_python": null, "summary": "Workflow automation tool", "version": "0.1.0" }, "last_serial": 1760535, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "5363f395eb2e2a52c604ace37ef33133", "sha256": "5133e38cb1dca5be9a22c60f97c84265250b068f3f54cff0109c9fe16b25aaad" }, "downloads": -1, "filename": "wa-0.1.0.tar.gz", "has_sig": false, "md5_digest": "5363f395eb2e2a52c604ace37ef33133", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11285, "upload_time": "2015-10-03T15:13:19", "url": "https://files.pythonhosted.org/packages/05/1d/ce6b8ca3239ce1e3e5cc645cc4e0de786be5fce0a9b7935eedca8eadfd2c/wa-0.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "5363f395eb2e2a52c604ace37ef33133", "sha256": "5133e38cb1dca5be9a22c60f97c84265250b068f3f54cff0109c9fe16b25aaad" }, "downloads": -1, "filename": "wa-0.1.0.tar.gz", "has_sig": false, "md5_digest": "5363f395eb2e2a52c604ace37ef33133", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11285, "upload_time": "2015-10-03T15:13:19", "url": "https://files.pythonhosted.org/packages/05/1d/ce6b8ca3239ce1e3e5cc645cc4e0de786be5fce0a9b7935eedca8eadfd2c/wa-0.1.0.tar.gz" } ] }