dcu / nanite-rails

easy nanite integration with rails

This URL has Read+Write access

name age message
file .gitignore Fri Apr 17 00:42:04 -0700 2009 initial commit Signed-off-by: David A. Cuadrad... [dcu]
file README Wed Jul 08 11:02:05 -0700 2009 Place nanite agent configs in config/agent. Th... [Chris Gaffney]
directory generators/ Fri Dec 18 06:46:55 -0800 2009 avoid nil tag when you construct nanite-agent c... [shingara]
file init.rb Fri Apr 17 00:42:04 -0700 2009 initial commit Signed-off-by: David A. Cuadrad... [dcu]
directory lib/ Fri Apr 24 12:49:19 -0700 2009 patch json to avoid conflicts Signed-off-by: D... [dcu]
README
== Getting Started

- Install the plugin: script/plugin install git://github.com/dcu/nanite-rails.git

- script/generate nanite

- Configure RAILS_ROOT/config/nanite/mapper.yml and RAILS_ROOT/config/nanite/worker.yml
    $ cp config/nanite/mapper.sample.yml config/nanite/mapper.yml
    $ cp config/nanite/worker.sample.yml config/nanite/worker.yml

- Add "config.gem 'nanite'" to RAILS_ROOT/config/environment.rb

- run "rake nanite:rabbitmq" as root

- run "script/nanite start"

- on a rails console run: NaniteJob.request!(Hash, :constants){|r| puts r.inspect}

== Adding a custom agent named "spider"
  spider will have two actions, eat, and throw_web, eat takes a parameter

- script/generate agent spider eat throw_web
- script/nanite -a spider start          
- on a rails console run:
  $ Nanite.request("/spiders/eat", "fly"){|r| puts r.inspect}
  $ Nanite.request("/spiders/throw_web"){|r| puts r.inspect}


== Rails Integration ==
if you need to use your ActiveRecord models add this lines to your worker/init.rb code

 ENV["RAILS_ENV"] ||= "development"
 ENV["NO_NM"] = "1" 
 require APP_ROOT + "/config/environment"