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 CHANGED
@@ -3,3 +3,5 @@
3
3
  Gemfile.lock
4
4
  pkg/*
5
5
  *.swp
6
+ .yardoc
7
+ doc
@@ -0,0 +1,10 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.8.7
4
+ - ree
5
+ # - jruby-18mode
6
+ - rbx-18mode
7
+ - 1.9.2
8
+ - 1.9.3
9
+ # - jruby-19mode
10
+ - rbx-19mode
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2011 SEI Meetings & Incentives
1
+ Copyright (c) 2011 SEI Meetings & Incentives, Aaron Lasseigne
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person
4
4
  obtaining a copy of this software and associated documentation
@@ -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
- If you're using Bundler, add this to your Gemfile.
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
@@ -1 +1,6 @@
1
- require "bundler/gem_tasks"
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ task :default => :spec
5
+
6
+ RSpec::Core::RakeTask.new
@@ -1,3 +1,6 @@
1
+ ## 1.1.0
2
+ * internal refactoring
3
+
1
4
  ## 1.0.1
2
5
  * adding license
3
6
 
@@ -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
- regexp = Regexp.new(pattern.to_s, Regexp::IGNORECASE)
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
@@ -1,3 +1,3 @@
1
1
  module SQLite3ARRegexp
2
- VERSION = '1.0.1'
2
+ VERSION = '1.1.0'
3
3
  end
@@ -1,26 +1,24 @@
1
1
  # -*- encoding: utf-8 -*-
2
- $:.push File.expand_path("../lib", __FILE__)
3
- require "sqlite3_ar_regexp/version"
2
+ require File.expand_path('../lib/sqlite3_ar_regexp/version', __FILE__)
4
3
 
5
- Gem::Specification.new do |s|
6
- s.name = "sqlite3_ar_regexp"
7
- s.version = SQLite3ARRegexp::VERSION
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
- s.rubyforge_project = "sqlite3_ar_regexp"
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
- s.files = `git ls-files`.split("\n")
17
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
- s.require_paths = ["lib"]
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
- s.add_runtime_dependency 'sqlite3'
22
- s.add_runtime_dependency 'activerecord', '~> 3.0'
19
+ gem.add_dependency 'sqlite3'
20
+ gem.add_dependency 'activerecord', '~> 3.0'
23
21
 
24
- s.add_development_dependency 'rspec'
25
- s.add_development_dependency 'rake'
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
- version: 1.0.1
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
- date: 2011-11-11 00:00:00.000000000Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: sqlite3
16
- requirement: &70159387640620 !ruby/object:Gem::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
- version: '0'
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
- version_requirements: *70159387640620
25
- - !ruby/object:Gem::Dependency
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
- version: '3.0'
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
- version_requirements: *70159387640120
36
- - !ruby/object:Gem::Dependency
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
- version: '0'
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
- version_requirements: *70159387639700
47
- - !ruby/object:Gem::Dependency
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
- version: '0'
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
- - alasseigne@sei-mi.com
78
+ email:
79
+ - aaron.lasseigne@gmail.com
61
80
  executables: []
81
+
62
82
  extensions: []
83
+
63
84
  extra_rdoc_files: []
64
- files:
85
+
86
+ files:
65
87
  - .gitignore
88
+ - .travis.yml
66
89
  - Gemfile
67
90
  - LICENSE
68
- - README.markdown
91
+ - README.md
69
92
  - Rakefile
70
- - changelog.markdown
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/sei-mi/sqlite3_ar_regexp
100
+ homepage: https://github.com/AaronLasseigne/sqlite3_ar_regexp
78
101
  licenses: []
102
+
79
103
  post_install_message:
80
104
  rdoc_options: []
81
- require_paths:
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
- version: '0'
89
- segments:
110
+ requirements:
111
+ - - ">="
112
+ - !ruby/object:Gem::Version
113
+ hash: 3
114
+ segments:
90
115
  - 0
91
- hash: -4078676390751202604
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
- version: '0'
98
- segments:
119
+ requirements:
120
+ - - ">="
121
+ - !ruby/object:Gem::Version
122
+ hash: 3
123
+ segments:
99
124
  - 0
100
- hash: -4078676390751202604
125
+ version: "0"
101
126
  requirements: []
102
- rubyforge_project: sqlite3_ar_regexp
103
- rubygems_version: 1.8.6
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