From c7f0f504c546a7c8923583eb478fd110cd439658 Mon Sep 17 00:00:00 2001 From: "Brian K. Jones" Date: Mon, 20 Feb 2012 00:28:33 -0500 Subject: [PATCH] Added setup.py w/ entry_point, updated README.rst, edits to reflect name change. --- README.rst | 14 ++++++++++++-- bunny.py => bunnyq.py | 12 +++++++----- setup.py | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 52 insertions(+), 7 deletions(-) rename bunny.py => bunnyq.py (98%) create mode 100644 setup.py diff --git a/README.rst b/README.rst index b0b58f2..60afca9 100644 --- a/README.rst +++ b/README.rst @@ -1,9 +1,9 @@ ================= -What is Bunny? +What is Bunnyq? ================= -Bunny aims to be a RabbitMQ administration and testing/development swiss +Bunnyq aims to be a RabbitMQ administration and testing/development swiss army knife. It allows you to do a large (and growing) number of tasks that are supported by RabbitMQ's RESTful HTTP Management API. To get a list of current tasks that are supported, run '?' from within the shell. Here's the output @@ -41,5 +41,15 @@ Requirements - pyrabbit (I wrote this too: http://pypi.python.org/pypi/pyrabbit) - PyYaml (http://pypi.python.org/pypi/PyYAML) +Installation +------------------ +:: + + $ sudo pip install bunnyq + +Installation puts a command called 'bunnyq' in your path, so running +'bunnyq' at a command line should get you where you want to go. For help +run 'bunnyq --help', and for help with commands within the bunnyq shell, type +'?' in the bunnyq shell. diff --git a/bunny.py b/bunnyq.py similarity index 98% rename from bunny.py rename to bunnyq.py index b505db4..2367c47 100755 --- a/bunny.py +++ b/bunnyq.py @@ -32,7 +32,7 @@ def wrapper(inst, args): class Bunny(cmd.Cmd): """Represents a session between a client and a RabbitMQ server, so you can - pass commands using syntax like "bunny.connect(), bunny.delete_queue" etc. + pass commands using syntax like "bunnyq.connect(), bunnyq.delete_queue" etc. """ @@ -310,7 +310,7 @@ def do_exit(self): return True def do_options(): - parser = argparse.ArgumentParser(prog='bunny', + parser = argparse.ArgumentParser(prog='bunnyq', description="A CLI for interacting w/ the " \ "RabbitMQ Management API.") parser.add_argument('-c', '--config', type=str, default=None, @@ -335,14 +335,13 @@ def do_options(): args = parser.parse_args() return args - -if __name__ == '__main__': +def main(): args = do_options() if args.config: # if there's a config arg, there should also be a host arg. if not args.rabbithost: - raise Exception("Specify a '-r' option so bunny knows where in " + raise Exception("Specify a '-r' option so bunnyq knows where in " "the config to look for connection parameters.") with open(args.config, 'r') as conf: config = yaml.load(conf) @@ -365,3 +364,6 @@ def do_options(): shell.onecmd(args.execute) else: shell.cmdloop() + +if __name__ == '__main__': + main() diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..b86ff34 --- /dev/null +++ b/setup.py @@ -0,0 +1,33 @@ +from setuptools import setup, find_packages + +version = '1.0' + +setup(name='bunnyq', + version=version, + description="A command shell for testing/administering RabbitMQ " \ + "using its RESTful HTTP Management API.", + classifiers=[ + "Intended Audience :: Developers", + "Intended Audience :: System Administrators", + "License :: OSI Approved :: MIT License", + "Natural Language :: English", + "Operating System :: POSIX", + "Programming Language :: Python", + "Programming Language :: Python :: 2", + "Programming Language :: Python :: 2.6", + "Programming Language :: Python :: 2.7", + "Topic :: Internet :: WWW/HTTP", + ], + keywords='python http amqp rabbit rabbitmq management', + install_requires = ['pyyaml', 'pyrabbit', 'argparse'], + author='Brian K. Jones', + author_email='bkjones@gmail.com', + url='http://www.github.com/bkjones/bunnyq', + download_url='http://www.github.com/bkjones/bunnyq', + license='MIT', + packages=find_packages(exclude='tests'), + include_package_data=False, + py_modules=['bunnyq'], + entry_points=dict(console_scripts=['bunnyq=bunnyq:main']), + zip_safe=False + )