Dealer -- SCM (Git, Mercurial) watcher
Project description
Dealer
######
Dealer — SCM_ revision helper in your projects. Just add SCM_ revision to
your static paths and get automatic control at client browser caches:
Somewhere in templates: ::
<script src='/main.js?{{ request.revision }}'
On clientside: ::
<script src='/main.js?34jhfd45hd8'
Supported Git_, Mercurial_ and simple revision parse by file.
.. note:: For Mercurial support install mercurial
.. image:: https://secure.travis-ci.org/klen/dealer.png?branch=develop
:target: http://travis-ci.org/klen/dealer
:alt: Build Status
.. contents::
Requirements
=============
- python >= 2.6
Installation
=============
**Dealer** should be installed using pip: ::
pip install dealer
Usage
=====
Basic usage
-----------
::
from dealer.git import git
print git.revision
::
# Auto parse repository type
from dealer.auto import auto
print auto.revision
Manualy create backend
----------------------
**path** — path to SCM_ repository (current dir by default)
::
from dealer.mercurial import Backend
hg = Backend('/path/to/hg/repo')
Django support
--------------
Settings
^^^^^^^^
*DEALER_TYPE* — Type of SCM_ repository ('auto', 'git', 'mercurial', 'simple'). By default 'auto'
*DEALER_PATH* — Path to SCM_. By default current dir
Context-processor
^^^^^^^^^^^^^^^^^
Append to your settings: ::
TEMPLATE_CONTEXT_PROCESSORS += 'dealer.contrib.django.staff.context_processor',
And use *REVISION* variable in your templates: ::
<link href="/test.css?{{ REVISION }}" rel="stylesheet" type="text/css" media="screen" />
<script src="/test.js?{{ REVISION }}"></script>
Middleware
^^^^^^^^^^
Append to your settings: ::
MIDDLEWARE_CLASSES += 'dealer.contrib.django.staff.middleware',
And use in your views: ::
def view(request):
return request.revision
Or in your templates by `request.revision` var.
Bug tracker
===========
If you have any suggestions, bug reports or
annoyances please report them to the issue tracker
at https://github.com/klen/Dealer/issues
Contributing
============
Development of dealer happens at github: https://github.com/klen/Flask-Mixer
Contributors
=============
* klen_ (Kirill Klenov)
License
=======
Licensed under a `BSD license`_.
.. _BSD license: http://www.linfo.org/bsdlicense.html
.. _klen: http://klen.github.com/
.. _SCM: http://en.wikipedia.org/wiki/Source_Control_Management
.. _Git: http://en.wikipedia.org/wiki/Git_(oftware)
.. _Mercurial: http://en.wikipedia.org/wiki/Mercurial
######
Dealer — SCM_ revision helper in your projects. Just add SCM_ revision to
your static paths and get automatic control at client browser caches:
Somewhere in templates: ::
<script src='/main.js?{{ request.revision }}'
On clientside: ::
<script src='/main.js?34jhfd45hd8'
Supported Git_, Mercurial_ and simple revision parse by file.
.. note:: For Mercurial support install mercurial
.. image:: https://secure.travis-ci.org/klen/dealer.png?branch=develop
:target: http://travis-ci.org/klen/dealer
:alt: Build Status
.. contents::
Requirements
=============
- python >= 2.6
Installation
=============
**Dealer** should be installed using pip: ::
pip install dealer
Usage
=====
Basic usage
-----------
::
from dealer.git import git
print git.revision
::
# Auto parse repository type
from dealer.auto import auto
print auto.revision
Manualy create backend
----------------------
**path** — path to SCM_ repository (current dir by default)
::
from dealer.mercurial import Backend
hg = Backend('/path/to/hg/repo')
Django support
--------------
Settings
^^^^^^^^
*DEALER_TYPE* — Type of SCM_ repository ('auto', 'git', 'mercurial', 'simple'). By default 'auto'
*DEALER_PATH* — Path to SCM_. By default current dir
Context-processor
^^^^^^^^^^^^^^^^^
Append to your settings: ::
TEMPLATE_CONTEXT_PROCESSORS += 'dealer.contrib.django.staff.context_processor',
And use *REVISION* variable in your templates: ::
<link href="/test.css?{{ REVISION }}" rel="stylesheet" type="text/css" media="screen" />
<script src="/test.js?{{ REVISION }}"></script>
Middleware
^^^^^^^^^^
Append to your settings: ::
MIDDLEWARE_CLASSES += 'dealer.contrib.django.staff.middleware',
And use in your views: ::
def view(request):
return request.revision
Or in your templates by `request.revision` var.
Bug tracker
===========
If you have any suggestions, bug reports or
annoyances please report them to the issue tracker
at https://github.com/klen/Dealer/issues
Contributing
============
Development of dealer happens at github: https://github.com/klen/Flask-Mixer
Contributors
=============
* klen_ (Kirill Klenov)
License
=======
Licensed under a `BSD license`_.
.. _BSD license: http://www.linfo.org/bsdlicense.html
.. _klen: http://klen.github.com/
.. _SCM: http://en.wikipedia.org/wiki/Source_Control_Management
.. _Git: http://en.wikipedia.org/wiki/Git_(oftware)
.. _Mercurial: http://en.wikipedia.org/wiki/Mercurial
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
dealer-0.1.6.tar.gz
(5.4 kB
view details)
File details
Details for the file dealer-0.1.6.tar.gz
.
File metadata
- Download URL: dealer-0.1.6.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4fed01cf5a81a6ff3c2e94848b92a86ab0f21af4ee0421c72a4a7af98e46adf9 |
|
MD5 | d027e567a0b04683519385c6b9900074 |
|
BLAKE2b-256 | 07ee704626653719c7fa248c14bcd6ac8aa2fee05670f4219ac020a5c5fdf88a |