xilence 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in xilence.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2009 Ivan Nemytchenko
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,33 @@
1
+ # Xilence
2
+
3
+ How often have you got 500 error while developing some super-cool ajax thing and seen stuff like this in your browser console?
4
+
5
+ ![Safari console rails backtrace noise](http://inem.github.com/images/safari-console-rails-backtrace.png)
6
+
7
+ Do we really need to scroll down all that HTML/CSS noise each time looking on rails error backtrace?
8
+ Wanna make your backtraces clean and quiet for ajax requests?
9
+
10
+ Xilence removes all that annoying HTML and CSS code from your rails backtrace for ajax requests.
11
+
12
+ Just open your firebug/safari console and click on the broken ajax action link and you should see something like this:
13
+
14
+ ![Firebug xilence output](http://inem.github.com/images/xilence_output.png)
15
+
16
+ ## Installation
17
+
18
+ In Rails 3 and Bundler, add the following to your Gemfile:
19
+
20
+ ```ruby
21
+ group :development do
22
+ gem 'xilence', '~> 2.0.0'
23
+ end
24
+ ```
25
+ If you still use rails 2, look at rails_2 branch.
26
+
27
+ ## Contributing
28
+
29
+ 1. Fork it
30
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
31
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
32
+ 4. Push to the branch (`git push origin my-new-feature`)
33
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,3 @@
1
+ module Xilence
2
+ VERSION = "2.0.0"
3
+ end
data/lib/xilence.rb ADDED
@@ -0,0 +1,24 @@
1
+ require "xilence/version"
2
+
3
+ module ActionController
4
+ module Rescue
5
+
6
+ def rescue_with_handler(exception)
7
+ if request.xhr?
8
+ linebreaker = "\n "
9
+ title = "#{exception.class} (#{exception.message}):#{linebreaker}"
10
+ backtrace = exception.backtrace.join(linebreaker)
11
+
12
+ render text: (title + backtrace), status: 500
13
+ else
14
+ if (exception.respond_to?(:original_exception) &&
15
+ (orig_exception = exception.original_exception) &&
16
+ handler_for_rescue(orig_exception))
17
+ exception = orig_exception
18
+ end
19
+ super(exception)
20
+ end
21
+ end
22
+
23
+ end
24
+ end
data/xilence.gemspec ADDED
@@ -0,0 +1,21 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'xilence/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "xilence"
8
+ gem.version = Xilence::VERSION
9
+ gem.authors = ["Ivan Nemytchenko", "Maxim Kaschenko"]
10
+ gem.email = ["nemytchenko@gmail.com"]
11
+ gem.description = "Rails backtrace silencer for ajax requests"
12
+ gem.summary = "dummy summary"
13
+ gem.homepage = "http://inem.github.com/xilence.html"
14
+
15
+ gem.files = `git ls-files`.split($/)
16
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
+ gem.require_paths = ["lib"]
19
+
20
+ gem.add_dependency('rails', '~> 3.0')
21
+ end
metadata ADDED
@@ -0,0 +1,75 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: xilence
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.0.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Ivan Nemytchenko
9
+ - Maxim Kaschenko
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+ date: 2013-01-16 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: rails
17
+ requirement: !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ~>
21
+ - !ruby/object:Gem::Version
22
+ version: '3.0'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ~>
29
+ - !ruby/object:Gem::Version
30
+ version: '3.0'
31
+ description: Rails backtrace silencer for ajax requests
32
+ email:
33
+ - nemytchenko@gmail.com
34
+ executables: []
35
+ extensions: []
36
+ extra_rdoc_files: []
37
+ files:
38
+ - Gemfile
39
+ - LICENSE.txt
40
+ - README.md
41
+ - Rakefile
42
+ - lib/xilence.rb
43
+ - lib/xilence/version.rb
44
+ - xilence.gemspec
45
+ homepage: http://inem.github.com/xilence.html
46
+ licenses: []
47
+ post_install_message:
48
+ rdoc_options: []
49
+ require_paths:
50
+ - lib
51
+ required_ruby_version: !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ! '>='
55
+ - !ruby/object:Gem::Version
56
+ version: '0'
57
+ segments:
58
+ - 0
59
+ hash: 4386053542067104579
60
+ required_rubygems_version: !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ segments:
67
+ - 0
68
+ hash: 4386053542067104579
69
+ requirements: []
70
+ rubyforge_project:
71
+ rubygems_version: 1.8.24
72
+ signing_key:
73
+ specification_version: 3
74
+ summary: dummy summary
75
+ test_files: []