Skip to content

Commit

Permalink
Merge pull request #18 from crccheck/version
Browse files Browse the repository at this point in the history
Versioning things
  • Loading branch information
crccheck committed Dec 3, 2014
2 parents dbabb3a + d42f1a0 commit d3079a3
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 11 deletions.
23 changes: 19 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
VERSION=0.4.0


help:
@echo "make commands:"
@echo " make help - this help"
@echo " make clean - remove temporary files"
@echo " make test - run test suite"
@echo " make install - install this package"
@echo " make release - prep a release and upload to PyPI"


clean:
find . -name "*.pyc" -delete
find . -name ".DS_Store" -delete
Expand All @@ -14,18 +26,21 @@ test:

# Release Instructions:
#
# 1. bump version number
# 2. `git commit "bump version to v<version>"`
# 3. `git tag v<version>`
# 1. bump version number above
# 4. `make release`
#
# If this doesn't work, make sure you have wheels installed:
# pip install wheel
release:
@sed -i -r /version/s/[0-9.]+/$(VERSION)/ setup.py
@sed -i -r /__version__/s/[0-9.]+/$(VERSION)/ leadbutt.py
@sed -i -r /__version__/s/[0-9.]+/$(VERSION)/ plumbum.py
@git commit -am "bump version to v$(VERSION)"
@git tag v$(VERSION)
python setup.py sdist bdist_wheel upload


# makes it easier to test setup.py's entry points
reinstall:
install:
-pip uninstall cloudwatch-to-graphite --yes
pip install .
5 changes: 4 additions & 1 deletion leadbutt.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
-p INT --period INT Period length, in minutes (default: 1)
-n INT Number of data points to try to get (default: 5)
-v Verbose
--version Show version.
"""
from __future__ import unicode_literals

Expand All @@ -28,6 +29,8 @@
else:
text_type = unicode

__version__ = '0.4.0'


# configuration

Expand Down Expand Up @@ -145,7 +148,7 @@ def leadbutt(config_file, cli_options, verbose=False, **kwargs):


def main(*args, **kwargs):
options = docopt(__doc__)
options = docopt(__doc__, version=__version__)
# help: http://boto.readthedocs.org/en/latest/ref/cloudwatch.html#boto.ec2.cloudwatch.CloudWatchConnection.get_metric_statistics
config_file = options.pop('--config-file')
period = options.pop('--period')
Expand Down
5 changes: 5 additions & 0 deletions plumbum.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
import jinja2


__version__ = '0.4.0'

# DEFAULT_NAMESPACE = 'ec2' # TODO
DEFAULT_REGION = 'us-east-1'

Expand Down Expand Up @@ -147,6 +149,9 @@ def list_elasticache(region, filter_by_kwargs):


def main():
if '--version' in sys.argv:
print(__version__)
sys.exit()
if len(sys.argv) < 3:
print(__doc__)
sys.exit()
Expand Down
17 changes: 17 additions & 0 deletions sample_templates/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Here are some sample jinja2 templates you can use with `plumbum` to generate
configuration files for `leadbutt`.


Usage
-----

### Create a config file for getting metrics from ec2:

plumbum sample_templates/ec2.yml.j2 ec2 > ec2.yml

### Using that config file

leadbutt -c ec2.yml | nc -q0 graphite.local 2003


For more, see `plumbum --help`
4 changes: 0 additions & 4 deletions ec2_sample.yml.j2 → sample_templates/ec2.yml.j2
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
{#- This is a Jinja2 comment
To use this template, you'd run something like:
plumbum ec2_sample.yml.j2 ec2 us-west-2
#}
# Sample config.yaml
#
Auth:
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 0 additions & 2 deletions test_plumbum.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# -*- coding: UTF-8 -*-
"""
Tests for Cloudwatch to Graphite (leadbutt)
WISHLIST: supress chatty stderr and stdout in tests
"""
from __future__ import unicode_literals

Expand Down

0 comments on commit d3079a3

Please sign in to comment.