{ "info": { "author": "Vinco Orbis", "author_email": "pypi@manoderecha.mx", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Console", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Operating System :: OS Independent", "Programming Language :: Python", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Utilities" ], "description": "fabutils\n========\n\nUtilities for creating better fabric tasks.\n\nInstall\n-------\n\n.. code:: bash\n\n $ pip install vo-fabutils\n\nUsage\n-----\n\nImport the proper fabutils modules inside your fabfile an hack a nice\nday.\n\nExamples\n--------\n\nDefine environments in JSON format\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nFirst you must create a JSON file containing your environment\nconfiguration.\n\n.. code:: json\n\n # /path/to/environments/file.json\n {\n \"devel\": {\n \"user\": \"devel-user\",\n \"hosts\": [\"dev.host.com\"],\n \"site_dir\": \"/path/to/devel/site/www/\",\n \"command_prefixes\": [\n \"/path/to/devel/site/env/bin/activate\"\n ]\n },\n \"production\": {\n \"user\": \"prod-user\",\n \"hosts\": [\"host.com\"],\n \"site_dir\": \"/path/to/production/site/www/\",\n \"command_prefixes\": [\n \"/path/to/production/site/env/bin/activate\"\n ]\n }\n }\n\nNote that:\n\n- You can define any arbitrary string as env properties and these will be passed to the task's env.\n- Properties with names \"reserved\" by fabric will be recognized by it and treated with the special meanig that fabric has for them.\n- The only caveat is that if you define an array of ``command_prefixes`` you must only list the path to the script and this will be automatically prepended to with the word 'souce'. For example if you define ``../some_script`` in your command\\_prefixes, it will be tranformed to ``source ../some_script``.\n- Every directory path must end with a trailing slash.\n\nNext, import ``fabutils.env.set_env`` in your fabfile and create a task that calls it with the path to your JSON file.\n\n.. code:: python\n\n # fabfile.py\n from fabric.api import task\n from fabutils.env import set_env\n\n\n @task\n def environment(env_name):\n set_env(env_name, '/path/to/environments/file.json')\n\n| Now you can run tasks in the environment by calling\n ``environment:name`` before\n| your task.\n\n.. code:: bash\n\n # Run a task in devel environment\n $ fab environment:devel some_task\n\n # Run a task in production environment\n $ fab environment:production some_task\n\nArbitrary options and parameters\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n| Some times you just need to pass an unknown number of\n options/arguments to a\n| command, in this case you can use ``join``, ``options`` and\n ``arguments`` utils to\n| translete the pythonic ``*args`` to command arguments and ``**kwargs``\n to\n| command options.\n\n.. code:: python\n\n from fabric.api import task, run\n from fabutils import join, arguments, options\n\n\n @task\n def some_task(*args, **kwargs):\n run(join('some_command', arguments(*args, **kwargs))\n\nAnd then call your task using the fabric's notation\n\n.. code:: bash\n\n $ fab some_task:arg1,arg2,kwarg1=val1,kwarg2=val2\n\n # The above will be translated to:\n # some_command arg1 arg2 kwarg1=val1 kwarg2=val2\n\n| If you pass your ``*kwargs`` to ``options`` the keys that are\n evaluated to a boolean\n| True will be translated to ``--{key}`` notation.\n\n.. code:: python\n\n ...\n\n @task\n def another_task(**kwargs):\n return(join('another_command', options(**kwargs)))\n\n ...\n\n.. code:: bash\n\n $ fab another_task:option1=True,option2=No,option3=1,option4=False\n\n # The above will be translated to:\n # another_command --option1 --option3\n\nOf course, you can combine the two approaches.\n\n.. code:: python\n\n ...\n from fabutils import boolean\n\n @task\n def the_task(*args, **kwargs):\n options = {}\n arguments = {}\n \n for k, v in kwargs:\n if boolean(v):\n options[k] = v\n\n else:\n arguments[k] = v\n\n run(join('the_command', arguments(*args, **arguments), options(**options)))\n\n ...\n\n.. code:: bash\n\n $ fab the_task:arg1,arg2=val2,option1=True\n\n # The above will be translated to:\n # the_command arg1 arg2=val2 --option1", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/vinco/fabutils", "keywords": null, "license": "Apache License (2.0)", "maintainer": null, "maintainer_email": null, "name": "vo-fabutils", "package_url": "https://pypi.org/project/vo-fabutils/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/vo-fabutils/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/vinco/fabutils" }, "release_url": "https://pypi.org/project/vo-fabutils/0.1.4/", "requires_dist": null, "requires_python": null, "summary": "Utilities for creating better fabric tasks.", "version": "0.1.4" }, "last_serial": 1498069, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "b5dc59095e4246260ba2ab3266f0d54e", "sha256": "c6328155405520427faeaf168bc6cbcaedb59f24f4d13276d353dc6f6ccc2fc2" }, "downloads": -1, "filename": "vo-fabutils-0.1.0.tar.gz", "has_sig": false, "md5_digest": "b5dc59095e4246260ba2ab3266f0d54e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5171, "upload_time": "2015-03-04T18:51:27", "url": "https://files.pythonhosted.org/packages/57/cb/e17c87e21945698800ea7e2e72c22dcc38cf1f1952b218bc3d6a7537aec1/vo-fabutils-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "46d4c46a7aa470506d11ca6958967d6e", "sha256": "8819f5e40d1f810942ef0b17ad60a208b2b89c3bcfcde3783cef00412c7fe59b" }, "downloads": -1, "filename": "vo-fabutils-0.1.1.tar.gz", "has_sig": false, "md5_digest": "46d4c46a7aa470506d11ca6958967d6e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5135, "upload_time": "2015-03-09T21:21:54", "url": "https://files.pythonhosted.org/packages/91/59/f53ed3e04462cab7069b3ad0e13eef3038e7393ac073c188b893caa50952/vo-fabutils-0.1.1.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "b3f642fc168801ba3678b07fce5aa044", "sha256": "c9de199fc4eec5dbd63f92dac750586229aad73198ba4980c3eabb4be4ab828d" }, "downloads": -1, "filename": "vo-fabutils-0.1.3.tar.gz", "has_sig": false, "md5_digest": "b3f642fc168801ba3678b07fce5aa044", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5766, "upload_time": "2015-04-01T20:24:57", "url": "https://files.pythonhosted.org/packages/24/4a/8c23811d205632afbf3cc2f4cee43fecfb7a280675d95f595f68097a387a/vo-fabutils-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "4dd20fa6c577c6aed2048e0d99be0244", "sha256": "8a6366ea96db90bcd8fbbb54f636e75ab773ce80c0637bfdaaf397ff1efff0c1" }, "downloads": -1, "filename": "vo-fabutils-0.1.4.tar.gz", "has_sig": false, "md5_digest": "4dd20fa6c577c6aed2048e0d99be0244", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5780, "upload_time": "2015-04-09T19:45:39", "url": "https://files.pythonhosted.org/packages/3a/f0/474389aa09b0e084d9ab85ed3f220002c0b7b4acb96bded777dea6e4d87a/vo-fabutils-0.1.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "4dd20fa6c577c6aed2048e0d99be0244", "sha256": "8a6366ea96db90bcd8fbbb54f636e75ab773ce80c0637bfdaaf397ff1efff0c1" }, "downloads": -1, "filename": "vo-fabutils-0.1.4.tar.gz", "has_sig": false, "md5_digest": "4dd20fa6c577c6aed2048e0d99be0244", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5780, "upload_time": "2015-04-09T19:45:39", "url": "https://files.pythonhosted.org/packages/3a/f0/474389aa09b0e084d9ab85ed3f220002c0b7b4acb96bded777dea6e4d87a/vo-fabutils-0.1.4.tar.gz" } ] }