wherex 1.0.6 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Gemfile CHANGED
@@ -1,22 +1,4 @@
1
1
  source "http://rubygems.org"
2
- # Add dependencies required to use your gem here.
3
- # Example:
4
- gem 'arel', '~> 2.0'
5
- gem 'activerecord', '~> 3.0'
6
-
7
- case ENV["RAILS_DB"]
8
- when "postgres"
9
- gem 'pg'
10
- when "mysql"
11
- gem 'mysql2', '~>0.2.11'
12
- else
13
- gem 'sqlite3'
14
- end
15
-
16
- group :test do
17
- gem 'redgreen'
18
- gem 'turn'
19
- gem "rcov", ">= 0"
20
- gem 'rake', '>= 0.8.3'
21
- end
22
2
 
3
+ # Specify your gem's dependencies in activerecord_enum.gemspec
4
+ gemspec
data/Gemfile.lock CHANGED
@@ -1,36 +1,44 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ wherex (1.0.6)
5
+ activerecord (>= 3.0)
6
+ arel (>= 2.0)
7
+
1
8
  GEM
2
9
  remote: http://rubygems.org/
3
10
  specs:
4
- activemodel (3.0.6)
5
- activesupport (= 3.0.6)
6
- builder (~> 2.1.2)
7
- i18n (~> 0.5.0)
8
- activerecord (3.0.6)
9
- activemodel (= 3.0.6)
10
- activesupport (= 3.0.6)
11
- arel (~> 2.0.2)
12
- tzinfo (~> 0.3.23)
13
- activesupport (3.0.6)
11
+ activemodel (3.2.3)
12
+ activesupport (= 3.2.3)
13
+ builder (~> 3.0.0)
14
+ activerecord (3.2.3)
15
+ activemodel (= 3.2.3)
16
+ activesupport (= 3.2.3)
17
+ arel (~> 3.0.2)
18
+ tzinfo (~> 0.3.29)
19
+ activesupport (3.2.3)
20
+ i18n (~> 0.6)
21
+ multi_json (~> 1.0)
14
22
  ansi (1.2.2)
15
- arel (2.0.9)
16
- builder (2.1.2)
17
- i18n (0.5.0)
23
+ arel (3.0.2)
24
+ builder (3.0.0)
25
+ i18n (0.6.0)
26
+ multi_json (1.2.0)
18
27
  rake (0.8.7)
19
28
  rcov (0.9.9)
20
29
  redgreen (1.2.2)
21
- sqlite3 (1.3.3)
30
+ sqlite3 (1.3.5)
22
31
  turn (0.8.2)
23
32
  ansi (>= 1.2.2)
24
- tzinfo (0.3.26)
33
+ tzinfo (0.3.32)
25
34
 
26
35
  PLATFORMS
27
36
  ruby
28
37
 
29
38
  DEPENDENCIES
30
- activerecord (~> 3.0)
31
- arel (~> 2.0)
32
39
  rake (>= 0.8.3)
33
40
  rcov
34
41
  redgreen
35
42
  sqlite3
36
43
  turn
44
+ wherex!
data/bin/rake ADDED
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'rake' is installed as part of a gem, and
6
+ # this file is here to facilitate running it.
7
+ #
8
+
9
+ require 'pathname'
10
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
+ Pathname.new(__FILE__).realpath)
12
+
13
+ require 'rubygems'
14
+ require 'bundler/setup'
15
+
16
+ load Gem.bin_path('rake', 'rake')
data/bin/rcov ADDED
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'rcov' is installed as part of a gem, and
6
+ # this file is here to facilitate running it.
7
+ #
8
+
9
+ require 'pathname'
10
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
+ Pathname.new(__FILE__).realpath)
12
+
13
+ require 'rubygems'
14
+ require 'bundler/setup'
15
+
16
+ load Gem.bin_path('rcov', 'rcov')
data/bin/rg ADDED
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'rg' is installed as part of a gem, and
6
+ # this file is here to facilitate running it.
7
+ #
8
+
9
+ require 'pathname'
10
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
+ Pathname.new(__FILE__).realpath)
12
+
13
+ require 'rubygems'
14
+ require 'bundler/setup'
15
+
16
+ load Gem.bin_path('redgreen', 'rg')
data/bin/turn ADDED
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'turn' is installed as part of a gem, and
6
+ # this file is here to facilitate running it.
7
+ #
8
+
9
+ require 'pathname'
10
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
+ Pathname.new(__FILE__).realpath)
12
+
13
+ require 'rubygems'
14
+ require 'bundler/setup'
15
+
16
+ load Gem.bin_path('turn', 'turn')
@@ -1,3 +1,3 @@
1
1
  module Wherex
2
- VERSION = "1.0.6"
2
+ VERSION = "1.0.7"
3
3
  end
@@ -11,7 +11,7 @@ module Wherex
11
11
  def visit_Arel_Nodes_Equality_with_wherex o
12
12
  right = o.right
13
13
  if right.present? and right.is_a? Regexp
14
- @connection.regexp visit(o.left), visit(right)
14
+ ::ActiveRecord::Base.connection.regexp visit(o.left), visit(right)
15
15
  else
16
16
  visit_Arel_Nodes_Equality_without_wherex o
17
17
  end
@@ -20,13 +20,13 @@ module Wherex
20
20
  def visit_Arel_Nodes_NotEqual_with_wherex o
21
21
  right = o.right
22
22
  if right.present? and right.is_a? Regexp
23
- @connection.regexp_not visit(o.left), visit(right)
23
+ ::ActiveRecord::Base.connection.regexp_not visit(o.left), visit(right)
24
24
  else
25
25
  visit_Arel_Nodes_NotEqual_without_wherex o
26
26
  end
27
27
  end
28
28
 
29
- def visit_Regexp o; @connection.regexp_quote(o.source) end
29
+ def visit_Regexp o; ::ActiveRecord::Base.connection.regexp_quote(o.source) end
30
30
 
31
31
  end
32
32
  end
data/lib/wherex.rb CHANGED
@@ -6,5 +6,6 @@ require 'wherex/visitor'
6
6
  require 'wherex/connection'
7
7
  module Wherex
8
8
  ::Arel::Visitors::ToSql.send :include, Visitor
9
+ ::Arel::Visitors::DepthFirst.send :include, Visitor
9
10
  ::ActiveRecord::Base.send :extend, ActiveRecord
10
11
  end
data/test/db/test.sqlite3 CHANGED
Binary file
data/test/helper.rb CHANGED
@@ -30,13 +30,13 @@ ActiveRecord::Base.silence do
30
30
  load File.join(FIXTURES_PATH, 'schema.rb')
31
31
  end
32
32
 
33
- Fixtures.create_fixtures(FIXTURES_PATH, ActiveRecord::Base.connection.tables)
33
+ ActiveRecord::Fixtures.create_fixtures(FIXTURES_PATH, ActiveRecord::Base.connection.tables)
34
34
 
35
35
  class Test::Unit::TestCase
36
36
  def method_missing method, *args
37
37
  candidate = method.to_s.classify
38
38
  begin
39
- candidate.constantize.find( Fixtures.identify args[0] )
39
+ candidate.constantize.find( ActiveRecord::Fixtures.identify args[0] )
40
40
  rescue NameError
41
41
  raise NameError.new "undefined local variable or method `#{method}`"
42
42
  end
data/test/test_wherex.rb CHANGED
@@ -3,7 +3,7 @@ require 'helper'
3
3
  class TestWherex < Test::Unit::TestCase
4
4
  def test_user_example
5
5
  assert u = User.where( :zipcode => /^9[345][0-9]{3}$/ )
6
- assert_equal 3, u.count
6
+ assert_equal 3, u.count
7
7
  [:two, :three, :four ].each do |id|
8
8
  assert u.include?( users(id) )
9
9
  end
@@ -21,7 +21,7 @@ class TestWherex < Test::Unit::TestCase
21
21
  def test_student_example
22
22
  assert s = Student.all( :conditions => { :name => /[^a-zA-Z ]/ } )
23
23
  assert_equal 3, s.count
24
- [ :two, :three, :four ].each do |id|
24
+ [ :two, :three, :four ].each do |id|
25
25
  assert s.include?( students(id) )
26
26
  end
27
27
  end
data/wherex.gemspec CHANGED
@@ -21,4 +21,19 @@ Gem::Specification.new do |s|
21
21
 
22
22
  s.add_dependency 'arel', '>= 2.0'
23
23
  s.add_dependency 'activerecord', '>= 3.0'
24
+
25
+ case ENV["RAILS_DB"]
26
+ when "postgres"
27
+ s.add_development_dependency 'pg'
28
+ when "mysql"
29
+ s.add_development_dependency 'mysql2'
30
+ else
31
+ s.add_development_dependency 'sqlite3'
32
+ end
33
+
34
+ s.add_development_dependency 'redgreen'
35
+ s.add_development_dependency 'turn'
36
+ s.add_development_dependency "rcov", ">= 0"
37
+ s.add_development_dependency 'rake', '>= 0.8.3'
38
+
24
39
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wherex
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 6
10
- version: 1.0.6
9
+ - 7
10
+ version: 1.0.7
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jason King
@@ -47,11 +47,86 @@ dependencies:
47
47
  version: "3.0"
48
48
  type: :runtime
49
49
  version_requirements: *id002
50
+ - !ruby/object:Gem::Dependency
51
+ name: sqlite3
52
+ prerelease: false
53
+ requirement: &id003 !ruby/object:Gem::Requirement
54
+ none: false
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ hash: 3
59
+ segments:
60
+ - 0
61
+ version: "0"
62
+ type: :development
63
+ version_requirements: *id003
64
+ - !ruby/object:Gem::Dependency
65
+ name: redgreen
66
+ prerelease: false
67
+ requirement: &id004 !ruby/object:Gem::Requirement
68
+ none: false
69
+ requirements:
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ hash: 3
73
+ segments:
74
+ - 0
75
+ version: "0"
76
+ type: :development
77
+ version_requirements: *id004
78
+ - !ruby/object:Gem::Dependency
79
+ name: turn
80
+ prerelease: false
81
+ requirement: &id005 !ruby/object:Gem::Requirement
82
+ none: false
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ hash: 3
87
+ segments:
88
+ - 0
89
+ version: "0"
90
+ type: :development
91
+ version_requirements: *id005
92
+ - !ruby/object:Gem::Dependency
93
+ name: rcov
94
+ prerelease: false
95
+ requirement: &id006 !ruby/object:Gem::Requirement
96
+ none: false
97
+ requirements:
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ hash: 3
101
+ segments:
102
+ - 0
103
+ version: "0"
104
+ type: :development
105
+ version_requirements: *id006
106
+ - !ruby/object:Gem::Dependency
107
+ name: rake
108
+ prerelease: false
109
+ requirement: &id007 !ruby/object:Gem::Requirement
110
+ none: false
111
+ requirements:
112
+ - - ">="
113
+ - !ruby/object:Gem::Version
114
+ hash: 57
115
+ segments:
116
+ - 0
117
+ - 8
118
+ - 3
119
+ version: 0.8.3
120
+ type: :development
121
+ version_requirements: *id007
50
122
  description: This gem allows you to pass a Regexp as the value for any finder in ActiveRecord - Rails3 only
51
123
  email:
52
124
  - jk@handle.it
53
- executables: []
54
-
125
+ executables:
126
+ - rake
127
+ - rcov
128
+ - rg
129
+ - turn
55
130
  extensions: []
56
131
 
57
132
  extra_rdoc_files: []
@@ -63,6 +138,10 @@ files:
63
138
  - LICENSE.txt
64
139
  - README.md
65
140
  - Rakefile
141
+ - bin/rake
142
+ - bin/rcov
143
+ - bin/rg
144
+ - bin/turn
66
145
  - lib/wherex.rb
67
146
  - lib/wherex/adapters.rb
68
147
  - lib/wherex/connection.rb