Skip to content

Commit

Permalink
Removed from Sinatra::ShowExceptions and clean_backtrace padrino code
Browse files Browse the repository at this point in the history
Fixed an issue in Sinatra::ShowExceptions since Bundler change Gem.dir
  • Loading branch information
DAddYE committed Mar 21, 2010
1 parent fe4ac5b commit 5fd832b
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 5 deletions.
12 changes: 7 additions & 5 deletions CHANGES.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@

== 0.9.7 (unreleased)

* Fixed an issue in Sinatra::ShowExceptions since Bundler change Gem.dir
* Removed from Sinatra::ShowExceptions and clean_backtrace padrino code
* Added layout finder with format and locale
* Improved template finder (with format and locale)
* Fixed a bug that duplicates admin menus during app reloading.
* Fixed a bug that duplicates admin menus during app reloading
* Added feed_tag helper
* Removed Mailer Initializer from app.rb.tt and added it to the mailer generator.
* Removed duplicate app folder in project skeleton.
* Removed Mailer Initializer from app.rb.tt and added it to the mailer generator
* Removed duplicate app folder in project skeleton
* Couchrest generator now include in Gemfile json_pure
* Fixed project name when using some like www.my-domain.com
* Fixed a small typo error in app template
Expand All @@ -23,7 +25,7 @@
* Fixes an issue with rendering with layout false now you can use: render 'path/to/template', :layout => false
* Small helpers refactoring
* Fixed mailer initializer issue. Cleaned up options in delivery.rb
* Fixes tests in padrino helper.
* Fixes tests in padrino helper

== 0.9.5

Expand Down Expand Up @@ -53,7 +55,7 @@
* Fixed Padrino Mailer views_path when we use a "multi app" project
* Fixed content_type in Padrino Mailer
* Added a spec option -fs
* Removed rspec.opts and use it directly in rake task.
* Removed rspec.opts and use it directly in rake task

== 0.9.3

Expand Down
9 changes: 9 additions & 0 deletions padrino-core/lib/padrino-core/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -193,5 +193,14 @@ def find_view_path
@view_paths.find { |path| Dir[File.join(path, '/**/*')].any? }
end
end # self

private
def clean_backtrace(trace)
return trace unless options.clean_trace?
trace.reject { |line|
line =~ /lib\/sinatra.*\.rb|lib\/padrino.*\.rb/ ||
(defined?(Gem) && line.include?(Gem.dir))
}.map! { |line| line.gsub(/^\.\//, '') }
end
end # Application
end # Padrino
25 changes: 25 additions & 0 deletions padrino-core/lib/padrino-core/application/showexceptions.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
module Padrino
##
# This module extend Sinatra::ShowExceptions adding Padrino as "Framework"
#
module ShowExceptions

def self.included(base)
base.alias_method_chain :frame_class, :padrino
end

def frame_class_with_padrino(frame)
if frame.filename =~ /lib\/sinatra.*\.rb|lib\/padrino.*\.rb/
"framework"
elsif (defined?(Gem) && frame.filename.include?(Gem.dir)) ||
frame.filename =~ /\/bin\/(\w+)$/ ||
frame.filename =~ /Ruby\/Gems/
"system"
else
"app"
end
end
end # ShowExceptions
end # Padrino

Sinatra::ShowExceptions.send(:include, Padrino::ShowExceptions)

0 comments on commit 5fd832b

Please sign in to comment.