Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Updated webistrano from Rails 2.3.5 to 2.3.11 #22

Merged
merged 9 commits into from May 12, 2011
View
@@ -0,0 +1,3 @@
+[submodule "vendor/plugins/exception_notification"]
+ path = vendor/plugins/exception_notification
+ url = git://github.com/smartinez87/exception_notification.git
@@ -1,6 +1,6 @@
class ApplicationController < ActionController::Base
include BrowserFilters
- include ExceptionNotifiable
+ include ExceptionNotification::Notifiable
include AuthenticatedSystem
before_filter CASClient::Frameworks::Rails::Filter if WebistranoConfig[:authentication_method] == :cas
@@ -12,8 +12,8 @@ def display_deployment_problems(stage)
# returns the escaped format of a config value
def capfile_cast(val)
casted_val = Webistrano::Deployer.type_cast(val).class
-
- if casted_val == String
+
+ if casted_val == String || casted_val == ActiveSupport::SafeBuffer
val.inspect
elsif casted_val == Symbol
val.to_s
View
@@ -133,7 +133,7 @@ def deploy_in_background!
# returns an unsaved, new deployment with the same task/stage/description
def repeat
- returning Deployment.new do |d|
+ Deployment.new.tap do |d|
d.stage = self.stage
d.task = self.task
d.description = "Repetition of deployment #{self.id}: \n"
View
@@ -5,7 +5,7 @@
# ENV['RAILS_ENV'] ||= 'production'
# Specifies gem version of Rails to use when vendor/rails is not present
-RAILS_GEM_VERSION = '2.3.5' unless defined? RAILS_GEM_VERSION
+RAILS_GEM_VERSION = '2.3.11' unless defined? RAILS_GEM_VERSION
# Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), 'boot')
@@ -20,8 +20,8 @@
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attacks.
config.action_controller.session = {
- :session_key => '_webistrano_session',
- :secret => WebistranoConfig[:session_secret]
+ :key => '_webistrano_session',
+ :secret => WebistranoConfig[:session_secret]
}
# Make Active Record use UTC-base instead of local time
@@ -10,5 +10,5 @@
Notification.webistrano_sender_address = WebistranoConfig[:webistrano_sender_address]
-ExceptionNotifier.exception_recipients = WebistranoConfig[:exception_recipients]
-ExceptionNotifier.sender_address = WebistranoConfig[:exception_sender_address]
+ExceptionNotification::Notifier.exception_recipients = WebistranoConfig[:exception_recipients]
+ExceptionNotification::Notifier.sender_address = WebistranoConfig[:exception_sender_address]
View
@@ -1,3 +1,3 @@
#!/usr/bin/env ruby
-require File.dirname(__FILE__) + '/../config/boot'
+require File.expand_path('../../config/boot', __FILE__)
require 'commands/about'
View
@@ -1,3 +1,3 @@
#!/usr/bin/env ruby
-require File.dirname(__FILE__) + '/../config/boot'
+require File.expand_path('../../config/boot', __FILE__)
require 'commands/breakpointer'
View
@@ -1,3 +1,3 @@
#!/usr/bin/env ruby
-require File.dirname(__FILE__) + '/../config/boot'
+require File.expand_path('../../config/boot', __FILE__)
require 'commands/console'
View
@@ -1,3 +1,3 @@
#!/usr/bin/env ruby
-require File.dirname(__FILE__) + '/../config/boot'
+require File.expand_path('../../config/boot', __FILE__)
require 'commands/dbconsole'
View
@@ -1,3 +1,3 @@
#!/usr/bin/env ruby
-require File.dirname(__FILE__) + '/../config/boot'
+require File.expand_path('../../config/boot', __FILE__)
require 'commands/destroy'
View
@@ -1,3 +1,3 @@
#!/usr/bin/env ruby
-require File.dirname(__FILE__) + '/../config/boot'
+require File.expand_path('../../config/boot', __FILE__)
require 'commands/generate'
View
@@ -1,3 +1,3 @@
#!/usr/bin/env ruby
-require File.dirname(__FILE__) + '/../config/boot'
+require File.expand_path('../../config/boot', __FILE__)
require 'commands/plugin'
View
@@ -1,3 +1,3 @@
#!/usr/bin/env ruby
-require File.dirname(__FILE__) + '/../config/boot'
+require File.expand_path('../../config/boot', __FILE__)
require 'commands/runner'
View
@@ -1,3 +1,3 @@
#!/usr/bin/env ruby
-require File.dirname(__FILE__) + '/../config/boot'
+require File.expand_path('../../config/boot', __FILE__)
require 'commands/server'
@@ -1 +0,0 @@
-require "action_mailer"
@@ -1,99 +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 ExceptionNotifiable
- 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)
- if deliverer == self
- read_inheritable_attribute(:exception_data)
- else
- write_inheritable_attribute(:exception_data, deliverer)
- end
- end
- end
-
- private
-
- def local_request?
- remote = IPAddr.new(request.remote_ip)
- !self.class.local_addresses.detect { |addr| addr.include?(remote) }.nil?
- end
-
- def render_404
- respond_to do |type|
- type.html { render :file => "#{RAILS_ROOT}/public/404.html", :status => "404 Not Found" }
- type.all { render :nothing => true, :status => "404 Not Found" }
- end
- end
-
- def render_500
- respond_to do |type|
- type.html { render :file => "#{RAILS_ROOT}/public/500.html", :status => "500 Error" }
- type.all { render :nothing => true, :status => "500 Error" }
- end
- end
-
- def rescue_action_in_public(exception)
- case exception
- when *exceptions_to_treat_as_404
- render_404
-
- else
- render_500
-
- deliverer = self.class.exception_data
- data = case deliverer
- when nil then {}
- when Symbol then send(deliverer)
- when Proc then deliverer.call(self)
- end
-
- ExceptionNotifier.deliver_exception_notification(exception, self,
- request, data)
- end
- end
-
- def exceptions_to_treat_as_404
- exceptions = [ActiveRecord::RecordNotFound,
- ActionController::UnknownController,
- ActionController::UnknownAction]
- exceptions << ActionController::RoutingError if ActionController.const_defined?(:RoutingError)
- exceptions
- end
-end
@@ -1,67 +0,0 @@
-require 'pathname'
-
-# 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.
-class ExceptionNotifier < ActionMailer::Base
- @@sender_address = %("Exception Notifier" <exception.notifier@default.com>)
- cattr_accessor :sender_address
-
- @@exception_recipients = []
- cattr_accessor :exception_recipients
-
- @@email_prefix = "[ERROR] "
- cattr_accessor :email_prefix
-
- @@sections = %w(request session environment backtrace)
- cattr_accessor :sections
-
- def self.reloadable?; false; end
-
- def exception_notification(exception, controller, request, data={})
- subject "#{email_prefix}#{controller.controller_name}##{controller.action_name} (#{exception.class}) #{exception.message.inspect}"
-
- recipients exception_recipients
- from sender_address
-
- body data.merge({ :controller => controller, :request => request,
- :exception => exception, :host => request.env["HTTP_HOST"],
- :backtrace => sanitize_backtrace(exception.backtrace),
- :rails_root => rails_root, :data => data,
- :sections => sections })
- end
-
- def template_root
- "#{File.dirname(__FILE__)}/../views"
- end
-
- private
-
- def sanitize_backtrace(trace)
- re = Regexp.new(/^#{Regexp.escape(rails_root)}/)
- trace.map { |line| Pathname.new(line.gsub(re, "[RAILS_ROOT]")).cleanpath.to_s }
- end
-
- def rails_root
- return @rails_root if @rails_root
- @rails_root = Pathname.new(RAILS_ROOT).cleanpath.to_s
- end
-
-end
@@ -1,63 +0,0 @@
-require 'pp'
-
-# 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 ExceptionNotifierHelper
- VIEW_PATH = "views/exception_notifier"
- APP_PATH = "#{RAILS_ROOT}/app/#{VIEW_PATH}"
-
- def render_section(section)
- RAILS_DEFAULT_LOGGER.info("rendering section #{section.inspect}")
- summary = render_overridable(section).strip
- unless summary.blank?
- title = render_overridable(:title, :locals => { :title => section }).strip
- "#{title}\n\n#{summary.gsub(/^/, " ")}\n\n"
- end
- end
-
- def render_overridable(partial, options={})
- if File.exist?(path = "#{APP_PATH}/_#{partial}.rhtml")
- render(options.merge(:file => path, :use_full_path => false))
- elsif File.exist?(path = "#{File.dirname(__FILE__)}/../#{VIEW_PATH}/_#{partial}.rhtml")
- render(options.merge(:file => path, :use_full_path => false))
- else
- ""
- end
- end
-
- def inspect_model_object(model, locals={})
- render_overridable(:inspect_model,
- :locals => { :inspect_model => model,
- :show_instance_variables => true,
- :show_attributes => true }.merge(locals))
- end
-
- def inspect_value(value)
- len = 512
- result = object_to_yaml(value).gsub(/\n/, "\n ").strip
- result = result[0,len] + "... (#{result.length-len} bytes more)" if result.length > len+20
- result
- end
-
- def object_to_yaml(object)
- object.to_yaml.sub(/^---\s*/m, "")
- end
-end
@@ -1 +0,0 @@
-<%= @backtrace.join "\n" %>
@@ -1,7 +0,0 @@
-<% max = @request.env.keys.max { |a,b| a.length <=> b.length } -%>
-<% @request.env.keys.sort.each do |key| -%>
-* <%= "%*-s: %s" % [max.length, key, @request.env[key].to_s.strip] %>
-<% end -%>
-
-* Process: <%= $$ %>
-* Server : <%= `hostname -s`.chomp %>
@@ -1,16 +0,0 @@
-<% if show_attributes -%>
-[attributes]
-<% attrs = inspect_model.attributes -%>
-<% max = attrs.keys.max { |a,b| a.length <=> b.length } -%>
-<% attrs.keys.sort.each do |attr| -%>
-* <%= "%*-s: %s" % [max.length, attr, object_to_yaml(attrs[attr]).gsub(/\n/, "\n ").strip] %>
-<% end -%>
-<% end -%>
-
-<% if show_instance_variables -%>
-[instance variables]
-<% inspect_model.instance_variables.sort.each do |variable| -%>
-<%- next if variable == "@attributes" -%>
-* <%= variable %>: <%= inspect_value(inspect_model.instance_variable_get(variable)) %>
-<% end -%>
-<% end -%>
@@ -1,3 +0,0 @@
-* URL: <%= @request.protocol %><%= @host %><%= @request.request_uri %>
-* Parameters: <%= @request.parameters.inspect %>
-* Rails root: <%= @rails_root %>
@@ -1,2 +0,0 @@
-* session id: <%= @request.session.instance_variable_get(:@session_id).inspect %>
-* data: <%= PP.pp(@request.session.instance_variable_get(:@data),"").gsub(/\n/, "\n ").strip %>
@@ -1,3 +0,0 @@
--------------------------------
-<%= title.to_s.humanize %>:
--------------------------------
@@ -1,6 +0,0 @@
-A <%= @exception.class %> occurred in <%= @controller.controller_name %>#<%= @controller.action_name %>:
-
- <%= @exception.message %>
- <%= @backtrace.first %>
-
-<%= @sections.map { |section| render_section(section) }.join %>
Oops, something went wrong.