did_you_mean 0.9.4 → 0.9.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 17d1aa077937ae14999fe9cf7f30ad339b9d7ff0
4
- data.tar.gz: f93090d72fbafed6291f073926a32c36930adcfb
3
+ metadata.gz: 1ca4eb20ca371d3757c5f06e9edd950b12678e52
4
+ data.tar.gz: b628df2f452d7708b600c84664322005d797cee9
5
5
  SHA512:
6
- metadata.gz: a73eb4adec3501a186751d7806190d763db5f96fc848ca990ef28a6c736309739090c40aff0914634d7f9448b99e77e45167a4e24cc338fd807ed98ec3a6bf54
7
- data.tar.gz: f344c68e841947506a6ee465a7f8bc74f0ee7eaf4d749f438e5f57c38c50c5fa7191a995c4bc3afee02fd8680cfc86a5bdb93d7b98214e4ace701cf42a8c9805
6
+ metadata.gz: cc2fbb68045d990ce50f4a3aa260037736f5ad480d3cdaad352d3666020fc88c2e3be7fdbfe27525773d556244c1cfc0c4e7aa8ad3f9174e4b03342be28b9035
7
+ data.tar.gz: 75e974ffc415ab2fd3d78fdef7de4ce44cb37245124a57a9ae73019f16d9a75025789f34ce2b7c67144f692b609b8acf45bee49e048cc7e033934273b3b6a85d
data/.travis.yml CHANGED
@@ -1,17 +1,19 @@
1
- script: bundle exec rake test
1
+ language: ruby
2
+ script: bundle exec rake test
3
+ cache: bundler
4
+ sudo: false
2
5
 
3
6
  rvm:
4
7
  - 1.9.3
5
8
  - 2.0.0
6
9
  - 2.1.5
7
- - 2.2.0-preview1
10
+ - 2.2.0
8
11
  - ruby-head
9
- - jruby
10
- - rbx
12
+ - jruby-1.7.17
13
+ - jruby-head
14
+ - rbx-2.4.1
11
15
 
12
16
  gemfile:
13
- - gemfiles/activerecord_30.gemfile
14
- - gemfiles/activerecord_31.gemfile
15
17
  - gemfiles/activerecord_32.gemfile
16
18
  - gemfiles/activerecord_40.gemfile
17
19
  - gemfiles/activerecord_41.gemfile
@@ -19,10 +21,15 @@ gemfile:
19
21
  - gemfiles/activerecord_edge.gemfile
20
22
 
21
23
  matrix:
22
- allow_failures:
23
- - rvm: jruby
24
- gemfile: gemfiles/activerecord_42.gemfile
25
- - rvm: jruby
24
+ exclude:
25
+ - rvm: 1.9.3
26
+ gemfile: gemfiles/activerecord_edge.gemfile
27
+ - rvm: 2.0.0
26
28
  gemfile: gemfiles/activerecord_edge.gemfile
27
- - rvm: rbx
29
+ - rvm: 2.1.5
30
+ gemfile: gemfiles/activerecord_edge.gemfile
31
+ allow_failures:
32
+ - rvm: jruby-head
33
+ - rvm: rbx-2.4.1
34
+ - gemfile: gemfiles/activerecord_edge.gemfile
28
35
  fast_finish: true
data/Appraisals CHANGED
@@ -1,11 +1,3 @@
1
- appraise "activerecord_30" do
2
- gem "activerecord", "~> 3.0.0"
3
- end
4
-
5
- appraise "activerecord_31" do
6
- gem "activerecord", "~> 3.1.0"
7
- end
8
-
9
1
  appraise "activerecord_32" do
10
2
  gem "activerecord", "~> 3.2.0"
11
3
  end
@@ -19,7 +11,7 @@ appraise "activerecord_41" do
19
11
  end
20
12
 
21
13
  appraise "activerecord_42" do
22
- gem "activerecord", "~> 4.2.0.beta4"
14
+ gem "activerecord", "~> 4.2.0"
23
15
  end
24
16
 
25
17
  appraise "activerecord_edge" do
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## [v0.9.5](https://github.com/yuki24/did_you_mean/tree/v0.9.5)
2
+
3
+ _<sup>released on 2015-01-07 12:41:23 UTC</sup>_
4
+
5
+ #### Bug Fixes
6
+
7
+ - Whitelist `#safe_constantize` method from `ActiveSupport::Inflector` to avoid significant performance slowdown ( [@tleish](https://github.com/tleish), [#19](https://github.com/yuki24/did_you_mean/issues/19 "Significant Slowdown when Using Debugger"), [#20](https://github.com/yuki24/did_you_mean/pull/20 "Whitelisting safe\_constantize (ActiveSupport::Inflector) method"))
8
+
1
9
  ## [v0.9.4](https://github.com/yuki24/did_you_mean/tree/v0.9.4)
2
10
 
3
11
  _<sup>released on 2014-11-18 03:51:41 UTC</sup>_
@@ -2,7 +2,7 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "activerecord", "~> 4.2.0.beta4"
5
+ gem "activerecord", "~> 4.2.0"
6
6
 
7
7
  platforms :ruby do
8
8
  gem "sqlite3"
@@ -1,18 +1,18 @@
1
1
  class NameError
2
2
  attr_reader :frame_binding
3
3
 
4
- begin
5
- require "active_support/core_ext/name_error"
6
-
7
- def missing_name
8
- if /undefined local variable or method/ !~ original_message
9
- $1 if /((::)?([A-Z]\w*)(::[A-Z]\w*)*)$/ =~ original_message
10
- end
11
- end if method_defined?(:missing_name)
12
- rescue LoadError; end
4
+ IGNORED_CALLERS = [
5
+ /( |`)missing_name'/,
6
+ /( |`)safe_constantize'/
7
+ ].freeze
8
+ private_constant :IGNORED_CALLERS
13
9
 
14
10
  def to_s_with_did_you_mean
15
- original_message + did_you_mean?.to_s rescue original_message
11
+ msg = original_message
12
+ msg << did_you_mean?.to_s if IGNORED_CALLERS.all? {|ignored| caller.first(8).grep(ignored).empty? }
13
+ msg
14
+ rescue
15
+ original_message
16
16
  end
17
17
 
18
18
  alias original_message to_s
@@ -1,3 +1,3 @@
1
1
  module DidYouMean
2
- VERSION = "0.9.4"
2
+ VERSION = "0.9.5"
3
3
  end
@@ -17,8 +17,49 @@ class NameErrorExtensionTest < Minitest::Test
17
17
  DidYouMean.finders["NameError"] = @old_finder
18
18
  end
19
19
 
20
- def test_message?
20
+ def test_message
21
21
  assert_match "Y U SO SLOW?", @error.to_s
22
22
  assert_match "Y U SO SLOW?", @error.message
23
23
  end
24
24
  end
25
+
26
+ class IgnoreCallersTest < Minitest::Test
27
+ class Boomer
28
+ def initialize(*)
29
+ raise Exception, "finder was created when it shouldn't!"
30
+ end
31
+ end
32
+
33
+ def setup
34
+ @org = DidYouMean.finders["NameError"]
35
+ DidYouMean.finders["NameError"] = Boomer
36
+
37
+ @error = assert_raises(NameError){ doesnt_exist }
38
+ end
39
+
40
+ def teardown
41
+ DidYouMean.finders["NameError"] = @org
42
+ end
43
+
44
+ def test_ignore_missing_name
45
+ assert_nothing_raised { missing_name }
46
+ end
47
+
48
+ def test_ignore_safe_constantize
49
+ assert_nothing_raised { safe_constantize }
50
+ end
51
+
52
+ private
53
+
54
+ def safe_constantize
55
+ @error.message
56
+ end
57
+
58
+ def missing_name
59
+ @error.message
60
+ end
61
+
62
+ def assert_nothing_raised
63
+ yield
64
+ end
65
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: did_you_mean
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.4
4
+ version: 0.9.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuki Nishijima
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-18 00:00:00.000000000 Z
11
+ date: 2015-01-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: interception
@@ -104,8 +104,6 @@ files:
104
104
  - ext/did_you_mean/extconf.rb
105
105
  - ext/did_you_mean/method_missing.c
106
106
  - ext/did_you_mean/org/yukinishijima/ReceiverCapturer.java
107
- - gemfiles/activerecord_30.gemfile
108
- - gemfiles/activerecord_31.gemfile
109
107
  - gemfiles/activerecord_32.gemfile
110
108
  - gemfiles/activerecord_40.gemfile
111
109
  - gemfiles/activerecord_41.gemfile
@@ -152,7 +150,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
152
150
  version: '0'
153
151
  requirements: []
154
152
  rubyforge_project:
155
- rubygems_version: 2.4.3
153
+ rubygems_version: 2.4.5
156
154
  signing_key:
157
155
  specification_version: 4
158
156
  summary: '"Did you mean?" experience in Ruby'
@@ -1,21 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "activerecord", "~> 3.0.0"
6
-
7
- platforms :ruby do
8
- gem "sqlite3"
9
- end
10
-
11
- platforms :jruby do
12
- gem "activerecord-jdbcsqlite3-adapter"
13
- end
14
-
15
- platforms :rbx do
16
- gem "rubysl", "~> 2.0"
17
- gem "racc"
18
- gem "rubinius-developer_tools"
19
- end
20
-
21
- gemspec :path => "../"
@@ -1,21 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "activerecord", "~> 3.1.0"
6
-
7
- platforms :ruby do
8
- gem "sqlite3"
9
- end
10
-
11
- platforms :jruby do
12
- gem "activerecord-jdbcsqlite3-adapter"
13
- end
14
-
15
- platforms :rbx do
16
- gem "rubysl", "~> 2.0"
17
- gem "racc"
18
- gem "rubinius-developer_tools"
19
- end
20
-
21
- gemspec :path => "../"