Replace PrototypeR4 by Orbit.
Move session into mongoid_store. Reset session when sing_in.
This commit is contained in:
		
							parent
							
								
									785ead5209
								
							
						
					
					
						commit
						f4fda08e86
					
				
							
								
								
									
										3
									
								
								Gemfile
								
								
								
								
							
							
						
						
									
										3
									
								
								Gemfile
								
								
								
								
							| 
						 | 
					@ -1,6 +1,8 @@
 | 
				
			||||||
source 'http://rubygems.org'
 | 
					source 'http://rubygems.org'
 | 
				
			||||||
gem 'rails', '>=3.1.0', '<3.2.0'
 | 
					gem 'rails', '>=3.1.0', '<3.2.0'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					gem "brakeman"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
gem 'bson_ext'
 | 
					gem 'bson_ext'
 | 
				
			||||||
gem 'carrierwave'
 | 
					gem 'carrierwave'
 | 
				
			||||||
gem 'carrierwave-mongoid', :require => 'carrierwave/mongoid'
 | 
					gem 'carrierwave-mongoid', :require => 'carrierwave/mongoid'
 | 
				
			||||||
| 
						 | 
					@ -13,6 +15,7 @@ gem 'kaminari', :git => 'git://github.com/amatsuda/kaminari.git'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
gem 'mini_magick'
 | 
					gem 'mini_magick'
 | 
				
			||||||
gem 'mongoid'
 | 
					gem 'mongoid'
 | 
				
			||||||
 | 
					gem "mongo_session_store-rails3"
 | 
				
			||||||
gem 'radius'
 | 
					gem 'radius'
 | 
				
			||||||
gem 'rake'
 | 
					gem 'rake'
 | 
				
			||||||
gem 'ruby-debug19'
 | 
					gem 'ruby-debug19'
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										32
									
								
								Gemfile.lock
								
								
								
								
							
							
						
						
									
										32
									
								
								Gemfile.lock
								
								
								
								
							| 
						 | 
					@ -42,6 +42,14 @@ GEM
 | 
				
			||||||
    arel (2.2.1)
 | 
					    arel (2.2.1)
 | 
				
			||||||
    bcrypt-ruby (3.0.1)
 | 
					    bcrypt-ruby (3.0.1)
 | 
				
			||||||
    bcrypt-ruby (3.0.1-x86-mingw32)
 | 
					    bcrypt-ruby (3.0.1-x86-mingw32)
 | 
				
			||||||
 | 
					    brakeman (1.5.0)
 | 
				
			||||||
 | 
					      activesupport
 | 
				
			||||||
 | 
					      erubis (~> 2.6)
 | 
				
			||||||
 | 
					      haml (~> 3.0)
 | 
				
			||||||
 | 
					      i18n
 | 
				
			||||||
 | 
					      ruby2ruby (~> 1.2)
 | 
				
			||||||
 | 
					      ruport (~> 1.6)
 | 
				
			||||||
 | 
					      sass (~> 3.0)
 | 
				
			||||||
    bson (1.5.2)
 | 
					    bson (1.5.2)
 | 
				
			||||||
    bson_ext (1.5.2)
 | 
					    bson_ext (1.5.2)
 | 
				
			||||||
      bson (= 1.5.2)
 | 
					      bson (= 1.5.2)
 | 
				
			||||||
| 
						 | 
					@ -59,6 +67,7 @@ GEM
 | 
				
			||||||
      coffee-script-source
 | 
					      coffee-script-source
 | 
				
			||||||
      execjs
 | 
					      execjs
 | 
				
			||||||
    coffee-script-source (1.2.0)
 | 
					    coffee-script-source (1.2.0)
 | 
				
			||||||
 | 
					    color (1.4.1)
 | 
				
			||||||
    columnize (0.3.6)
 | 
					    columnize (0.3.6)
 | 
				
			||||||
    database_cleaner (0.7.1)
 | 
					    database_cleaner (0.7.1)
 | 
				
			||||||
    delorean (1.2.0)
 | 
					    delorean (1.2.0)
 | 
				
			||||||
| 
						 | 
					@ -78,7 +87,11 @@ GEM
 | 
				
			||||||
    factory_girl_rails (1.6.0)
 | 
					    factory_girl_rails (1.6.0)
 | 
				
			||||||
      factory_girl (~> 2.5.0)
 | 
					      factory_girl (~> 2.5.0)
 | 
				
			||||||
      railties (>= 3.0.0)
 | 
					      railties (>= 3.0.0)
 | 
				
			||||||
 | 
					    fastercsv (1.5.4)
 | 
				
			||||||
 | 
					    haml (3.1.4)
 | 
				
			||||||
    hike (1.2.1)
 | 
					    hike (1.2.1)
 | 
				
			||||||
 | 
					    hoe (2.15.0)
 | 
				
			||||||
 | 
					      rake (~> 0.8)
 | 
				
			||||||
    i18n (0.6.0)
 | 
					    i18n (0.6.0)
 | 
				
			||||||
    jquery-rails (1.0.19)
 | 
					    jquery-rails (1.0.19)
 | 
				
			||||||
      railties (~> 3.0)
 | 
					      railties (~> 3.0)
 | 
				
			||||||
| 
						 | 
					@ -96,12 +109,18 @@ GEM
 | 
				
			||||||
      subexec (~> 0.2.1)
 | 
					      subexec (~> 0.2.1)
 | 
				
			||||||
    mongo (1.5.2)
 | 
					    mongo (1.5.2)
 | 
				
			||||||
      bson (= 1.5.2)
 | 
					      bson (= 1.5.2)
 | 
				
			||||||
 | 
					    mongo_session_store-rails3 (3.0.5)
 | 
				
			||||||
 | 
					      actionpack (>= 3.0)
 | 
				
			||||||
 | 
					      mongo
 | 
				
			||||||
    mongoid (2.4.2)
 | 
					    mongoid (2.4.2)
 | 
				
			||||||
      activemodel (~> 3.1)
 | 
					      activemodel (~> 3.1)
 | 
				
			||||||
      mongo (~> 1.3)
 | 
					      mongo (~> 1.3)
 | 
				
			||||||
      tzinfo (~> 0.3.22)
 | 
					      tzinfo (~> 0.3.22)
 | 
				
			||||||
    multi_json (1.0.4)
 | 
					    multi_json (1.0.4)
 | 
				
			||||||
    orm_adapter (0.0.6)
 | 
					    orm_adapter (0.0.6)
 | 
				
			||||||
 | 
					    pdf-writer (1.1.8)
 | 
				
			||||||
 | 
					      color (>= 1.4.0)
 | 
				
			||||||
 | 
					      transaction-simple (~> 1.3)
 | 
				
			||||||
    polyglot (0.3.3)
 | 
					    polyglot (0.3.3)
 | 
				
			||||||
    rack (1.3.6)
 | 
					    rack (1.3.6)
 | 
				
			||||||
    rack-cache (1.1)
 | 
					    rack-cache (1.1)
 | 
				
			||||||
| 
						 | 
					@ -154,15 +173,24 @@ GEM
 | 
				
			||||||
      columnize (>= 0.3.1)
 | 
					      columnize (>= 0.3.1)
 | 
				
			||||||
      linecache19 (>= 0.5.11)
 | 
					      linecache19 (>= 0.5.11)
 | 
				
			||||||
      ruby-debug-base19 (>= 0.11.19)
 | 
					      ruby-debug-base19 (>= 0.11.19)
 | 
				
			||||||
 | 
					    ruby2ruby (1.3.1)
 | 
				
			||||||
 | 
					      ruby_parser (~> 2.0)
 | 
				
			||||||
 | 
					      sexp_processor (~> 3.0)
 | 
				
			||||||
    ruby_core_source (0.1.5)
 | 
					    ruby_core_source (0.1.5)
 | 
				
			||||||
      archive-tar-minitar (>= 0.5.2)
 | 
					      archive-tar-minitar (>= 0.5.2)
 | 
				
			||||||
 | 
					    ruby_parser (2.3.1)
 | 
				
			||||||
 | 
					      sexp_processor (~> 3.0)
 | 
				
			||||||
    rubyzip (0.9.5)
 | 
					    rubyzip (0.9.5)
 | 
				
			||||||
 | 
					    ruport (1.6.3)
 | 
				
			||||||
 | 
					      fastercsv
 | 
				
			||||||
 | 
					      pdf-writer (= 1.1.8)
 | 
				
			||||||
    sass (3.1.12)
 | 
					    sass (3.1.12)
 | 
				
			||||||
    sass-rails (3.1.5)
 | 
					    sass-rails (3.1.5)
 | 
				
			||||||
      actionpack (~> 3.1.0)
 | 
					      actionpack (~> 3.1.0)
 | 
				
			||||||
      railties (~> 3.1.0)
 | 
					      railties (~> 3.1.0)
 | 
				
			||||||
      sass (~> 3.1.10)
 | 
					      sass (~> 3.1.10)
 | 
				
			||||||
      tilt (~> 1.3.2)
 | 
					      tilt (~> 1.3.2)
 | 
				
			||||||
 | 
					    sexp_processor (3.1.0)
 | 
				
			||||||
    shoulda-matchers (1.0.0)
 | 
					    shoulda-matchers (1.0.0)
 | 
				
			||||||
    simplecov (0.5.4)
 | 
					    simplecov (0.5.4)
 | 
				
			||||||
      multi_json (~> 1.0.3)
 | 
					      multi_json (~> 1.0.3)
 | 
				
			||||||
| 
						 | 
					@ -186,6 +214,8 @@ GEM
 | 
				
			||||||
    tilt (1.3.3)
 | 
					    tilt (1.3.3)
 | 
				
			||||||
    tinymce-rails (3.4.8)
 | 
					    tinymce-rails (3.4.8)
 | 
				
			||||||
      railties (>= 3.1)
 | 
					      railties (>= 3.1)
 | 
				
			||||||
 | 
					    transaction-simple (1.4.0)
 | 
				
			||||||
 | 
					      hoe (>= 1.1.7)
 | 
				
			||||||
    treetop (1.4.10)
 | 
					    treetop (1.4.10)
 | 
				
			||||||
      polyglot
 | 
					      polyglot
 | 
				
			||||||
      polyglot (>= 0.3.1)
 | 
					      polyglot (>= 0.3.1)
 | 
				
			||||||
| 
						 | 
					@ -210,6 +240,7 @@ PLATFORMS
 | 
				
			||||||
  x86-mingw32
 | 
					  x86-mingw32
 | 
				
			||||||
 | 
					
 | 
				
			||||||
DEPENDENCIES
 | 
					DEPENDENCIES
 | 
				
			||||||
 | 
					  brakeman
 | 
				
			||||||
  bson_ext
 | 
					  bson_ext
 | 
				
			||||||
  carrierwave
 | 
					  carrierwave
 | 
				
			||||||
  carrierwave-mongoid
 | 
					  carrierwave-mongoid
 | 
				
			||||||
| 
						 | 
					@ -223,6 +254,7 @@ DEPENDENCIES
 | 
				
			||||||
  jquery-rails
 | 
					  jquery-rails
 | 
				
			||||||
  kaminari!
 | 
					  kaminari!
 | 
				
			||||||
  mini_magick
 | 
					  mini_magick
 | 
				
			||||||
 | 
					  mongo_session_store-rails3
 | 
				
			||||||
  mongoid
 | 
					  mongoid
 | 
				
			||||||
  radius
 | 
					  radius
 | 
				
			||||||
  rails (>= 3.1.0, < 3.2.0)
 | 
					  rails (>= 3.1.0, < 3.2.0)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										2
									
								
								Rakefile
								
								
								
								
							
							
						
						
									
										2
									
								
								Rakefile
								
								
								
								
							| 
						 | 
					@ -5,4 +5,4 @@ require File.expand_path('../config/application', __FILE__)
 | 
				
			||||||
require 'rake/dsl_definition'
 | 
					require 'rake/dsl_definition'
 | 
				
			||||||
require 'rake'
 | 
					require 'rake'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
PrototypeR4::Application.load_tasks
 | 
					Orbit::Application.load_tasks
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,8 @@
 | 
				
			||||||
 | 
					class SessionsController < Devise::SessionsController
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  def create 
 | 
				
			||||||
 | 
					    super
 | 
				
			||||||
 | 
					    reset_session
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,12 @@
 | 
				
			||||||
 | 
					class Session
 | 
				
			||||||
 | 
					  include Mongoid::Document
 | 
				
			||||||
 | 
					  include Mongoid::Timestamps
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					  def self.sweep(time = 1.hour)
 | 
				
			||||||
 | 
					    if time.is_a?(String)
 | 
				
			||||||
 | 
					      time = time.split.inject { |count, unit| count.to_i.send(unit) }
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
 | 
					    delete_all "updated_at < '#{time.ago.to_s(:db)}' OR created_at < '#{2.days.ago.to_s(:db)}'"
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
| 
						 | 
					@ -1,4 +1,4 @@
 | 
				
			||||||
# This file is used by Rack-based servers to start the application.
 | 
					# This file is used by Rack-based servers to start the application.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
require ::File.expand_path('../config/environment',  __FILE__)
 | 
					require ::File.expand_path('../config/environment',  __FILE__)
 | 
				
			||||||
run PrototypeR4::Application
 | 
					run Orbit::Application
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -13,12 +13,13 @@ require 'sprockets/railtie'
 | 
				
			||||||
# or test environments.
 | 
					# or test environments.
 | 
				
			||||||
Bundler.require *Rails.groups(:assets) if defined?(Bundler)
 | 
					Bundler.require *Rails.groups(:assets) if defined?(Bundler)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
module PrototypeR4
 | 
					module Orbit
 | 
				
			||||||
  class Application < Rails::Application
 | 
					  class Application < Rails::Application
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Add directories for plugins
 | 
					    # Add directories for plugins
 | 
				
			||||||
    config.paths["vendor/plugins"] += %W(#{config.root}/vendor/built_in_modules)
 | 
					    config.paths["vendor/plugins"] += %W(#{config.root}/vendor/built_in_modules)
 | 
				
			||||||
    config.paths["vendor/plugins"] += %W(#{config.root}/vendor/downloaded_modules)
 | 
					    config.paths["vendor/plugins"] += %W(#{config.root}/vendor/downloaded_modules)
 | 
				
			||||||
 | 
					    config.paths.app.views << "app/views/devise"
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    # Settings in config/environments/* take precedence over those specified here.
 | 
					    # Settings in config/environments/* take precedence over those specified here.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -4,4 +4,4 @@ require 'yaml'
 | 
				
			||||||
YAML::ENGINE.yamler = 'syck'
 | 
					YAML::ENGINE.yamler = 'syck'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Initialize the rails application
 | 
					# Initialize the rails application
 | 
				
			||||||
PrototypeR4::Application.initialize!
 | 
					Orbit::Application.initialize!
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,4 +1,4 @@
 | 
				
			||||||
PrototypeR4::Application.configure do
 | 
					Orbit::Application.configure do
 | 
				
			||||||
  # Settings specified here will take precedence over those in config/application.rb
 | 
					  # Settings specified here will take precedence over those in config/application.rb
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  # In the development environment your application's code is reloaded on
 | 
					  # In the development environment your application's code is reloaded on
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,4 +1,4 @@
 | 
				
			||||||
PrototypeR4::Application.configure do
 | 
					Orbit::Application.configure do
 | 
				
			||||||
  # Settings specified here will take precedence over those in config/application.rb
 | 
					  # Settings specified here will take precedence over those in config/application.rb
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  # The production environment is meant for finished, "live" apps.
 | 
					  # The production environment is meant for finished, "live" apps.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,4 +1,4 @@
 | 
				
			||||||
PrototypeR4::Application.configure do
 | 
					Orbit::Application.configure do
 | 
				
			||||||
  # Settings specified here will take precedence over those in config/application.rb
 | 
					  # Settings specified here will take precedence over those in config/application.rb
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  # The test environment is used exclusively to run your application's
 | 
					  # The test environment is used exclusively to run your application's
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -4,4 +4,4 @@
 | 
				
			||||||
# If you change this key, all old signed cookies will become invalid!
 | 
					# If you change this key, all old signed cookies will become invalid!
 | 
				
			||||||
# Make sure the secret is at least 30 characters and all random, 
 | 
					# Make sure the secret is at least 30 characters and all random, 
 | 
				
			||||||
# no regular words or you'll be exposed to dictionary attacks.
 | 
					# no regular words or you'll be exposed to dictionary attacks.
 | 
				
			||||||
PrototypeR4::Application.config.secret_token =  'cbf6409102b30cb9f4da455ee08c3a7e9d8b2a3d32a0e5b59a354dad03f469d363a8127ef4b7bc3b1afa632d7cf947a1e59e09022d2d4cd8df1f4fa521d7ec07'
 | 
					Orbit::Application.config.secret_token =  'cbf6409102b30cb9f4da455ee08c3a7e9d8b2a3d32a0e5b59a354dad03f469d363a8127ef4b7bc3b1afa632d7cf947a1e59e09022d2d4cd8df1f4fa521d7ec07'
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -4,4 +4,4 @@
 | 
				
			||||||
# If you change this key, all old signed cookies will become invalid!
 | 
					# If you change this key, all old signed cookies will become invalid!
 | 
				
			||||||
# Make sure the secret is at least 30 characters and all random,
 | 
					# Make sure the secret is at least 30 characters and all random,
 | 
				
			||||||
# no regular words or you'll be exposed to dictionary attacks.
 | 
					# no regular words or you'll be exposed to dictionary attacks.
 | 
				
			||||||
PrototypeR4::Application.config.secret_token = 'b8d78ecaf3086ebfc1ba42e912acba60d85cf3d789d933e117770e1a045a12911f121ff012a234982abb446c8b8c768052eea4bf8b2d5d336be821e2c25d8cdb'
 | 
					Orbit::Application.config.secret_token = 'b8d78ecaf3086ebfc1ba42e912acba60d85cf3d789d933e117770e1a045a12911f121ff012a234982abb446c8b8c768052eea4bf8b2d5d336be821e2c25d8cdb'
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,8 +1,3 @@
 | 
				
			||||||
# Be sure to restart your server when you modify this file.
 | 
					# Be sure to restart your server when you modify this file.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
PrototypeR4::Application.config.session_store :cookie_store, :key => '_prototype_R4_session'
 | 
					Orbit::Application.config.session_store :mongoid_store
 | 
				
			||||||
 | 
					 | 
				
			||||||
# Use the database for sessions instead of the cookie-based default,
 | 
					 | 
				
			||||||
# which shouldn't be used to store highly confidential information
 | 
					 | 
				
			||||||
# (create the session table with "rails generate session_migration")
 | 
					 | 
				
			||||||
# PrototypeR4::Application.config.session_store :active_record_store
 | 
					 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,4 +1,4 @@
 | 
				
			||||||
PrototypeR4::Application.routes.draw do
 | 
					Orbit::Application.routes.draw do
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  devise_for :users
 | 
					  devise_for :users
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -3,7 +3,7 @@
 | 
				
			||||||
#       # Add a load path for this specific Engine
 | 
					#       # Add a load path for this specific Engine
 | 
				
			||||||
#       # config.autoload_paths << File.expand_path("../lib/some/path", __FILE__)
 | 
					#       # config.autoload_paths << File.expand_path("../lib/some/path", __FILE__)
 | 
				
			||||||
#       put "ABC"
 | 
					#       put "ABC"
 | 
				
			||||||
#       PrototypeR4::Application::Orbit_Apps << "NewBlog"
 | 
					#       Orbit::Application::Orbit_Apps << "NewBlog"
 | 
				
			||||||
#       
 | 
					#       
 | 
				
			||||||
#       # initializer "my_engine.add_middleware" do |app|
 | 
					#       # initializer "my_engine.add_middleware" do |app|
 | 
				
			||||||
#       #   app.middleware.use MyEngine::Middleware
 | 
					#       #   app.middleware.use MyEngine::Middleware
 | 
				
			||||||
| 
						 | 
					@ -15,4 +15,4 @@ module NewBlog
 | 
				
			||||||
  VERSION = "0.0.1"
 | 
					  VERSION = "0.0.1"
 | 
				
			||||||
  MOUDLEAPP_TITLE =  "NewBlog"
 | 
					  MOUDLEAPP_TITLE =  "NewBlog"
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
# PrototypeR4::Application::Orbit_Apps << "NewBlog"
 | 
					# Orbit::Application::Orbit_Apps << "NewBlog"
 | 
				
			||||||
		Reference in New Issue