lib/react.rb in react-0.0.1 vs lib/react.rb in react-0.0.2
- old
+ new
@@ -1,23 +1,22 @@
require 'redis'
require 'thread'
-# React is a simple application that allows for remote execution of commands.
-# It uses Redis as a queue - it is blocking specified list and waits for new
-# entries - when an entry appears, then it is executing recognized command.
+# React is a simple application that allows for remote execution of commands,
+# and it uses Redis as a queue.
#
# == Inspiration
#
-# It's inspired by Simon Willson's example of "Queue-activated shell scripts"
-# in his redis-tutorial:
+# It's inspired by Simon Willison's example of "Queue-activated shell scripts"
+# in his redis tutorial:
#
# while [ 1 ] do
# redis-cli blpop restart-httpd 0
# apache2ctl graceful
# done
#
-# == Examples
+# == Usage
#
# Firs you have to prepare file with available commands. It can look like this:
#
# # my_commands.yml
# restart_httpd: |
@@ -29,29 +28,35 @@
#
# Now you can start consumer.
#
# react my_commands.yml
#
-# == Commands
+# == Pushing commands
#
-# While your consumer is working, you can push any command to it's queue
-# (default queue name is `queue`), eg:
+# While your consumer is working, you can push any of specified command to
+# queue (default queue name is `queue`), eg:
#
# redis-cli lpush queue restart_httpd
# redis-cli lpush queue reboot
#
+# After that consumer will pick up enqueued command names from and execute
+# related commands.
+#
# == Configuration
-#
+#
# There are few more runtime options, which can be useful for you.
-#
-# # it will be consuming commands from specified queue
-# react my_commands.yml --queue "my:queue:name"
#
-# # you can specify the database to which React should connect
-# react my_commands.yml --host "yourhost.com" --port 6379 --db 2
+# * you can specify queue which will be consumed:
#
-# # and finally, you can demonize your application
-# react my_commands.yml --daemonize
+# react my_commands.yml --queue "my:queue:name"
+#
+# * you can specify the database to which consumer should connect:
+#
+# react my_commands.yml --host "yourhost.com" --port 6379 --db 2 --password pass
+#
+# * and finally, you can demonize the consumer:
+#
+# react my_commands.yml --daemon
module React
# It starts the consumer loop.
def self.start(conf)
@config = conf