Elvuel

善战者无赫赫之功

  • Home
  • Atom
  • About Elvuel

Juggernaut & Rails

辛卯[兔]年 八月初二

Juggernauthttps://github.com/maccman/juggernaut

安装配置

1. nodejs http://nodejs.org

获取 0.4.11稳定版

以下: sudo

wget http://nodejs.org/dist/node-v0.4.11.tar.gz

〉tar zxvfnode-v0.4.11.tar.gz

〉cd node-v0.4.11

〉./configure

〉make

〉make install

2. npm(需NODEJS 0.4以上版本)

以下: sudo

curl http://npmjs.org/install.sh | sh

安装模块

〉npm install socket.io

〉npm install redis

〉npm install optimist

〉npm install node-static-maccman

3. 安装并启动redis-server

〉redis-server /etc/redis/redis.conf

4. 启动 juggernaut

〉git clone https://github.com/maccman/juggernaut.git

〉cd juggernaut

〉node server.js

4. 创建RAILS应用

〉rails new juggernaut_demo

〉cd juggernaut_demo

vim Gemfile:

gem 'juggernaut'

〉bundle install

〉rails g controller welcome index publish

vim routes.rb

root :to =〉 "welcome#index"

get "welcome#publish"

vim application.html.erb

〈script src="http://localhost:8080/application.js" type="text/javascript" charset="utf-8"〉〈/script〉

vim welcome#index.html.erb

〈script type="text/javascript" charset="utf-8"〉 var jug = new Juggernaut; jug.subscribe("demo_channel", function(data){ alert(data); }); 〈/script〉

vim welcome_controller#publish

def publish

Juggernaut.publish"demo_channel", "juggernaut demo msg"

end

〉rails s

访问: http://localhost:3000/

http://localhost:3000/welcome/publish

Ok,结束。


read more >>

Tags: juggernaut rails   Posted in Ruby & Rails

  • Search

  • Categories

    • Ruby & Rails
    • Jobs
    • Uncategorized
  • Recent Posts

    • Prawn使用Annotation坐...
    • ejabberd mod_archive
    • Capybara get session in ...
    • Juggernaut & Rails
    • RottenEgg发布
    • ruby rmagick 生成DM
    • ActiveResource for no r...
    • Rails生成Model文档
    • 转-Method triggers:inst...
    • 招聘-Ruby on Rails软件...
  • Links

    • RailsCasts
    • The Ruby Reflector
    • Alltop Ruby
    • Command Line Refer
    • Ruby Code Snippets
    • GitHub
    • API Dock
    • OpenSourceRails
    • RailsPlugins
    • RailsLab
    • 15DaysOfJQuery
  • Archives

    • 2012年(1)

    • 2012年01月(1)
    • 2011年(10)

    • 2011年12月(1)
    • 2011年11月(1)
    • 2011年08月(2)
    • 2011年04月(2)
    • 2011年03月(1)
    • 2011年01月(3)
    • 2010年(27)

    • 2010年12月(1)
    • 2010年11月(2)
    • 2010年10月(4)
    • 2010年09月(7)
    • 2010年08月(1)
    • 2010年07月(5)
    • 2010年06月(1)
    • 2010年04月(6)
    • 2009年(13)

    • 2009年10月(1)
    • 2009年05月(2)
    • 2009年04月(1)
    • 2009年03月(2)
    • 2009年02月(7)
    • 2008年(19)

    • 2008年08月(1)
    • 2008年07月(1)
    • 2008年06月(1)
    • 2008年05月(3)
    • 2008年04月(1)
    • 2008年03月(2)
    • 2008年02月(10)

Copyright © 2010 elvuel.com Powered by Elvuel.