Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
nofxx committed Mar 3, 2010
1 parent e12b824 commit b686dd6
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 23 deletions.
45 changes: 37 additions & 8 deletions README.rdoc
@@ -1,16 +1,45 @@
= bugs_bunny
= Bugs Bunny

Description goes here.
RabbitMQ Playground

== Qual é o pó, doutor?

Run 'bbunny config' to create a rabbitmq.yml conf file, edit it, play.


=== bbunny queues

Lists all queues in the vhost.


=== bbunny queues new works

Create a queue 'works'.


=== bbunny queue works add "Improve Bugs Bunny"

Add a message to the queue.


=== bbunny queue works pop

Pop a message from the queue.


=== bbunny queue works inspect

Live inspection of the queue.


Check out -h for all commands.

== Note on Patches/Pull Requests

* Fork the project.
* Make your feature addition or bug fix.
* Add tests for it. This is important so I don't break it in a
future version unintentionally.
* Commit, do not mess with rakefile, version, or history.
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
* Send me a pull request. Bonus points for topic branches.
* Add and run our cli cuke suite ;)
* Send me a pull request.

== Copyright

Expand Down
22 changes: 14 additions & 8 deletions bin/bbunny
Expand Up @@ -14,21 +14,27 @@ Commands:
vhosts - List vhosts
users - List and filter items
queues - Order by: name, price, store.
queues - List queues
new - Create a new queue
purge - Purge all queues
delete - Remove all the queues closing all connections
queue - Expects the queue name
add - Create a new message on the queue
pop - Pop a message from the queue
list - Snapshot of the queue
inspect - Live view
purge - Purge a queue
delete - Remove the queue closing all connections
clear - Wipe out mnesia
config - "Generates a config file for AMQP connection
Common usage:
pyradise queue foo
config - Generates a config file for the AMQP connection
Options:
BANNER
o.on('-c CONFIG', "Config file path") { |path| Opt[:config] = path }
o.on('-p PATH', "Output path for config file") { |path| Opt[:out] = path }
o.on('-v', "Verbose") { |b| Opt[:verbose] = true }
o.on('-f', "Force") { |b| Opt[:force] = true }
o.on('-v', "--verbose") { |b| Opt[:verbose] = true }
o.on('-f', "--force") { |b| Opt[:force] = true }
o.on('-h') { puts o; exit }
o.parse!
end
Expand Down
14 changes: 7 additions & 7 deletions lib/bugs_bunny/cli.rb
@@ -1,7 +1,7 @@
# Command Line Stuff
require 'yaml'
begin # Needed (really?) for ruby 1.8
# require 'ftools'
require 'ftools'
rescue LoadError
end

Expand Down Expand Up @@ -34,7 +34,7 @@ def config
puts "Config file already exists"
exit
else
File.copy(File.dirname(__FILE__) + "/#{CONFIG_FILE}", path)
FileUtils.copy(File.dirname(__FILE__) + "/#{CONFIG_FILE}", path)
puts "Copied config file to #{path}"
end
end
Expand All @@ -46,17 +46,17 @@ def log(*args)
puts *args
end

def config_exists?(path, name = CONFIG_FILE)
File.exists?(path + name)
def config_exists?(path)
File.exists?(path + CONFIG_FILE)
end

def parse_config
unless file = Opt[:config]
file = ["", "config/"].select { |p| config_exists?(p) }[0]
file += CONFIG_FILE
file += CONFIG_FILE if file
end
unless File.exists?(file)
puts "No config file"; exit
unless file && File.exists?(file)
puts "No config file.\nCreate one with 'config'"; exit
end
Opt[:rabbit].merge! YAML.load(File.read(file))
end
Expand Down

0 comments on commit b686dd6

Please sign in to comment.