{ "info": { "author": "Eric Carmichael", "author_email": "eric@ckcollab.com", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "polished\n========\n\n

\n \n \"Polished\n \n

\n\nThe goal of polished is to show the awesome progression and amount of tweaks that go into any website. My resume\nis a good example, dozens of hours of work and tweaking to come up with this pretty basic final product. Showing that\nblood, sweat and hilarious tears in between should be pretty entertaining. Watch pages undulate, stretch, break,\ngrow, and shrink into place.\n\nMore explanation available [on my blog](http://www.ericcarmichael.com/polished.html).\n\n\n\n\n### How does polished work?\n\n1. Fires up selected backend *(for example, PelicanBackend if you use the [Pelican](https://github.com/getpelican/pelican) blog site generator)*\n2. Gets the git revision history\n3. Iterates through that history, prepares the page, screen caps it\n4. Converts images to video\n5. OPTIONALLY: If after reviewing the images/video you find bugs, inherit a backend and `@polish` out the kinks so it's a nice smooth video\n\n\nGetting started\n===============\n\n### Installing\n\n**Requirements**\n\n1. Mac/Linux\n1. NodeJS\n2. PhantomJS\n3. ffmpeg\n\nThen\n\n```\n> pip install polished\n```\n\n\n\n\n### Usage\n\nFor a static website with no .html generation needed and `index.html` is in the same dir:\n\n```\n> polished\n```\n\nFor a static website with `index.html` in another location\n\n```\n> polished \"some/path/to/index.html\"\n```\n\nFor a pelican blog:\n\n```\n> polished \"output/index.html\" --backend polished.backends.pelican.PelicanBackend\n```\n\n\n\n\n### Configuring behavior\n\nThe default backend is `SimpleBackend` which (with no path specified) looks for \"index.html\" in current directory and\nexpects static html without any steps needed to generate the page. This default setup probably doesn't work for most\nprojects.\n\nTo expand the behavior, call `polished my/output/index.html --backend my.backend.Backend`\n\n\n\n\n\n### Basic available backends\n\n**SimpleBackend**\n\nThe most basic backend, assumes no steps are needed to generate HTML.\n\n```python\npolished.backends.simple.SimpleBackend\n```\n\n\n**PelicanBackend**\n\nFor the Pelican blogging system, calls `make html` between screenshots.\n\n```python\npolished.backends.pelican.PelicanBackend\n```\n\n\n**DjangoBackend**\n\nFor the Django framework, calls `python manage.py syncdb --migrate`\n\n```python\npolished.backends.django.DjangoBackend\n```\n\n\n\n\n\n## Custom backend\n\nGenerally, on a simple website these backends will care of you, however you may have to\ninherit them and add custom behavior\n\n```python\nfrom polished.backends import PelicanBackend\n\nclass SomeWeirdBehaviorRequired(PelicanBackend):\n def prepare(self):\n '''\n Prepare your general stuff here! Generate HTML, setup static files, etc.\n '''\n pass\n\n def cleanup(self):\n '''\n Clean up after yourself, delete static files if you need to\n '''\n pass\n```\n\n\n\n\n## Polishing certain commits\n\nUse the `@polish` decorator:\n\n```python\nfrom selenium.webdriver.common.by import By\nfrom selenium.webdriver.support.ui import WebDriverWait\nfrom selenium.webdriver.support import expected_conditions as EC\n\nfrom polished.backends import PelicanBackend\nfrom polished.decorators import polish\n\nclass SomeWeirdBehaviorRequired(PelicanBackend):\n def _patch_image_srcs(self):\n wait = WebDriverWait(self.DRIVER, 10)\n element = wait.until(EC.visibility_of_element_located((By.TAG_NAME, 'img')))\n\n self.DRIVER.execute_script(\"\"\"\n var img_array = document.getElementsByTagName('img');\n\n for(var i=0; i