Skip to content

Commit

Permalink
First attempt upgrading it to Cramp 0.12 and Tramp
Browse files Browse the repository at this point in the history
  • Loading branch information
akitaonrails committed Feb 14, 2011
1 parent d30dee3 commit 7e2f8d3
Show file tree
Hide file tree
Showing 9 changed files with 405 additions and 182 deletions.
2 changes: 2 additions & 0 deletions .gitignore
@@ -0,0 +1,2 @@
.DS_Store
*.swp
7 changes: 5 additions & 2 deletions README.textile
Expand Up @@ -9,10 +9,9 @@ h2. Usage
This should install all the dependencies

<pre>
gem install arel --pre
gem install activemodel --pre
gem install thin
gem install cramp
gem install tramp
</pre>

This demo uses MySQL, so you will need to create your own database. Read @config/database.sql@ to create it and edit @config/database.yml@ with the correct server, username and password.
Expand Down Expand Up @@ -62,6 +61,10 @@ h2. TODO
* Add multiple room and user registration support, but this requires exchanging session information as well. Making Rack::Session work may be a requirement
* Add templating than just static file to allow for some HAML or ERB views, adding Tilt to Cramp would be good as well

h2. Changelog

* 02/14/2011 - Updated to Cramp 0.12 and the new Tramp gem.

h2. Credits

* "Pratik Naik":http://m.onkey.org/ for Cramp
Expand Down
6 changes: 3 additions & 3 deletions app/controllers/application_controller.rb
@@ -1,7 +1,7 @@
class ApplicationController < Cramp::Controller::Action
class ApplicationController < Cramp::Action
include ApplicationHelper
end

class WebSocketApplicationController < Cramp::Controller::Websocket
class WebSocketApplicationController < Cramp::Websocket
include ApplicationHelper
end
end
4 changes: 2 additions & 2 deletions app/models/chat.rb
@@ -1,4 +1,4 @@
class Chat < Cramp::Model::Base
class Chat < Tramp::Base
attribute :id, :type => Integer, :primary_key => true
attribute :name
attribute :sent_at
Expand All @@ -18,4 +18,4 @@ def self.recent(last_message)
end

validates_presence_of :name
end
end
28 changes: 14 additions & 14 deletions chatserver.rb
Expand Up @@ -2,22 +2,22 @@
require 'thin'
require 'usher'
require 'erb'
require 'cramp/controller'
require 'cramp/model'
require 'cramp'
require 'tramp'
require 'active_support/all'
require 'active_support/json'

require 'config/routes'
require 'app/helpers/application'
require 'app/controllers/application_controller'
require 'app/controllers/chat_controller'
require 'app/controllers/retrieve_controller'
require 'app/controllers/receive_controller'
require 'app/controllers/static_controller'
require 'app/models/chat'
require 'lib/fixes'
require './config/routes'
require './app/helpers/application'
require './app/controllers/application_controller'
require './app/controllers/chat_controller'
require './app/controllers/retrieve_controller'
require './app/controllers/receive_controller'
require './app/controllers/static_controller'
require './app/models/chat'
require './lib/fixes'

Cramp::Model.init(YAML.load(File.read('./config/database.yml')))
Cramp::Controller::Websocket.backend = :thin
Tramp.init(YAML.load(File.read('./config/database.yml')))
Cramp::Websocket.backend = :thin
Thin::Logging.trace = true
Rack::Handler::Thin.run app_routes, :Port => 3000
Rack::Handler::Thin.run app_routes, :Port => 3000
1 change: 1 addition & 0 deletions config/database.yml
@@ -1,3 +1,4 @@
---
:database: cramp_chat_development
:username: root
:password: root
2 changes: 1 addition & 1 deletion public/javascript/FABridge.js
Expand Up @@ -362,7 +362,7 @@ FABridge.prototype =
// accepts a type structure, returns a constructed type
addTypeDataToCache: function(typeData)
{
newType = new ASProxy(this, typeData.name);
var newType = new ASProxy(this, typeData.name);
var accessors = typeData.accessors;
for (var i = 0; i < accessors.length; i++)
{
Expand Down
Binary file modified public/javascript/WebSocketMain.swf
Binary file not shown.

0 comments on commit 7e2f8d3

Please sign in to comment.