Skip to content
Browse files

beginning to update for rails 2.3.2.1

  • Loading branch information...
1 parent c4d5308 commit 081061e8f621679fe4140ea5e31473226141b195 activefx committed Mar 21, 2009
Showing with 36 additions and 1,042 deletions.
  1. +0 −3 .gitmodules
  2. +1 −1 README
  3. +0 −1 app/controllers/application_controller.rb
  4. +1 −0 config/boot.rb
  5. +9 −3 config/database.yml.sample
  6. +5 −1 config/environment.rb
  7. +9 −23 config/environments/production.rb
  8. +6 −0 config/environments/test.rb
  9. +0 −2 config/routes.rb
  10. +1 −1 vendor/plugins/auto_migrations
  11. +0 −80 vendor/plugins/exception_logger/README
  12. +0 −22 vendor/plugins/exception_logger/Rakefile
  13. +0 −48 vendor/plugins/exception_logger/assets/exception_logger.js
  14. +0 −307 vendor/plugins/exception_logger/assets/style.css
  15. +0 −14 vendor/plugins/exception_logger/generators/exception_migration/USAGE
  16. +0 −14 vendor/plugins/exception_logger/generators/exception_migration/exception_migration_generator.rb
  17. +0 −18 vendor/plugins/exception_logger/generators/exception_migration/templates/migration.rb
  18. +0 −7 vendor/plugins/exception_logger/init.rb
  19. +0 −1 vendor/plugins/exception_logger/install.rb
  20. +0 −73 vendor/plugins/exception_logger/lib/exception_loggable.rb
  21. +0 −67 vendor/plugins/exception_logger/lib/logged_exception.rb
  22. +0 −87 vendor/plugins/exception_logger/lib/logged_exceptions_controller.rb
  23. +0 −45 vendor/plugins/exception_logger/lib/logged_exceptions_helper.rb
  24. +0 −4 vendor/plugins/exception_logger/tasks/exception_logger_tasks.rake
  25. +0 −8 vendor/plugins/exception_logger/test/exception_logger_test.rb
  26. +0 −1 vendor/plugins/exception_logger/uninstall.rb
  27. +0 −55 vendor/plugins/exception_logger/views/logged_exceptions/_exceptions.rhtml
  28. +0 −8 vendor/plugins/exception_logger/views/logged_exceptions/_feed.rhtml
  29. +0 −29 vendor/plugins/exception_logger/views/logged_exceptions/_show.rhtml
  30. +0 −2 vendor/plugins/exception_logger/views/logged_exceptions/destroy.rjs
  31. +0 −2 vendor/plugins/exception_logger/views/logged_exceptions/destroy_all.rjs
  32. +0 −85 vendor/plugins/exception_logger/views/logged_exceptions/index.rhtml
  33. +0 −3 vendor/plugins/exception_logger/views/logged_exceptions/query.rjs
  34. +0 −20 vendor/plugins/exception_logger/views/logged_exceptions/query.rxml
  35. +0 −2 vendor/plugins/exception_logger/views/logged_exceptions/show.rjs
  36. +1 −1 vendor/plugins/permalink_fu
  37. +0 −1 vendor/plugins/pseudo_cursors
  38. +1 −1 vendor/plugins/restful_authentication
  39. +1 −1 vendor/plugins/will_paginate
  40. +1 −1 vendor/rails
View
3 .gitmodules
@@ -28,9 +28,6 @@
[submodule "vendor/plugins/open_id_authentication"]
path = vendor/plugins/open_id_authentication
url = git://github.com/activefx/open_id_authentication.git
-[submodule "vendor/plugins/pseudo_cursors"]
- path = vendor/plugins/pseudo_cursors
- url = git://github.com/sml/pseudo_cursors.git
[submodule "vendor/plugins/footnotes"]
path = vendor/plugins/footnotes
url = git://github.com/activefx/rails-footnotes.git
View
2 README
@@ -46,7 +46,7 @@ CURRENT FEATURES
- UI Plugins
- custom-err-msg, permalink_fu, uberkit, will_paginate
- Debug Plugins
- - exception_logger, rails-footnotes, query_analyzer, query_stats, rows_logger
+ - rails-footnotes, query_analyzer, query_stats, rows_logger
- Development and Performance Plugins
- auto_migrations, pseudo_cursors
- Testing
View
1 app/controllers/application_controller.rb
@@ -7,7 +7,6 @@ class ApplicationController < ActionController::Base
include AuthenticatedSystem
# You can move this into a different controller, if you wish. This module gives you the require_role helpers, and others.
include RoleRequirementSystem
- include ExceptionLoggable
helper :all # include all helpers, all the time
View
1 config/boot.rb
@@ -44,6 +44,7 @@ class VendorBoot < Boot
def load_initializer
require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
Rails::Initializer.run(:install_gem_spec_stubs)
+ Rails::GemDependency.add_frozen_gem_path
end
end
View
12 config/database.yml.sample
@@ -17,7 +17,9 @@
development:
adapter: mysql
encoding: utf8
- database: restful_authentication_tutorial_development
+ reconnect: true
+ database: sample_development
+ pool: 5
username: root
password:
socket: /var/run/mysqld/mysqld.sock
@@ -28,15 +30,19 @@ development:
test:
adapter: mysql
encoding: utf8
- database: restful_authentication_tutorial_test
+ reconnect: true
+ database: sample_test
+ pool: 5
username: root
password:
socket: /var/run/mysqld/mysqld.sock
production:
adapter: mysql
encoding: utf8
- database: restful_authentication_tutorial_production
+ reconnect: true
+ database: sample_production
+ pool: 5
username: root
password:
socket: /var/run/mysqld/mysqld.sock
View
6 config/environment.rb
@@ -6,7 +6,7 @@
# ENV['RAILS_ENV'] ||= 'production'
# Specifies gem version of Rails to use when vendor/rails is not present
-RAILS_GEM_VERSION = '2.1.0' unless defined? RAILS_GEM_VERSION
+RAILS_GEM_VERSION = '2.3.2' unless defined? RAILS_GEM_VERSION
# Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), 'boot')
@@ -77,6 +77,10 @@
# Activate observers that should always be running
# config.active_record.observers = :cacher, :garbage_collector
config.active_record.observers = :user_observer
+
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}')]
+ # config.i18n.default_locale = :de
end
View
32 config/environments/production.rb
@@ -4,39 +4,25 @@
# Code is not reloaded between requests
config.cache_classes = true
-# Use a different logger for distributed setups
-# config.logger = SyslogLogger.new
-
# Full error reports are disabled and caching is turned on
config.action_controller.consider_all_requests_local = false
config.action_controller.perform_caching = true
config.action_view.cache_template_loading = true
+# See everything in the log (default is :info)
+# config.log_level = :debug
+
+# Use a different logger for distributed setups
+# config.logger = SyslogLogger.new
+
# Use a different cache store in production
# config.cache_store = :mem_cache_store
# Enable serving of images, stylesheets, and javascripts from an asset server
-# config.action_controller.asset_host = "http://assets.example.com"
+# config.action_controller.asset_host = "http://assets.example.com"
# Disable delivery errors, bad email addresses will be ignored
# config.action_mailer.raise_delivery_errors = false
- config.after_initialize do
- require 'application' unless Object.const_defined?(:ApplicationController)
- LoggedExceptionsController.class_eval do
- # set the same session key as the app
- session :session_key => APP_CONFIG['settings']['session_key']
-
- # include any custom auth modules you need
- include AuthenticatedSystem
- include RoleRequirementSystem
-
- before_filter :login_required
- require_role :admin
-
- # optional, sets the application name for the rss feeds
- self.application_name = APP_CONFIG['settings']['name']
-
- end
- end
-
+# Enable threaded mode
+# config.threadsafe!
View
6 config/environments/test.rb
@@ -12,6 +12,7 @@
# Show full error reports and disable caching
config.action_controller.consider_all_requests_local = true
config.action_controller.perform_caching = false
+config.action_view.cache_template_loading = true
# Disable request forgery protection in test environment
config.action_controller.allow_forgery_protection = false
@@ -20,3 +21,8 @@
# The :test delivery method accumulates sent emails in the
# ActionMailer::Base.deliveries array.
config.action_mailer.delivery_method = :test
+
+# Use SQL instead of Active Record's schema dumper when creating the test database.
+# This is necessary if your schema can't be completely dumped by the schema dumper,
+# like if you have constraints or database-specific column types
+# config.active_record.schema_format = :sql
View
2 config/routes.rb
@@ -73,8 +73,6 @@
# See how all your routes lay out with "rake routes"
- map.logged_exceptions "logged_exceptions/:action/:id", :controller => "logged_exceptions"
-
# Install the default routes as the lowest priority.
#map.connect ':controller/:action/:id'
#map.connect ':controller/:action/:id.:format'
2 vendor/plugins/auto_migrations
@@ -1 +1 @@
-Subproject commit 6bdbdabe0c9a40b6c207a026ffb4ad5476e67dbc
+Subproject commit cb2b0f36a60c8ec8c62354e8f29109c66afb50fb
View
80 vendor/plugins/exception_logger/README
@@ -1,80 +0,0 @@
-ExceptionLogger
-===============
-
-The Exception Logger (forgive the horrible name) logs your Rails exceptions in the database and provides a funky web interface to manage them.
-
-First you need to generate the migration:
-
- ./script/generate exception_migration
-
-Next, you'll need to include the ExceptionLoggable module into ApplicationController. Once that's done you might want to modify key methods to customize the logging:
-
- render_404(exception) - Shows the 404 template.
-
- render_500(exception) - Shows the 500 template.
-
- log_exception(exception) - Logs the actual exception in the database.
-
- rescue_action_in_public(exception) - Does not log these exceptions: ActiveRecord::RecordNotFound, ActionController::UnknownController, ActionController::UnknownAction
-
-Now add a new route to your routes.rb:
-
- map.connect "logged_exceptions/:action/:id", :controller => "logged_exceptions"
-
-After that, visit /logged_exceptions in your application to manage the exceptions.
-
-Once you have done that, open up the vendor/plugins/init.rb file and choose your pagination,
-supported options are will_paginate, paginating_find, and simple mysql based pagination (Uses LIMIT)
-The current default is none. To use the other options you need to uncomment the $PAGINATION_TYPE line
-and the require for that pagination, you should comment out what you won't use etc...
-
-It's understandable that you may want to require authentication. Add this to your config/environments/production.rb:
-
- # config/environments/production.rb
- config.after_initialize do
- require 'application' unless Object.const_defined?(:ApplicationController)
- LoggedExceptionsController.class_eval do
- # set the same session key as the app
- session :session_key => '_beast_session_id'
-
- # include any custom auth modules you need
- include AuthenticationSystem
-
- before_filter :login_required
-
- # optional, sets the application name for the rss feeds
- self.application_name = "Beast"
-
- protected
- # only allow admins
- # this obviously depends on how your auth system works
- def authorized?
- current_user.is_a?(Admin)
- end
-
- # assume app's login required doesn't use http basic
- def login_required_with_basic
- respond_to do |accepts|
- # alias_method_chain will alias the app's login_required to login_required_without_basic
- accepts.html { login_required_without_basic }
-
- # access_denied_with_basic_auth is defined in LoggedExceptionsController
- # get_auth_data returns back the user/password pair
- accepts.rss do
- access_denied_with_basic_auth unless self.current_user = User.authenticate(*get_auth_data)
- end
- end
- end
-
- alias_method_chain :login_required, :basic
- end
- end
-
-The exact code of course depends on the specific needs of your application.
-
-CREDITS
-
-Jamis Buck - original exception_notification plugin
-Rick Olson - model/controller code
-Josh Goebel - design
-Jason Knight - Pagination support, built on/inspired by Ryanb's willpaginate support.
View
22 vendor/plugins/exception_logger/Rakefile
@@ -1,22 +0,0 @@
-require 'rake'
-require 'rake/testtask'
-require 'rake/rdoctask'
-
-desc 'Default: run unit tests.'
-task :default => :test
-
-desc 'Test the exception_logger plugin.'
-Rake::TestTask.new(:test) do |t|
- t.libs << 'lib'
- t.pattern = 'test/**/*_test.rb'
- t.verbose = true
-end
-
-desc 'Generate documentation for the exception_logger plugin.'
-Rake::RDocTask.new(:rdoc) do |rdoc|
- rdoc.rdoc_dir = 'rdoc'
- rdoc.title = 'ExceptionLogger'
- rdoc.options << '--line-numbers' << '--inline-source'
- rdoc.rdoc_files.include('README')
- rdoc.rdoc_files.include('lib/**/*.rb')
-end
View
48 vendor/plugins/exception_logger/assets/exception_logger.js
@@ -1,48 +0,0 @@
-ExceptionLogger = {
- filters: ['exception_names', 'controller_actions', 'date_ranges'],
- setPage: function(num) {
- $('page').value = num;
- $('query-form').onsubmit();
- },
-
- setFilter: function(context, name) {
- var filterName = context + '_filter'
- $(filterName).value = ($F(filterName) == name) ? '' : name;
- this.deselect(context, filterName);
- $('page').value = '1';
- $('query-form').onsubmit();
- },
-
- deselect: function(context, filterName) {
- $$('#' + context + ' a').each(function(a) {
- var value = $(filterName) ? $F(filterName) : null;
- a.className = (value && (a.getAttribute('title') == value || a.innerHTML == value)) ? 'selected' : '';
- });
- },
-
- deleteAll: function() {
- return Form.serialize('query-form') + '&' + $$('tr.exception').collect(function(tr) { return tr.getAttribute('id').gsub(/^\w+-/, ''); }).toQueryString('ids');
- }
-}
-
-Event.observe(window, 'load', function() {
- ExceptionLogger.filters.each(function(context) {
- $(context + '_filter').value = '';
- });
-});
-
-Object.extend(Array.prototype, {
- toQueryString: function(name) {
- return this.collect(function(item) { return name + "[]=" + encodeURIComponent(item) }).join('&');
- }
-});
-
-Ajax.Responders.register({
- onCreate: function() {
- if($('activity') && Ajax.activeRequestCount > 0) $('activity').visualEffect('appear', {duration:0.25});
- },
-
- onComplete: function() {
- if($('activity') && Ajax.activeRequestCount == 0) $('activity').visualEffect('fade', {duration:0.25});
- }
-});
View
307 vendor/plugins/exception_logger/assets/style.css
@@ -1,307 +0,0 @@
-body
-{
- margin:0;
- padding:0;
- background:#000;
- font-family:'Lucida Grande', Arial, Helvetica, sans-serif;
- font-size:1.0em;
- color:white;
-}
-
-#container
-{
- xwidth:95%;
- margin:0 auto;
- min-width:800px;
-}
-
-#left
-{
- xfloat:left;
- xwidth:76%;
- margin-right:235px;
-
-}
-
-#left .page
-{
- font-size:0.9em;
- background:white;
- border:2px solid #999;
- border-width:0 2px 2px 0;
- padding:25px;
- xmargin-bottom:1em;
- color:black;
-}
-
-#right
-{
- margin-top:1em;
- float:right;
- xwidth:22%;
- font-size:0.9em;
- width:200px;
- margin-right:1.25em;
-}
-
-#right hr
-{
- border:0;
- border-top:1px solid #222;
-}
-
-#search
-{
- margin-top:2em;
- background:#111;
- padding:10px 5px;
- border:1px solid #222;
- border-width:1px 0;
-}
-
-
-ul.filters
-{
- list-style-type:none;
- padding:0;
- margin:0;
- font-size:0.9em;
-}
-ul.filters li { margin-bottom:0.2em;}
-
-
-ul.filters a,
-ul.filters a:visited {
- display:block;
- padding:1px 7px;
- color:#fff;
- xbackground-color:#fff;
- text-decoration:none;
-}
-
-ul.filters a:hover
-{
- background:#666;
- color:white;
-}
-
-ul.filters a.selected,
-ul.filters a.selected:visited,
-ul.filters a:active {
- color:gold;
- background-color:#333;
- text-decoration:none;
- font-weight:bold;
-}
-
-
-onclick a:hover
-{
- color:#fff;
- text-decoration:none;
-}
-
-#exceptions table
-{
- width:99%;
- border-collapse:collapse;
-}
-
-td
-{
- padding:5px 10px;
- xborder:1px solid #ddd;
-}
-
-#backtrace
-{
- overflow:auto;
- font-family:"Bitstream Vera Sans Mono", "Monaco", "Courier", monospace;;
- font-size:0.85em;
- margin-top:0.25em;
-}
-
-h2
-{
- background-color:#ddd;
- font-size:0.8em;
- padding:3px 10px;
-}
-
-form {margin:0;}
-
-h3 {
- font-size:0.8em;
- color:#ddd;
- background:#222;
- padding:3px 7px;
-}
-
-div.date
-{
- color:#666;
- font-size:0.8em;
-}
-
-h1
-{
- margin-top:0.25em;
- font-size:1.25em;
- padding-bottom:5px;
- border-bottom:2px solid #ddd;
-}
-
-h1 span
-{
- color:#aaa;
- font-weight:normal;
-}
-
-a
-{
- color:#369;
- text-decoration:none;
-}
-a:hover
-{
- color:blue;
- text-decoration:underline;
-}
-
-th
-{
- text-align:left;
- xbackground:#333;
- xcolor:gold;
- font-size:0.75em;
- padding:2px 10px;
-}
-
-tr { xcursor:pointer; }
-
-tr.eor td
-{
- background:#e7e7e7;
-
-}
-
-/*
-tr:hover td,
-tr.eor:hover td
-{
- background:#333;
- color:white;
-}
-tr:hover td a,
-tr.eor:hover td a { color:gold; }
-*/
-
-.message
-{
- font-size:0.8em;
-}
-
-a.util
-{
- color:#c00;
- font-size:0.7em;
-}
-
-.pipe
-{
- font-size:0.75em;
- color:#999;
-}
-
-.tools { float:right; }
-
-.time
-{
- color:#666;
- font-size:0.75em;
- xvertical-align:top;
-}
-
-
-.expclass
-{
- xcolor:#999;
-}
-.expclass a
-{
- font-size:0.9em;
-}
-
-tr.deleted td {
- color:#aaa;
- text-decoration: line-through;
-}
-tr.deleted td a { color:#aaa; }
-
-.pages { float:right; margin-right:1em; }
-.pages a { text-decoration:underline; }
-.pages-bottom { border-top:2px solid #ddd; text-align:right; float:none;
- padding-top:0.4em;
- margin-top:0.4em;
- padding-right:1em;
- margin-right:0;
- }
-
-/* right */
-
-#right h4
-{
- font-size:0.75em;
- xbackground:#171717;
- xbackground:#333;
- color:#999;
- padding:3px 5px;
- margin-bottom:0.5em;
- font-weight:normal;
-}
-
-/* tabs */
-
-ul.tabs
-{
- list-style-type:none;
- padding:0;
- margin:1em 0;
- float:left;
-}
-ul.tabs li { float:left; display:inline; }
-ul.tabs li a
-{
- font-size:0.8em;
- padding:3px 7px;
- margin-right:1em;
- text-decoration:none;
- color:black;
-}
-
-ul.tabs li a:hover
-{
- background:#666;
- color:white;
-}
-ul.tabs li.selected a
-{
- background:black;
- color:white;
-}
-
-#activity {
- position:fixed;
- top:0; right:18px;
- width:200px;
- padding:5px 0;
- text-align:center;
- background-color:#cf1313;
- color:#fff;
- opacity:.8;
- font-size: 11px;
-}
-
-#feed {
- margin-top: 15px;
-}
View
14 vendor/plugins/exception_logger/generators/exception_migration/USAGE
@@ -1,14 +0,0 @@
-Description:
- The exception migration generator creates a migration for the logged exceptions model.
-
- The generator takes a migration name as its argument. The migration name may be
- given in CamelCase or under_score. 'add_exception_table' is the default.
-
- The generator creates a migration class in db/migrate prefixed by its number
- in the queue.
-
-Example:
- ./script/generate exception_migration add_exception_table
-
- With 4 existing migrations, this will create an AddExceptionTable migration in the
- file db/migrate/5_add_exception_table.rb
View
14 .../plugins/exception_logger/generators/exception_migration/exception_migration_generator.rb
@@ -1,14 +0,0 @@
-class ExceptionMigrationGenerator < Rails::Generator::NamedBase
- attr_reader :exception_table_name
- def initialize(runtime_args, runtime_options = {})
- @exception_table_name = (runtime_args.length < 2 ? 'logged_exceptions' : runtime_args[1]).tableize
- runtime_args << 'add_exception_table' if runtime_args.empty?
- super
- end
-
- def manifest
- record do |m|
- m.migration_template 'migration.rb', 'db/migrate'
- end
- end
-end
View
18 vendor/plugins/exception_logger/generators/exception_migration/templates/migration.rb
@@ -1,18 +0,0 @@
-class <%= class_name %> < ActiveRecord::Migration
- def self.up
- create_table "<%= exception_table_name %>", :force => true do |t|
- t.column :exception_class, :string
- t.column :controller_name, :string
- t.column :action_name, :string
- t.column :message, :text
- t.column :backtrace, :text
- t.column :environment, :text
- t.column :request, :text
- t.column :created_at, :datetime
- end
- end
-
- def self.down
- drop_table "<%= exception_table_name %>"
- end
-end
View
7 vendor/plugins/exception_logger/init.rb
@@ -1,7 +0,0 @@
- #$PAGINATION_TYPE = 'none'
- require 'will_paginate'
- $PAGINATION_TYPE = 'will_paginate'
- WillPaginate.enable
- #require 'paginating_find'
- #$PAGINATION_TYPE = 'paginating_find'
-LoggedExceptionsController.view_paths = [File.join(directory, 'views')]
View
1 vendor/plugins/exception_logger/install.rb
@@ -1 +0,0 @@
-puts IO.read(File.join(File.dirname(__FILE__), 'README'))
View
73 vendor/plugins/exception_logger/lib/exception_loggable.rb
@@ -1,73 +0,0 @@
-require 'ipaddr'
-
-# Copyright (c) 2005 Jamis Buck
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-module ExceptionLoggable
- def self.included(target)
- target.extend(ClassMethods)
- end
-
- module ClassMethods
- def consider_local(*args)
- local_addresses.concat(args.flatten.map { |a| IPAddr.new(a) })
- end
-
- def local_addresses
- addresses = read_inheritable_attribute(:local_addresses)
- unless addresses
- addresses = [IPAddr.new("127.0.0.1")]
- write_inheritable_attribute(:local_addresses, addresses)
- end
- addresses
- end
-
- def exception_data(deliverer = self, &block)
- deliverer = block if block
- if deliverer == self
- read_inheritable_attribute(:exception_data)
- else
- write_inheritable_attribute(:exception_data, deliverer)
- end
- end
- end
-
- def local_request?
- remote = IPAddr.new(request.remote_ip)
- !self.class.local_addresses.detect { |addr| addr.include?(remote) }.nil?
- end
-
- def rescue_action_in_public(exception)
- status = response_code_for_rescue(exception)
- render_optional_error_file status
- log_exception(exception) if status != :not_found
- end
-
- def log_exception(exception)
- deliverer = self.class.exception_data
- data = case deliverer
- when nil then {}
- when Symbol then send(deliverer)
- when Proc then deliverer.call(self)
- end
-
- LoggedException.create_from_exception(self, exception, data)
- end
-end
View
67 vendor/plugins/exception_logger/lib/logged_exception.rb
@@ -1,67 +0,0 @@
-class LoggedException < ActiveRecord::Base
- class << self
- def create_from_exception(controller, exception, data)
- message = exception.message.inspect
- message << "\n* Extra Data\n\n#{data}" unless data.blank?
- create! \
- :exception_class => exception.class.name,
- :controller_name => controller.controller_name,
- :action_name => controller.action_name,
- :message => message,
- :backtrace => exception.backtrace,
- :request => controller.request
- end
-
- def find_exception_class_names
- connection.select_values "SELECT DISTINCT exception_class FROM #{table_name} ORDER BY exception_class"
- end
-
- def find_exception_controllers_and_actions
- find(:all, :select => "DISTINCT controller_name, action_name", :order => "controller_name, action_name").collect(&:controller_action)
- end
-
- def host_name
- `hostname -s`.chomp
- end
- end
-
- def backtrace=(backtrace)
- backtrace = sanitize_backtrace(backtrace) * "\n" unless backtrace.is_a?(String)
- write_attribute :backtrace, backtrace
- end
-
- def request=(request)
- if request.is_a?(String)
- write_attribute :request, request
- else
- max = request.env.keys.max { |a,b| a.length <=> b.length }
- env = request.env.keys.sort.inject [] do |env, key|
- env << '* ' + ("%-*s: %s" % [max.length, key, request.env[key].to_s.strip])
- end
- write_attribute(:environment, (env << "* Process: #{$$}" << "* Server : #{self.class.host_name}") * "\n")
-
- write_attribute(:request, [
- "* URL:#{" #{request.method.to_s.upcase}" unless request.get?} #{request.protocol}#{request.env["HTTP_HOST"]}#{request.request_uri}",
- "* Format: #{request.format.to_s}",
- "* Parameters: #{request.parameters.inspect}",
- "* Rails Root: #{rails_root}"
- ] * "\n")
- end
- end
-
- def controller_action
- @controller_action ||= "#{controller_name.camelcase}/#{action_name}"
- end
-
- private
- @@rails_root = Pathname.new(RAILS_ROOT).cleanpath.to_s
- @@backtrace_regex = /^#{Regexp.escape(@@rails_root)}/
-
- def sanitize_backtrace(trace)
- trace.collect { |line| Pathname.new(line.gsub(@@backtrace_regex, "[RAILS_ROOT]")).cleanpath.to_s }
- end
-
- def rails_root
- @@rails_root
- end
-end
View
87 vendor/plugins/exception_logger/lib/logged_exceptions_controller.rb
@@ -1,87 +0,0 @@
-class LoggedExceptionsController < ActionController::Base
- cattr_accessor :application_name
- layout nil
-
- def index
- @exception_names = LoggedException.find_exception_class_names
- @controller_actions = LoggedException.find_exception_controllers_and_actions
- query
- end
-
- def query
- conditions = []
- parameters = []
- unless params[:id].blank?
- conditions << 'id = ?'
- parameters << params[:id]
- end
- unless params[:query].blank?
- conditions << 'message LIKE ?'
- parameters << "%#{params[:query]}%"
- end
- unless params[:date_ranges_filter].blank?
- conditions << 'created_at >= ?'
- parameters << params[:date_ranges_filter].to_f.days.ago.utc
- end
- unless params[:exception_names_filter].blank?
- conditions << 'exception_class = ?'
- parameters << params[:exception_names_filter]
- end
- unless params[:controller_actions_filter].blank?
- conditions << 'controller_name = ? AND action_name = ?'
- parameters += params[:controller_actions_filter].split('/').collect(&:downcase)
- end
- if $PAGINATION_TYPE == 'will_paginate' then
- @exceptions = LoggedException.paginate :order => 'created_at desc', :per_page => 30,
- :conditions => conditions.empty? ? nil : parameters.unshift(conditions * ' and '), :page => params[:page]
- elsif $PAGINATION_TYPE == 'paginating_find' then
- params[:limit] ||= 25
- params[:page] ||= 1
- @exceptions = LoggedException.find (:all,:order => 'created_at desc',:page => {:size => params[:limit], :current => params[:page]},
- :conditions => conditions.empty? ? nil : parameters.unshift(conditions * ' and '))
- else
- #we have no pagination so do basic sql pagination
- params[:limit] ||= 25
- params[:page] ||= 0
- page = params[:page]
- if params[:page].to_i >= 1 then
- page = params[:page].to_i * params[:limit].to_i
- end
- @exceptions = LoggedException.find(:all, :limit => "#{page},#{params[:limit]}", :conditions => conditions.empty? ? nil : parameters.unshift(conditions * ' and '))
- end
-
- respond_to do |format|
- format.html { redirect_to :action => 'index' unless action_name == 'index' }
- format.js { render :action => 'query.rjs' }
- format.rss { render :action => 'query.rxml' }
- end
- end
-
- def show
- @exc = LoggedException.find params[:id]
- end
-
- def destroy
- LoggedException.destroy params[:id]
- end
-
- def destroy_all
- LoggedException.delete_all ['id in (?)', params[:ids]] unless params[:ids].blank?
- query
- end
-
- private
- def access_denied_with_basic_auth
- headers["Status"] = "Unauthorized"
- headers["WWW-Authenticate"] = %(Basic realm="Web Password")
- render :text => "Could't authenticate you", :status => '401 Unauthorized'
- end
-
- @@http_auth_headers = %w(X-HTTP_AUTHORIZATION HTTP_AUTHORIZATION Authorization)
- # gets BASIC auth info
- def get_auth_data
- auth_key = @@http_auth_headers.detect { |h| request.env.has_key?(h) }
- auth_data = request.env[auth_key].to_s.split unless auth_key.blank?
- return auth_data && auth_data[0] == 'Basic' ? Base64.decode64(auth_data[1]).split(':')[0..1] : [nil, nil]
- end
-end
View
45 vendor/plugins/exception_logger/lib/logged_exceptions_helper.rb
@@ -1,45 +0,0 @@
-module LoggedExceptionsHelper
- def filtered?
- [:query, :date_ranges_filter, :exception_names_filter, :controller_actions_filter].any? { |p| params[p] }
- end
-
- def pagination_remote_links(collection)
- ret = ''
- if $PAGINATION_TYPE == 'will_paginate'
- pagination = will_paginate (collection,
- :renderer => 'LoggedExceptionsHelper::PaginationRenderer',
- :prev_label => '',
- :next_label => '',
- :container => false)
- if collection.total_pages > 1 then
- ret = ":: Pages : <strong>#{pagination}</strong>"
- end
- elsif $PAGINATION_TYPE == 'paginating_find' then
- pagination = paginating_links collection
- ret = ":: Pages : <strong>#{pagination}</strong>"
- else
- next_page = params[:page].to_i + 1
- prev_page = 0
- prev_link = ''
- if params[:page].to_i > 0 then
- prev_page = params[:page].to_i - 1
- prev_link = "<a href=\"?page=#{prev_page}\"> Previous page</a>"
- end
- next_link = "<a href=\"?page=#{next_page}\">Next page</a>"
- ret = "Pagination not available#{prev_link} - #{next_link}"
- end
- end
-
- if $PAGINATION_TYPE == 'will_paginate'
- class PaginationRenderer < WillPaginate::LinkRenderer
- def page_link_or_span(page, span_class = 'current', text = nil)
- text ||= page.to_s
- if page and page != current_page
- @template.link_to_function text, "ExceptionLogger.setPage(#{page})"
- else
- @template.content_tag :span, text, :class => span_class
- end
- end
- end
- end
-end
View
4 vendor/plugins/exception_logger/tasks/exception_logger_tasks.rake
@@ -1,4 +0,0 @@
-# desc "Explaining what the task does"
-# task :exception_logger do
-# # Task goes here
-# end
View
8 vendor/plugins/exception_logger/test/exception_logger_test.rb
@@ -1,8 +0,0 @@
-require 'test/unit'
-
-class ExceptionLoggerTest < Test::Unit::TestCase
- # Replace this with your real tests.
- def test_this_plugin
- flunk
- end
-end
View
1 vendor/plugins/exception_logger/uninstall.rb
@@ -1 +0,0 @@
-# Uninstall hook code here
View
55 vendor/plugins/exception_logger/views/logged_exceptions/_exceptions.rhtml
@@ -1,55 +0,0 @@
-<div id="exceptions">
-<div class="pages">
- <%= link_to_remote 'Delete Visible', :url => { :action => 'destroy_all' }, :with => "ExceptionLogger.deleteAll()" %>
-<%= pagination_remote_links @exceptions %>
-</div>
-
-<h1>Exceptions <%= "<span>(filtered)</span>" if filtered? %> </h1>
-
-<table cellspacing="0">
-
- <thead style="display:none;">
- <tr>
- <th>Exception</th>
- <th>Date</th>
- </tr>
- </thead>
-
- <tbody>
- <% exceptions.each do |exc| -%>
- <tr id="exception-<%= exc.id %>" class="<%= cycle("eor", "") %> exception">
- <td>
-<div class="expclass">
-
-<%= link_to_remote "#{exc.exception_class} in #{exc.controller_action}", :url => { :action => 'show', :id => exc } %></div>
-<span class="message"><%=h exc.message %></span>
-
-</td>
- <td nowrap=nowrap class="time">
-<%
-if Date.today == exc.created_at.to_date
- if exc.created_at > Time.now - 4.hours
- %>
- <%= time_ago_in_words(exc.created_at).gsub(/about /,"~ ") %> ago
- <% else %>
- Today, <%= exc.created_at.strftime("%l:%M %p") %>
- <% end %>
-<% else %>
-<%= exc.created_at.strftime("%b %d, %Y") %>
-<% end %>
-</td>
- <td><%= link_to_remote 'Delete', {:url => { :action => 'destroy', :id => exc }} , :class => "util" %></td>
-
- </tr>
- <% end -%>
- </tbody>
-
-</table>
-
-<div class="pages pages-bottom">
-<%= pagination_remote_links @exceptions %>
-</div>
-
-
-
-</div> <!-- #exceptions -->
View
8 vendor/plugins/exception_logger/views/logged_exceptions/_feed.rhtml
@@ -1,8 +0,0 @@
-<%
- feed_params = [:id, :query, :date_ranges_filter, :exception_names_filter, :controller_actions_filter].inject({:format => 'rss'}) do |p, key|
- params[key].blank? ? p : p.update(key => params[key])
- end
--%>
-<ul id="feed" class="filters">
- <li><%= link_to 'Rss Feed', feed_params %></li>
-</ul>
View
29 vendor/plugins/exception_logger/views/logged_exceptions/_show.rhtml
@@ -1,29 +0,0 @@
-<div class="tools">
-<%= link_to_remote 'Delete', {:url => { :action => 'destroy', :id => @exc }} , :class => "util" %>
-<span class="pipe">|</span>
-<%= link_to_function "Close", "$('showpage').style.display='none';", :class => "util" %>
-
-</div>
-
-<div class="date">
- <%= @exc.created_at.strftime("%A, %b %d, %Y at %l:%M %p") %>
-</div>
-<h1>
-<%= @exc.exception_class %> in <%= @exc.controller_name.camelcase %>/<%= @exc.action_name %>
-</h1>
-
-<h2>Request</h2>
-
-<%= textilize(@exc.request) %>
-
-<h2>Backtrace</h2>
-
-<%= simple_format @exc.message %>
-
-<div id="backtrace">
-<%=h(@exc.backtrace).gsub(/\n/,"<br />") %>
-</div>
-
-<h2>Environment</h2>
-
-<%= textilize(@exc.environment) %>
View
2 vendor/plugins/exception_logger/views/logged_exceptions/destroy.rjs
@@ -1,2 +0,0 @@
-page["exception-#{params[:id]}"].addClassName('deleted')
-page[:showpage].hide
View
2 vendor/plugins/exception_logger/views/logged_exceptions/destroy_all.rjs
@@ -1,2 +0,0 @@
-page[:exceptions].replace :partial => "exceptions"
-page[:showpage].hide
View
85 vendor/plugins/exception_logger/views/logged_exceptions/index.rhtml
@@ -1,85 +0,0 @@
-<!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>
- <title>Logged Exceptions</title>
- <meta http-equiv="content-type" content="text/html; charset=utf-8" />
- <%= javascript_include_tag 'prototype','effects' %>
- <script type="text/javascript">
-<%= IO.read(File.join(RAILS_ROOT, 'vendor/plugins/exception_logger/assets/exception_logger.js')) %>
- </script>
- <style type="text/css">
-<%= IO.read(File.join(RAILS_ROOT, 'vendor/plugins/exception_logger/assets/style.css')) %>
- </style>
-</head>
-<body>
-<div id="container">
-
-
-<div id="right">
-
-<h3>Filters</h3>
-
-<ul id="all_exceptions" class="filters">
- <li><%= link_to 'Latest Exceptions', :action => 'index', :id => nil %></li>
-</ul>
-
-<h4>Exception</h4>
-
-<ul id="exception_names" class="filters">
-<% @exception_names.each do |name| -%>
- <li><%= link_to_function name, "ExceptionLogger.setFilter('exception_names','#{escape_javascript name}')" %></li>
-<% end -%>
-</ul>
-
-<h4>Controller / Action</h4>
-
-<ul id="controller_actions" class="filters">
-<% @controller_actions.each do |action| -%>
- <li><%= link_to_function action, "ExceptionLogger.setFilter('controller_actions','#{escape_javascript action}')" %></li>
-<% end -%>
-</ul>
-
-<h4>Dates</h4>
-
-<ul id="date_ranges" class="filters">
- <li><a title="1" onclick="ExceptionLogger.setFilter('date_ranges', 1)">Today</a></li>
- <li><a title="3" onclick="ExceptionLogger.setFilter('date_ranges', 3)">Last few days</a></li>
- <li><a title="7" onclick="ExceptionLogger.setFilter('date_ranges', 7)">Last 7 days</a></li>
- <li><a title="30" onclick="ExceptionLogger.setFilter('date_ranges', 30)">Last 30 days</a></li>
-</ul>
-
-
-<div id="search">
- <%= form_remote_tag :url => { :action => 'query' }, :html => { :id => 'query-form' } %>
- <div>
-
- <%= text_field_tag :query, "", :size => 17 %>
- <%= submit_tag :Find %>
-
- <%= hidden_field_tag :exception_names_filter %>
- <%= hidden_field_tag :date_ranges_filter %>
- <%= hidden_field_tag :controller_actions_filter %>
- <%= hidden_field_tag :page, (params[:page] || 1) %>
- </div>
- </form>
-</div>
-
-<%= render :partial => 'feed' %>
-
-</div> <!-- right -->
-
-<div id="left">
- <div class="page" id="showpage" style="display:none; margin-bottom:1em;">
-
- </div>
- <div class="page">
- <%= render :partial => "exceptions" %>
- </div>
-</div>
-
- <div id="activity" style="display:none">Busy...</div>
-
-</div> <!-- container -->
-<xbr style="clear:both" />
-</body>
-</html>
View
3 vendor/plugins/exception_logger/views/logged_exceptions/query.rjs
@@ -1,3 +0,0 @@
-page[:exceptions].replace :partial => "exceptions"
-page[:showpage].hide
-page[:feed].replace :partial => 'feed'
View
20 vendor/plugins/exception_logger/views/logged_exceptions/query.rxml
@@ -1,20 +0,0 @@
-xml.instruct! :xml, :version=>"1.0", :encoding=>"UTF-8"
-
-xml.rss "version" => "2.0" do
- xml.channel do
- xml.title "Recent Exceptions#{%( (filtered)) if filtered?} | #{LoggedExceptionsController.application_name}"
- xml.link url_for(:only_path => false, :skip_relative_url_root => false)
- xml.language "en-us"
- xml.ttl "60"
-
- @exceptions.each do |exc|
- xml.item do
- xml.title "#{exc.exception_class} in #{exc.controller_action} @ #{exc.created_at.rfc822}"
- xml.description exc.message
- xml.pubDate exc.created_at.rfc822
- xml.guid [request.host_with_port, 'exceptions', exc.id.to_s].join(":"), "isPermaLink" => "false"
- xml.link url_for(:action => 'index', :id => exc, :only_path => false, :skip_relative_url_root => false)
- end
- end
- end
-end
View
2 vendor/plugins/exception_logger/views/logged_exceptions/show.rjs
@@ -1,2 +0,0 @@
-page[:showpage].replace_html :partial => "show"
-page[:showpage].visual_effect :blind_down, :duration => 0.25
2 vendor/plugins/permalink_fu
@@ -1 +1 @@
-Subproject commit c2457a9678948c1b714b1a63b8d0ef318eb75ba7
+Subproject commit 62e06d75334490503d6b3d6d06d51ebaf286b62a
1 vendor/plugins/pseudo_cursors
@@ -1 +0,0 @@
-Subproject commit 239b0c0d872ddc1cb50fb8a8d1c43135b2fd2dd0
2 vendor/plugins/restful_authentication
@@ -1 +1 @@
-Subproject commit 61cd9b377c0b481384f123dc628a2f8cc5ea5fdf
+Subproject commit 2ae4c22f5a42100458f8be89c9f366b4099a4451
2 vendor/plugins/will_paginate
@@ -1 +1 @@
-Subproject commit df42582bde7c6c8ea2fd08ed532876909fb06500
+Subproject commit 8888651be8d6656bdf2378731d91a8badbaa2556
2 vendor/rails
@@ -1 +1 @@
-Subproject commit b1c989f28dd1d619f0e3e3ca1b894b686e517f2f
+Subproject commit dc88847e5ce392eed210b97525c14fca55852867

0 comments on commit 081061e

Please sign in to comment.
Something went wrong with that request. Please try again.