sqlite3_ar_regexp 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/.travis.yml +10 -0
- data/LICENSE +1 -1
- data/{README.markdown → README.md} +15 -2
- data/Rakefile +6 -1
- data/{changelog.markdown → changelog.md} +3 -0
- data/lib/sqlite3_ar_regexp/extension.rb +2 -6
- data/lib/sqlite3_ar_regexp/version.rb +1 -1
- data/sqlite3_ar_regexp.gemspec +17 -19
- metadata +87 -61
data/.travis.yml
ADDED
data/LICENSE
CHANGED
@@ -1,12 +1,25 @@
|
|
1
1
|
# SQLite3 ActiveRecord REGEXP
|
2
|
+
|
2
3
|
This adds REGEXP support to SQLite3 in ActiveRecord.
|
3
4
|
|
4
5
|
## Installation
|
5
|
-
$ gem install sqlite3_ar_regexp
|
6
6
|
|
7
|
-
|
7
|
+
Add this line to your application's Gemfile:
|
8
8
|
|
9
9
|
gem 'sqlite3_ar_regexp'
|
10
10
|
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install sqlite3_ar_regexp
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
# find all accounts where the first name starts with "a"
|
22
|
+
Account.where('first_name REGEXP "^a"')
|
23
|
+
|
11
24
|
## Credits
|
12
25
|
The original code for this was done by Joe Yates and can be found at http://titusd.co.uk/2010/01/31/regular-expressions-in-sqlite/.
|
data/Rakefile
CHANGED
@@ -7,13 +7,9 @@ module SQLite3ARRegexp
|
|
7
7
|
included do
|
8
8
|
def initialize(db, logger, config)
|
9
9
|
super
|
10
|
+
|
10
11
|
db.create_function('regexp', 2) do |func, pattern, expression|
|
11
|
-
|
12
|
-
if expression.to_s.match(regexp)
|
13
|
-
func.result = 1
|
14
|
-
else
|
15
|
-
func.result = 0
|
16
|
-
end
|
12
|
+
func.result = expression.to_s.match(Regexp.new(pattern.to_s, Regexp::IGNORECASE)) ? 1 : 0
|
17
13
|
end
|
18
14
|
end
|
19
15
|
end
|
data/sqlite3_ar_regexp.gemspec
CHANGED
@@ -1,26 +1,24 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
|
3
|
-
require "sqlite3_ar_regexp/version"
|
2
|
+
require File.expand_path('../lib/sqlite3_ar_regexp/version', __FILE__)
|
4
3
|
|
5
|
-
Gem::Specification.new do |
|
6
|
-
|
7
|
-
|
8
|
-
s.authors = ["Aaron Lasseigne"]
|
9
|
-
s.email = ["alasseigne@sei-mi.com"]
|
10
|
-
s.homepage = "https://github.com/sei-mi/sqlite3_ar_regexp"
|
11
|
-
s.summary = %q{Adds REGEXP support for SQLite3 in ActiveRecord.}
|
12
|
-
s.description = %q{Adds REGEXP support for SQLite3 in ActiveRecord.}
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.name = 'sqlite3_ar_regexp'
|
6
|
+
gem.version = SQLite3ARRegexp::VERSION
|
13
7
|
|
14
|
-
|
8
|
+
gem.authors = ['Aaron Lasseigne']
|
9
|
+
gem.email = ['aaron.lasseigne@gmail.com']
|
10
|
+
gem.summary = %q{Adds REGEXP support for SQLite3 in ActiveRecord.}
|
11
|
+
gem.description = %q{Adds REGEXP support for SQLite3 in ActiveRecord.}
|
12
|
+
gem.homepage = 'https://github.com/AaronLasseigne/sqlite3_ar_regexp'
|
15
13
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
14
|
+
gem.files = `git ls-files`.split("\n")
|
15
|
+
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
16
|
+
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
17
|
+
gem.require_paths = ['lib']
|
20
18
|
|
21
|
-
|
22
|
-
|
19
|
+
gem.add_dependency 'sqlite3'
|
20
|
+
gem.add_dependency 'activerecord', '~> 3.0'
|
23
21
|
|
24
|
-
|
25
|
-
|
22
|
+
gem.add_development_dependency 'rake'
|
23
|
+
gem.add_development_dependency 'rspec'
|
26
24
|
end
|
metadata
CHANGED
@@ -1,109 +1,135 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: sqlite3_ar_regexp
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 19
|
5
5
|
prerelease:
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 1
|
9
|
+
- 0
|
10
|
+
version: 1.1.0
|
6
11
|
platform: ruby
|
7
|
-
authors:
|
12
|
+
authors:
|
8
13
|
- Aaron Lasseigne
|
9
14
|
autorequire:
|
10
15
|
bindir: bin
|
11
16
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
requirement: &
|
17
|
+
|
18
|
+
date: 2012-04-03 00:00:00 Z
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
17
22
|
none: false
|
18
|
-
requirements:
|
19
|
-
- -
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
hash: 3
|
27
|
+
segments:
|
28
|
+
- 0
|
29
|
+
version: "0"
|
30
|
+
version_requirements: *id001
|
31
|
+
name: sqlite3
|
22
32
|
type: :runtime
|
23
33
|
prerelease: false
|
24
|
-
|
25
|
-
|
26
|
-
name: activerecord
|
27
|
-
requirement: &70159387640120 !ruby/object:Gem::Requirement
|
34
|
+
- !ruby/object:Gem::Dependency
|
35
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
28
36
|
none: false
|
29
|
-
requirements:
|
37
|
+
requirements:
|
30
38
|
- - ~>
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
hash: 7
|
41
|
+
segments:
|
42
|
+
- 3
|
43
|
+
- 0
|
44
|
+
version: "3.0"
|
45
|
+
version_requirements: *id002
|
46
|
+
name: activerecord
|
33
47
|
type: :runtime
|
34
48
|
prerelease: false
|
35
|
-
|
36
|
-
|
37
|
-
name: rspec
|
38
|
-
requirement: &70159387639700 !ruby/object:Gem::Requirement
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
39
51
|
none: false
|
40
|
-
requirements:
|
41
|
-
- -
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
hash: 3
|
56
|
+
segments:
|
57
|
+
- 0
|
58
|
+
version: "0"
|
59
|
+
version_requirements: *id003
|
60
|
+
name: rake
|
44
61
|
type: :development
|
45
62
|
prerelease: false
|
46
|
-
|
47
|
-
|
48
|
-
name: rake
|
49
|
-
requirement: &70159387639240 !ruby/object:Gem::Requirement
|
63
|
+
- !ruby/object:Gem::Dependency
|
64
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
50
65
|
none: false
|
51
|
-
requirements:
|
52
|
-
- -
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
hash: 3
|
70
|
+
segments:
|
71
|
+
- 0
|
72
|
+
version: "0"
|
73
|
+
version_requirements: *id004
|
74
|
+
name: rspec
|
55
75
|
type: :development
|
56
76
|
prerelease: false
|
57
|
-
version_requirements: *70159387639240
|
58
77
|
description: Adds REGEXP support for SQLite3 in ActiveRecord.
|
59
|
-
email:
|
60
|
-
-
|
78
|
+
email:
|
79
|
+
- aaron.lasseigne@gmail.com
|
61
80
|
executables: []
|
81
|
+
|
62
82
|
extensions: []
|
83
|
+
|
63
84
|
extra_rdoc_files: []
|
64
|
-
|
85
|
+
|
86
|
+
files:
|
65
87
|
- .gitignore
|
88
|
+
- .travis.yml
|
66
89
|
- Gemfile
|
67
90
|
- LICENSE
|
68
|
-
- README.
|
91
|
+
- README.md
|
69
92
|
- Rakefile
|
70
|
-
- changelog.
|
93
|
+
- changelog.md
|
71
94
|
- lib/sqlite3_ar_regexp.rb
|
72
95
|
- lib/sqlite3_ar_regexp/extension.rb
|
73
96
|
- lib/sqlite3_ar_regexp/version.rb
|
74
97
|
- spec/regexp_spec.rb
|
75
98
|
- spec/test.sqlite3
|
76
99
|
- sqlite3_ar_regexp.gemspec
|
77
|
-
homepage: https://github.com/
|
100
|
+
homepage: https://github.com/AaronLasseigne/sqlite3_ar_regexp
|
78
101
|
licenses: []
|
102
|
+
|
79
103
|
post_install_message:
|
80
104
|
rdoc_options: []
|
81
|
-
|
105
|
+
|
106
|
+
require_paths:
|
82
107
|
- lib
|
83
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
108
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
84
109
|
none: false
|
85
|
-
requirements:
|
86
|
-
- -
|
87
|
-
- !ruby/object:Gem::Version
|
88
|
-
|
89
|
-
segments:
|
110
|
+
requirements:
|
111
|
+
- - ">="
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
hash: 3
|
114
|
+
segments:
|
90
115
|
- 0
|
91
|
-
|
92
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
116
|
+
version: "0"
|
117
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
93
118
|
none: false
|
94
|
-
requirements:
|
95
|
-
- -
|
96
|
-
- !ruby/object:Gem::Version
|
97
|
-
|
98
|
-
segments:
|
119
|
+
requirements:
|
120
|
+
- - ">="
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
hash: 3
|
123
|
+
segments:
|
99
124
|
- 0
|
100
|
-
|
125
|
+
version: "0"
|
101
126
|
requirements: []
|
102
|
-
|
103
|
-
|
127
|
+
|
128
|
+
rubyforge_project:
|
129
|
+
rubygems_version: 1.8.17
|
104
130
|
signing_key:
|
105
131
|
specification_version: 3
|
106
132
|
summary: Adds REGEXP support for SQLite3 in ActiveRecord.
|
107
|
-
test_files:
|
133
|
+
test_files:
|
108
134
|
- spec/regexp_spec.rb
|
109
135
|
- spec/test.sqlite3
|