search_cop 1.0.9 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/test.yml +50 -0
  3. data/.rubocop.yml +134 -0
  4. data/CHANGELOG.md +29 -7
  5. data/Gemfile +4 -17
  6. data/README.md +69 -3
  7. data/Rakefile +0 -1
  8. data/docker-compose.yml +18 -0
  9. data/gemfiles/rails5.gemfile +13 -0
  10. data/gemfiles/rails6.gemfile +13 -0
  11. data/gemfiles/rails7.gemfile +13 -0
  12. data/lib/search_cop/grammar_parser.rb +3 -4
  13. data/lib/search_cop/hash_parser.rb +20 -18
  14. data/lib/search_cop/helpers.rb +15 -0
  15. data/lib/search_cop/query_builder.rb +3 -5
  16. data/lib/search_cop/query_info.rb +0 -2
  17. data/lib/search_cop/search_scope.rb +2 -4
  18. data/lib/search_cop/version.rb +1 -1
  19. data/lib/search_cop/visitors/mysql.rb +4 -2
  20. data/lib/search_cop/visitors/postgres.rb +5 -3
  21. data/lib/search_cop/visitors/visitor.rb +7 -5
  22. data/lib/search_cop/visitors.rb +0 -2
  23. data/lib/search_cop.rb +15 -13
  24. data/lib/search_cop_grammar/attributes.rb +53 -34
  25. data/lib/search_cop_grammar/nodes.rb +0 -2
  26. data/lib/search_cop_grammar.rb +13 -4
  27. data/lib/search_cop_grammar.treetop +6 -4
  28. data/search_cop.gemspec +9 -11
  29. data/test/and_test.rb +6 -8
  30. data/test/boolean_test.rb +7 -9
  31. data/test/database.yml +4 -1
  32. data/test/date_test.rb +38 -12
  33. data/test/datetime_test.rb +45 -12
  34. data/test/default_operator_test.rb +51 -0
  35. data/test/error_test.rb +2 -4
  36. data/test/float_test.rb +16 -11
  37. data/test/fulltext_test.rb +6 -8
  38. data/test/hash_test.rb +32 -34
  39. data/test/integer_test.rb +9 -11
  40. data/test/not_test.rb +6 -8
  41. data/test/or_test.rb +8 -10
  42. data/test/scope_test.rb +11 -13
  43. data/test/search_cop_test.rb +42 -36
  44. data/test/string_test.rb +67 -19
  45. data/test/test_helper.rb +28 -18
  46. data/test/visitor_test.rb +4 -6
  47. metadata +25 -42
  48. data/.travis.yml +0 -45
  49. data/Appraisals +0 -21
  50. data/gemfiles/3.2.gemfile +0 -25
  51. data/gemfiles/4.0.gemfile +0 -25
  52. data/gemfiles/4.1.gemfile +0 -25
  53. data/gemfiles/4.2.gemfile +0 -25
  54. data/gemfiles/5.0.gemfile +0 -25
data/.travis.yml DELETED
@@ -1,45 +0,0 @@
1
-
2
- addons:
3
- postgresql: "9.3"
4
-
5
- before_script:
6
- - mysql -e 'create database search_cop;'
7
- - psql -c 'create database search_cop;' -U postgres
8
-
9
- rvm:
10
- - 2.1.10
11
- - 2.2.5
12
- - 2.3.1
13
- - rbx-3
14
- - jruby
15
- env:
16
- - DATABASE=sqlite
17
- - DATABASE=mysql
18
- - DATABASE=postgres
19
- matrix:
20
- include:
21
- - rvm: 2.4.1
22
- gemfile: gemfiles/5.0-Gemfile
23
- env: DATABASE=sqlite
24
- - rvm: 2.4.1
25
- gemfile: gemfiles/5.0-Gemfile
26
- env: DATABASE=mysql
27
- - rvm: 2.4.1
28
- gemfile: gemfiles/5.0-Gemfile
29
- env: DATABASE=postgres
30
- allow_failures:
31
- - rvm: rbx-3
32
- - rvm: jruby
33
-
34
- gemfile:
35
- - gemfiles/3.2.gemfile
36
- - gemfiles/4.0.gemfile
37
- - gemfiles/4.1.gemfile
38
- - gemfiles/4.2.gemfile
39
-
40
- install:
41
- - "travis_retry bundle install"
42
-
43
- script: "bundle exec rake test"
44
- sudo: false
45
-
data/Appraisals DELETED
@@ -1,21 +0,0 @@
1
-
2
- appraise "3.2" do
3
- gem "activerecord", "~> 3.2"
4
- gem "search_cop", :path => "../"
5
- end
6
-
7
- appraise "4.1" do
8
- gem "activerecord", "~> 4.1"
9
- gem "search_cop", :path => "../"
10
- end
11
-
12
- appraise "4.2" do
13
- gem "activerecord", "~> 4.2"
14
- gem "search_cop", :path => "../"
15
- end
16
-
17
- appraise "5.0" do
18
- gem "activerecord", "~> 5.0"
19
- gem "search_cop", :path => "../"
20
- end
21
-
data/gemfiles/3.2.gemfile DELETED
@@ -1,25 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "activerecord", "~> 3.2.22"
6
-
7
- platforms :jruby do
8
- gem "activerecord-jdbcmysql-adapter"
9
- gem "activerecord-jdbcsqlite3-adapter"
10
- gem "activerecord-jdbcpostgresql-adapter"
11
- end
12
-
13
- platforms :ruby do
14
- gem "sqlite3"
15
- gem "mysql2", "~> 0.3.20"
16
- gem "pg"
17
- end
18
-
19
- platforms :rbx do
20
- gem "racc"
21
- gem "rubysl", "~> 2.0"
22
- gem "psych"
23
- end
24
-
25
- gemspec :path => "../"
data/gemfiles/4.0.gemfile DELETED
@@ -1,25 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "activerecord", "~> 4.0.13"
6
-
7
- platforms :jruby do
8
- gem "activerecord-jdbcmysql-adapter"
9
- gem "activerecord-jdbcsqlite3-adapter"
10
- gem "activerecord-jdbcpostgresql-adapter"
11
- end
12
-
13
- platforms :ruby do
14
- gem "sqlite3"
15
- gem "mysql2", "~> 0.3.20"
16
- gem "pg"
17
- end
18
-
19
- platforms :rbx do
20
- gem "racc"
21
- gem "rubysl", "~> 2.0"
22
- gem "psych"
23
- end
24
-
25
- gemspec :path => "../"
data/gemfiles/4.1.gemfile DELETED
@@ -1,25 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "activerecord", "~> 4.1.13"
6
-
7
- platforms :jruby do
8
- gem "activerecord-jdbcmysql-adapter"
9
- gem "activerecord-jdbcsqlite3-adapter"
10
- gem "activerecord-jdbcpostgresql-adapter"
11
- end
12
-
13
- platforms :ruby do
14
- gem "sqlite3"
15
- gem "mysql2", "~> 0.3.20"
16
- gem "pg"
17
- end
18
-
19
- platforms :rbx do
20
- gem "racc"
21
- gem "rubysl", "~> 2.0"
22
- gem "psych"
23
- end
24
-
25
- gemspec :path => "../"
data/gemfiles/4.2.gemfile DELETED
@@ -1,25 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "activerecord", "~> 4.2.4"
6
-
7
- platforms :jruby do
8
- gem "activerecord-jdbcmysql-adapter"
9
- gem "activerecord-jdbcsqlite3-adapter"
10
- gem "activerecord-jdbcpostgresql-adapter"
11
- end
12
-
13
- platforms :ruby do
14
- gem "sqlite3"
15
- gem "mysql2", "~> 0.3.20"
16
- gem "pg"
17
- end
18
-
19
- platforms :rbx do
20
- gem "racc"
21
- gem "rubysl", "~> 2.0"
22
- gem "psych"
23
- end
24
-
25
- gemspec :path => "../"
data/gemfiles/5.0.gemfile DELETED
@@ -1,25 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "activerecord", "~> 5.0"
6
-
7
- platforms :jruby do
8
- gem "activerecord-jdbcmysql-adapter"
9
- gem "activerecord-jdbcsqlite3-adapter"
10
- gem "activerecord-jdbcpostgresql-adapter"
11
- end
12
-
13
- platforms :ruby do
14
- gem "sqlite3"
15
- gem "mysql2", "~> 0.3.20"
16
- gem "pg"
17
- end
18
-
19
- platforms :rbx do
20
- gem "racc"
21
- gem "rubysl", "~> 2.0"
22
- gem "psych"
23
- end
24
-
25
- gemspec :path => "../"