Permalink
Browse files

Add documentation and other changes

  • Loading branch information...
1 parent 248d967 commit 1aa0d0b8ba6fdd1a2a894f63079787071d1c6838 gnufied committed Feb 26, 2008
Showing with 1,216 additions and 9 deletions.
  1. +5 −0 doc/Rakefile
  2. +2 −0 doc/config.yaml
  3. +1 −0 doc/content/advanced/advanced.txt
  4. +4 −0 doc/content/advanced/advanced.yaml
  5. +1 −0 doc/content/bugs/bugs.txt
  6. +4 −0 doc/content/bugs/bugs.yaml
  7. +1 −0 doc/content/community/community.txt
  8. +4 −0 doc/content/community/community.yaml
  9. +147 −0 doc/content/content.txt
  10. +5 −0 doc/content/content.yaml
  11. +1 −0 doc/content/manual/manual.txt
  12. +4 −0 doc/content/manual/manual.yaml
  13. +1 −0 doc/content/rails/rails.txt
  14. +4 −0 doc/content/rails/rails.yaml
  15. +10 −0 doc/content/scheduling/scheduling.txt
  16. +4 −0 doc/content/scheduling/scheduling.yaml
  17. +1 −0 doc/content/workers/workers.txt
  18. +4 −0 doc/content/workers/workers.yaml
  19. +56 −0 doc/layouts/default.erb
  20. +7 −0 doc/lib/default.rb
  21. +13 −0 doc/meta.yaml
  22. BIN doc/output/Assets/BG-Ad-Top.png
  23. BIN doc/output/Assets/BG-Body.png
  24. BIN doc/output/Assets/BG-Feed.png
  25. BIN doc/output/Assets/BG-Footer.psd
  26. BIN doc/output/Assets/BG-Header.psd
  27. BIN doc/output/Assets/BG-Menu-Hover.png
  28. BIN doc/output/Assets/BG-Menu.png
  29. BIN doc/output/Assets/BG-Sidebar-Bottom.png
  30. BIN doc/output/Assets/Button-Feed.png
  31. +53 −0 doc/output/advanced/index.html
  32. +52 −0 doc/output/bugs/index.html
  33. +52 −0 doc/output/community/index.html
  34. BIN doc/output/images/Thumbs.db
  35. BIN doc/output/images/bg-ad-top.png
  36. BIN doc/output/images/bg-body.png
  37. BIN doc/output/images/bg-feed.gif
  38. BIN doc/output/images/bg-footer.jpg
  39. BIN doc/output/images/bg-header.jpg
  40. BIN doc/output/images/bg-menu-hover.png
  41. BIN doc/output/images/bg-menu.png
  42. BIN doc/output/images/bg-sidebar-bottom.gif
  43. BIN doc/output/images/button-feed.png
  44. BIN doc/output/images/icon-comment.png
  45. BIN doc/output/images/more_icon.gif
  46. +232 −0 doc/output/index.html
  47. +52 −0 doc/output/manual/index.html
  48. +52 −0 doc/output/rails/index.html
  49. +62 −0 doc/output/scheduling/index.html
  50. +299 −0 doc/output/style.css
  51. +52 −0 doc/output/workers/index.html
  52. +3 −0 doc/tasks/default.rake
  53. +1 −0 doc/templates/default/default.txt
  54. +4 −0 doc/templates/default/default.yaml
  55. +14 −4 examples/clean_api.rb
  56. +2 −2 server/lib/master_worker.rb
  57. +7 −3 server/lib/meta_worker.rb
View
@@ -0,0 +1,5 @@
+Dir['tasks/**/*.rake'].sort.each { |rakefile| load rakefile }
+
+task :default do
+ puts 'This is an example rake task.'
+end
View
@@ -0,0 +1,2 @@
+output_dir: "output"
+data_source: "filesystem"
@@ -0,0 +1 @@
+Hi, I'm a new page!
@@ -0,0 +1,4 @@
+# Built-in
+
+# Custom
+title: "A New Page"
@@ -0,0 +1 @@
+Hi, I'm a new page!
@@ -0,0 +1,4 @@
+# Built-in
+filters_pre: "textile"
+# Custom
+title: "Report Bugs"
@@ -0,0 +1 @@
+Hi, I'm a new page!
@@ -0,0 +1,4 @@
+# Built-in
+filters_pre: "textile"
+# Custom
+title: "Join the BackgrounDRb Community"
View
@@ -0,0 +1,147 @@
+<div id="content">
+
+%(entry-title)<a name="introduction"> Introduction </a>%
+
+*BackgrounDRb* is a Ruby job server and scheduler. Its main intent is to be
+used with Ruby on Rails applications for offloading long-running tasks.
+Since a Rails application blocks while serving a request it is best to
+move long-running tasks off into a background process that is divorced
+from http request/response cycle.
+
+%(entry-title)<a name="installation"> Installation </a>%
+
+p(sub-title). Installing the dependencies :
+
+As of version 1.0.3 _BackgrounDRb_ depends on _chronic_ and _packet_ gems. Thus lets get
+started by installing these two gems:
+
+<pre class="boxed">sudo gem install chronic packet </pre>
+
+p(sub-title). Getting the code from Subversion :
+
+<pre class="boxed"> svn co http://svn.devjavu.com/backgroundrb/trunk </pre>
+
+p(sub-title). Installing from Git:
+
+As of version 1.0.3 __BackgrounDRb__ development has moved to gitorious. Above SVN url
+will always mirror stable releases from Git. However to enjoy latest and greatest of features
+you can install the plugin from git:
+
+<pre class="multiline">
+git clone </pre>
+
+p(sub-title). Installation using Piston
+
+<pre class="boxed">piston import http://svn.devjavu.com/backgroundrb/trunk/ backgroundrb </pre>
+
+%(entry-title)<a name="configuration"> Configuration </a>%
+
+After getting the plugin, you must configure it for use. _BackgrounDRb_ comes with a rake task
+for automating plugin configuration. Run, following command from root directory of your rails
+application, after installation:
+
+<pre class="boxed">rake backgroundrb:setup </pre>
+
+Above Command does following things :
+
+*(content_list) Creates a config file @backgroundrb.yml@ in config directory of your rails application.
+* Creates @RAILS_ROOT/lib/workers@ direcotry for keeping BackgrounDRb workers in one place.
+* Creates @RAILS_ROOT/test/bdrb_test_helper.rb@ as a test helper for your workers
+
+p(sub-title). Configuration Options
+
+A default @backgroundrb.yml@ file looks like this:
+
+<pre class="multiline">
+:backgroundrb:
+ :port: 11006
+ :ip: 0.0.0.0 </pre>
+
+However, various other configuration options are available. For example, to load @production@
+environment in your workers:
+
+<pre class="multiline">
+:backgroundrb:
+ :port: 11006
+ :ip: 0.0.0.0
+ :environment: production </pre>
+
+
+Following file demonstrates other available configuration options:
+
+<pre class="multiline">
+---
+:backgroundrb:
+ :port: 11006 # port to start listen
+ :ip: localhost # host to listen
+ :environment: production # rails environment to load
+ :log: foreground # foreground mode,print log messages on console
+ :lazy_load: true # do not load models eagerly
+ :debug_log: false # disable log workers and other logging </pre>
+
+@lazy_load@ option should be true if you want to pass @ActiveRecord@ model
+objects around, However, this option is generally not encouraged to use,
+because if your model makes use of some other ActiveRecord plugin and
+plugin is not available during load, loading of model will fail. In
+new version of BackgrounDRb its generally discouraged to pass model objects around,
+since they are harder to serialize and deserialize.
+
+%(entry-title)<a name="worker"> Workers </a>%
+
+Once you are set with initial configuration, you can proceed to create worker and start
+_BackgrounDRb_ server. To generate a worker:
+
+<pre class="boxed"> ./script/generate worker billing </pre>
+
+Output will look something like:
+
+<pre class="multiline">exists lib/workers/
+create lib/workers/billing_worker.rb </pre>
+
+And generated worker will look like:
+
+<pre class="multiline">class BillingWorker < BackgrounDRb::MetaWorker
+ set_worker_name :billing_worker
+ def create(args = nil)
+ # method gets called, when new instance of worker is created.
+ end
+ end </pre>
+
+
+You can define worker specific initialization in @create@ method. Tasks that are to be executed
+in this worker should be defined as seperate methods. For example:
+
+<pre class="multiline">class BillingWorker < BackgrounDRb::MetaWorker
+ set_worker_name :billing_worker
+ def create(args = nil)
+ # this method is called, when worker is loaded for the first time
+ end
+
+ def charge_customer(customer_id = nil)
+ logger.info 'charging customer now'
+ end
+end </pre>
+
+%(entry-title)<a name="invoking_tasks"> Invoking Tasks </a>%
+
+Task @charge_customer@ defined in @BillingWorker@ can be invoked in several ways. To beging with
+it can be invoked from rails or can be scheduled to execute at particular interval using
+cron like syntax.
+
+p(sub-title). Invoking Task from Rails :
+
+In your Rails controllers you have access to proxy class @MiddleMan@ which can be used
+to interact with BackgrounDRb server, either from Rails controllers/Models or from Rails console.
+For example to invoke @charge_customer@ method one can use:
+
+<pre class="multiline">MiddleMan.ask_work(:worker => :billing_worker,\
+ :worker_method => :charge_customer,\
+ :data => current_customer.id) </pre>
+
+Above code can be also executed from Rails console.
+
+</div>
+
+
+
+
View
@@ -0,0 +1,5 @@
+# Built-in
+filters_pre: "textile"
+# Custom
+title: "Introduction BackgrounDRb"
+sidebar_items: [["Introduction", "#introduction"], ["Installation", "#installation"], ["Configuration", "#configuration"], ["Workers", "#create_worker"]]
@@ -0,0 +1 @@
+Hi, I'm a new page!
@@ -0,0 +1,4 @@
+# Built-in
+filters_pre: "textile"
+# Custom
+title: "BackgrounDRb Manual Page"
@@ -0,0 +1 @@
+Hi, I'm a new page!
@@ -0,0 +1,4 @@
+# Built-in
+filters_pre: "textile"
+# Custom
+title: "Rails Integration of BackgrounDRb"
@@ -0,0 +1,10 @@
+<div id="content">
+
+%(entry-title)<a name="simple_schedule"> Timer Based Scheduling </a>%
+
+*BackgrounDRb* uses *packet* for providing networking capabilities and as a result, simple
+tasks in the workers can be scheduled using @add_timer@ and @add_periodic_timer@ methods.
+For example:
+
+
+</div>
@@ -0,0 +1,4 @@
+# Built-in
+filters_pre: "textile"
+# Custom
+title: "Scheduling Tasks using BackgrounDRb"
@@ -0,0 +1 @@
+Hi, I'm a new page!
@@ -0,0 +1,4 @@
+# Built-in
+filters_pre: "textile"
+# Custom
+title: "Using BackgrounDRb workers"
View
@@ -0,0 +1,56 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <title>BackgrounDRb - <%= @page.title %></title>
+ <link rel="stylesheet" href="/style.css" type="text/css" media="screen" />
+ </head>
+
+ <body>
+
+ <div id="wrapper">
+ <div id="header">
+ <h1> BackgrounDRb </h1>
+ </div>
+
+ <div id="menu">
+ <ul>
+ <li><a href="/index.html"> Intro </a></li>
+ <li><a href="/scheduling/index.html"> Scheduling </a></li>
+ <li><a href="/workers/index.html"> Workers </a></li>
+ <li><a href="/rails/index.html"> Rails Integration </a></li>
+ <li><a href="/advanced/index.html"> Advanced </a></li>
+ <li><a href="/manual/index.html"> Manual </a></li>
+ <li><a href="/community/index.html"> Community </a></li>
+ <li><a href="/bugs/index.html"> Bugs </a></li>
+ </ul>
+ </div>
+
+ <div id="sidebar">
+ <div id="feed">
+ <!-- <a class="feed-button" href="#">&nbsp;</a> -->
+ </div>
+ <ul>
+ <% if @page.sidebar_items %>
+ <% for menu_item in @page.sidebar_items %>
+ <li><a href="<%= menu_item[1] %>"> <%= menu_item[0] %> </a></li>
+ <% end %>
+ <% end %>
+ </ul>
+
+ <div id="sidebar-bottom">
+ &nbsp;
+ </div>
+ </div>
+
+ <%= @page.content %>
+
+ <div id="footer">
+ <div id="footer-valid">
+ <a href="http://validator.w3.org/check/referer">xhtml</a> / <a href="http://www.ginger-ninja.net/">ginger ninja!</a>
+ </div>
+ </div>
+
+ </div> <!-- end of wrapper div tag -->
+ </body>
+</html>
View
@@ -0,0 +1,7 @@
+# All files in the 'lib' directory will be loaded
+# before nanoc starts compiling.
+
+def html_escape(str)
+ str.gsub('&', '&amp;').str('<', '&lt;').str('>', '&gt;').str('"', '&quot;')
+end
+alias h html_escape
View
@@ -0,0 +1,13 @@
+# This file contains the default values for all metafiles.
+# Other metafiles can override the contents of this one.
+
+# Built-in
+custom_path: none
+extension: "html"
+filename: "index"
+filters_post: []
+filters_pre: []
+is_draft: false
+layout: "default"
+skip_output: false
+# Custom
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -0,0 +1,53 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <title>BackgrounDRb - A New Page</title>
+ <link rel="stylesheet" href="/style.css" type="text/css" media="screen" />
+ </head>
+
+ <body>
+
+ <div id="wrapper">
+ <div id="header">
+ <h1> BackgrounDRb </h1>
+ </div>
+
+ <div id="menu">
+ <ul>
+ <li><a href="/index.html"> Intro </a></li>
+ <li><a href="/scheduling/index.html"> Scheduling </a></li>
+ <li><a href="/workers/index.html"> Workers </a></li>
+ <li><a href="/rails/index.html"> Rails Integration </a></li>
+ <li><a href="/advanced/index.html"> Advanced </a></li>
+ <li><a href="/manual/index.html"> Manual </a></li>
+ <li><a href="/community/index.html"> Community </a></li>
+ <li><a href="/bugs/index.html"> Bugs </a></li>
+ </ul>
+ </div>
+
+ <div id="sidebar">
+ <div id="feed">
+ <!-- <a class="feed-button" href="#">&nbsp;</a> -->
+ </div>
+ <ul>
+
+ </ul>
+
+ <div id="sidebar-bottom">
+ &nbsp;
+ </div>
+ </div>
+
+ Hi, I'm a new page!
+
+
+ <div id="footer">
+ <div id="footer-valid">
+ <a href="http://validator.w3.org/check/referer">xhtml</a> / <a href="http://www.ginger-ninja.net/">ginger ninja!</a>
+ </div>
+ </div>
+
+ </div> <!-- end of wrapper div tag -->
+ </body>
+</html>
Oops, something went wrong.

0 comments on commit 1aa0d0b

Please sign in to comment.