by_star 3.0.0 → 4.0.1

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.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/mysql.yml +92 -0
  3. data/.github/workflows/postgresql.yml +99 -0
  4. data/.gitignore +6 -5
  5. data/.travis.yml +92 -61
  6. data/CHANGELOG.md +63 -44
  7. data/Gemfile +18 -18
  8. data/MIT-LICENSE +20 -20
  9. data/README.md +616 -577
  10. data/Rakefile +18 -18
  11. data/UPGRADING +4 -6
  12. data/by_star.gemspec +34 -34
  13. data/cleaner.rb +24 -24
  14. data/lib/by_star/base.rb +69 -68
  15. data/lib/by_star/between.rb +185 -156
  16. data/lib/by_star/directional.rb +35 -37
  17. data/lib/by_star/kernel/date.rb +41 -50
  18. data/lib/by_star/kernel/in_time_zone.rb +20 -0
  19. data/lib/by_star/kernel/time.rb +41 -41
  20. data/lib/by_star/normalization.rb +156 -127
  21. data/lib/by_star/orm/active_record/by_star.rb +75 -61
  22. data/lib/by_star/orm/mongoid/by_star.rb +90 -76
  23. data/lib/by_star/orm/mongoid/reorder.rb +23 -23
  24. data/lib/by_star/version.rb +3 -3
  25. data/lib/by_star.rb +18 -17
  26. data/spec/database.yml +15 -15
  27. data/spec/fixtures/active_record/models.rb +12 -12
  28. data/spec/fixtures/active_record/schema.rb +19 -19
  29. data/spec/fixtures/mongoid/models.rb +31 -31
  30. data/spec/fixtures/shared/seeds.rb +36 -26
  31. data/spec/gemfiles/Gemfile.rails +5 -0
  32. data/spec/gemfiles/Gemfile.rails32 +7 -0
  33. data/spec/gemfiles/Gemfile.rails40 +7 -7
  34. data/spec/gemfiles/Gemfile.rails41 +7 -7
  35. data/spec/gemfiles/Gemfile.rails42 +7 -7
  36. data/spec/gemfiles/Gemfile.rails50 +7 -10
  37. data/spec/gemfiles/Gemfile.rails51 +7 -10
  38. data/spec/gemfiles/Gemfile.rails52 +7 -0
  39. data/spec/gemfiles/Gemfile.rails60 +7 -0
  40. data/spec/gemfiles/Gemfile.rails61 +7 -0
  41. data/spec/integration/active_record/active_record_spec.rb +41 -38
  42. data/spec/integration/mongoid/mongoid_spec.rb +39 -37
  43. data/spec/integration/shared/at_time.rb +53 -0
  44. data/spec/integration/shared/between_dates.rb +99 -0
  45. data/spec/integration/shared/between_times.rb +99 -82
  46. data/spec/integration/shared/by_calendar_month.rb +55 -55
  47. data/spec/integration/shared/by_cweek.rb +54 -54
  48. data/spec/integration/shared/by_day.rb +120 -96
  49. data/spec/integration/shared/by_direction.rb +126 -172
  50. data/spec/integration/shared/by_fortnight.rb +48 -48
  51. data/spec/integration/shared/by_month.rb +50 -50
  52. data/spec/integration/shared/by_quarter.rb +49 -49
  53. data/spec/integration/shared/by_week.rb +54 -54
  54. data/spec/integration/shared/by_weekend.rb +49 -49
  55. data/spec/integration/shared/by_year.rb +48 -48
  56. data/spec/integration/shared/index_scope_parameter.rb +111 -0
  57. data/spec/integration/shared/offset_parameter.rb +32 -32
  58. data/spec/integration/shared/order_parameter.rb +36 -36
  59. data/spec/integration/shared/relative.rb +174 -174
  60. data/spec/spec_helper.rb +33 -29
  61. data/spec/unit/kernel_date_spec.rb +113 -113
  62. data/spec/unit/kernel_time_spec.rb +57 -57
  63. data/spec/unit/normalization_spec.rb +384 -305
  64. data/tmp/.gitignore +1 -1
  65. metadata +33 -21
  66. data/spec/gemfiles/Gemfile.master +0 -6
  67. data/spec/integration/shared/scope_parameter.rb +0 -73
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b215af1453a6bb5552109578699e5bc4e5e18aa4df583461b3eb9544dfba72e7
4
- data.tar.gz: 43918eb7759cd1539fe52f3c9d33f087029e302dc25d28842b73485cc446ec67
3
+ metadata.gz: bdd3d75b02a82124876d494939608637ee8afe18fae34f84ed4721a86cc609a7
4
+ data.tar.gz: dc0d558b3c579515b38441f98c165a045c50dd017205604019db7636a3590926
5
5
  SHA512:
6
- metadata.gz: f15335c52f3dea9f54dfbf054d8b1e532535cc7cd1c9616bd7b5bf1d1a4274fb0df3d4c2619025ab1f6db975b46a93a74f77458e3533fa3867c0aaaa39a48b6a
7
- data.tar.gz: eba9a69f7a83a0b8c65e4c1bee16451f6f4beeec1eb65d836e8b22841bfa70e02b4136b8f495577b91e023ed5f709221547ea9cc067d816a66c28e3f6ded0e27
6
+ metadata.gz: cd0cf04c47b2a005198685ad0be11f8a66b4366c671b431fe1c20639a9d7ebe01364c0f243f62d4c135acddc593c4d3fd826fdf7e3944b222406853713cf2284
7
+ data.tar.gz: e17406f6a21702072c8b23835a437545981fcb301eabedc05a0a754aa35d1af479c57f64ae926a973ed474c6eee60e54bc168496a79537ccd891f4becfd68cd8
@@ -0,0 +1,92 @@
1
+ name: MySQL tests
2
+
3
+ on:
4
+ # Trigger the workflow on push or pull request,
5
+ # but only for the master branch
6
+ push:
7
+ branches:
8
+ - master
9
+ pull_request:
10
+ branches:
11
+ - master
12
+
13
+ jobs:
14
+ mysql:
15
+ strategy:
16
+ fail-fast: false
17
+ matrix:
18
+ ruby_version: [3.0, 2.7, 2.6, 2.5, jruby]
19
+ gemfile:
20
+ [
21
+ spec/gemfiles/Gemfile.rails50,
22
+ spec/gemfiles/Gemfile.rails51,
23
+ spec/gemfiles/Gemfile.rails52,
24
+ spec/gemfiles/Gemfile.rails60,
25
+ spec/gemfiles/Gemfile.rails61,
26
+ spec/gemfiles/Gemfile.rails,
27
+ ]
28
+ exclude:
29
+ # Ruby 3.x is not supported by Rails 5.2.x
30
+ - ruby_version: 3.0
31
+ gemfile: spec/gemfiles/Gemfile.rails52
32
+ # Ruby 3.x is not supported by Rails 5.1.x
33
+ - ruby_version: 3.0
34
+ gemfile: spec/gemfiles/Gemfile.rails51
35
+ # Ruby 3.x is not supported by Rails 5.0.x
36
+ - ruby_version: 3.0
37
+ gemfile: spec/gemfiles/Gemfile.rails50
38
+
39
+ - ruby_version: 2.6
40
+ gemfile: spec/gemfiles/Gemfile.rails32
41
+
42
+ # Ruby 2.6.x is not supported by Rails main
43
+ - ruby_version: 2.6
44
+ gemfile: spec/gemfiles/Gemfile.rails
45
+
46
+ # Ruby 2.5.x is not supported by Rails main
47
+ - ruby_version: 2.5
48
+ gemfile: spec/gemfiles/Gemfile.rails
49
+
50
+ # Ruby 2.4.x is not supported by Rails main
51
+ - ruby_version: 2.4
52
+ gemfile: spec/gemfiles/Gemfile.rails
53
+ # Ruby 2.4.x is not supported by Rails 6.1.x
54
+ - ruby_version: 2.4
55
+ gemfile: spec/gemfiles/Gemfile.rails61
56
+ # Ruby 2.4.x is not supported by Rails 6.0.x
57
+ - ruby_version: 2.4
58
+ gemfile: spec/gemfiles/Gemfile.rails60
59
+ # Ruby 2.3.x is not supported by Rails 6.1.x
60
+ - ruby_version: 2.3
61
+ gemfile: spec/gemfiles/Gemfile.rails61
62
+ # Ruby 2.3.x is not supported by Rails main
63
+ - ruby_version: 2.3
64
+ gemfile: spec/gemfiles/Gemfile.rails
65
+ # Ruby 2.3.x is not supported by Rails 6.0.x
66
+ - ruby_version: 2.3
67
+ gemfile: spec/gemfiles/Gemfile.rails60
68
+ # JRuby is not supported by Rails main
69
+ - ruby_version: jruby
70
+ gemfile: spec/gemfiles/Gemfile.rails
71
+
72
+ runs-on: ubuntu-latest
73
+
74
+ steps:
75
+ - uses: actions/checkout@v2
76
+
77
+ - name: Set up Ruby
78
+ uses: ruby/setup-ruby@master
79
+ with:
80
+ ruby-version: ${{ matrix.ruby_version }}
81
+
82
+ - name: Start MySQL
83
+ - run: sudo /etc/init.d/mysql start
84
+
85
+ - name: Build and test with Rake
86
+ env:
87
+ BUNDLE_GEMFILE: ${{ matrix.gemfile }}
88
+ DB: "postgres"
89
+ run: |
90
+ gem install bundler
91
+ bundle install --jobs 4 --retry 3
92
+ bundle exec rake
@@ -0,0 +1,99 @@
1
+ name: PostgreSQL tests
2
+
3
+ on:
4
+ # Trigger the workflow on push or pull request,
5
+ # but only for the master branch
6
+ push:
7
+ branches:
8
+ - master
9
+ pull_request:
10
+ branches:
11
+ - master
12
+
13
+ jobs:
14
+ postgresql:
15
+ strategy:
16
+ fail-fast: false
17
+ matrix:
18
+ ruby_version: [3.0, 2.7, 2.6, 2.5, jruby]
19
+ gemfile:
20
+ [
21
+ spec/gemfiles/Gemfile.rails50,
22
+ spec/gemfiles/Gemfile.rails51,
23
+ spec/gemfiles/Gemfile.rails52,
24
+ spec/gemfiles/Gemfile.rails60,
25
+ spec/gemfiles/Gemfile.rails61,
26
+ spec/gemfiles/Gemfile.rails,
27
+ ]
28
+ exclude:
29
+ # Ruby 3.x is not supported by Rails 5.2.x
30
+ - ruby_version: 3.0
31
+ gemfile: spec/gemfiles/Gemfile.rails52
32
+ # Ruby 3.x is not supported by Rails 5.1.x
33
+ - ruby_version: 3.0
34
+ gemfile: spec/gemfiles/Gemfile.rails51
35
+ # Ruby 3.x is not supported by Rails 5.0.x
36
+ - ruby_version: 3.0
37
+ gemfile: spec/gemfiles/Gemfile.rails50
38
+
39
+ - ruby_version: 2.6
40
+ gemfile: spec/gemfiles/Gemfile.rails32
41
+
42
+ # Ruby 2.6.x is not supported by Rails main
43
+ - ruby_version: 2.6
44
+ gemfile: spec/gemfiles/Gemfile.rails
45
+
46
+ # Ruby 2.5.x is not supported by Rails main
47
+ - ruby_version: 2.5
48
+ gemfile: spec/gemfiles/Gemfile.rails
49
+
50
+ # Ruby 2.4.x is not supported by Rails main
51
+ - ruby_version: 2.4
52
+ gemfile: spec/gemfiles/Gemfile.rails
53
+ # Ruby 2.4.x is not supported by Rails 6.1.x
54
+ - ruby_version: 2.4
55
+ gemfile: spec/gemfiles/Gemfile.rails61
56
+ # Ruby 2.4.x is not supported by Rails 6.0.x
57
+ - ruby_version: 2.4
58
+ gemfile: spec/gemfiles/Gemfile.rails60
59
+ # Ruby 2.3.x is not supported by Rails 6.1.x
60
+ - ruby_version: 2.3
61
+ gemfile: spec/gemfiles/Gemfile.rails61
62
+ # Ruby 2.3.x is not supported by Rails main
63
+ - ruby_version: 2.3
64
+ gemfile: spec/gemfiles/Gemfile.rails
65
+ # Ruby 2.3.x is not supported by Rails 6.0.x
66
+ - ruby_version: 2.3
67
+ gemfile: spec/gemfiles/Gemfile.rails60
68
+ # JRuby is not supported by Rails main
69
+ - ruby_version: jruby
70
+ gemfile: spec/gemfiles/Gemfile.rails
71
+
72
+ runs-on: ubuntu-latest
73
+
74
+ steps:
75
+ - uses: actions/checkout@v2
76
+
77
+ - name: Set up Ruby
78
+ uses: ruby/setup-ruby@master
79
+ with:
80
+ ruby-version: ${{ matrix.ruby_version }}
81
+
82
+ - uses: harmon758/postgresql-action@v1
83
+ with:
84
+ postgresql version: '11'
85
+
86
+ - name: Start PostgreSQL
87
+ run: |
88
+ sudo service postgresql start
89
+ sudo -u postgres createuser --superuser "$USER"
90
+ createdb by_star_test
91
+
92
+ - name: Build and test with Rake
93
+ env:
94
+ BUNDLE_GEMFILE: ${{ matrix.gemfile }}
95
+ DB: "postgres"
96
+ run: |
97
+ gem install bundler
98
+ bundle install --jobs 4 --retry 3
99
+ bundle exec rake
data/.gitignore CHANGED
@@ -1,5 +1,6 @@
1
- tmp
2
- spec/fixtures/database.yml
3
- pkg
4
- by_star.sqlite3
5
- Gemfile.lock
1
+ .idea
2
+ tmp
3
+ spec/fixtures/database.yml
4
+ pkg
5
+ by_star.sqlite3
6
+ Gemfile.lock
data/.travis.yml CHANGED
@@ -1,61 +1,92 @@
1
- before_install:
2
- - gem update --system
3
- - gem update bundler
4
-
5
- before_script:
6
- - "mysql -e 'create database by_star_test;'"
7
- - "psql -c 'create database by_star_test;' -U postgres"
8
-
9
- env:
10
- - DB=sqlite
11
- - DB=mysql
12
- - DB=postgres
13
- - DB=mongodb
14
-
15
- gemfile:
16
- - spec/gemfiles/Gemfile.rails40
17
- - spec/gemfiles/Gemfile.rails41
18
- - spec/gemfiles/Gemfile.rails42
19
- - spec/gemfiles/Gemfile.rails50
20
- - spec/gemfiles/Gemfile.rails51
21
- - spec/gemfiles/Gemfile.master
22
-
23
- notifications:
24
- email:
25
- - radarlistener@gmail.com
26
-
27
- branches:
28
- only:
29
- - master
30
-
31
- rvm:
32
- - 2.0.0
33
- - 2.1.9
34
- - 2.2.5
35
- - 2.3.1
36
- - 2.4.2
37
- - 2.5.0
38
-
39
- matrix:
40
- exclude:
41
- - rvm: 2.0.0
42
- gemfile: "spec/gemfiles/Gemfile.rails50"
43
- - rvm: 2.0.0
44
- gemfile: "spec/gemfiles/Gemfile.rails51"
45
- - rvm: 2.1.9
46
- gemfile: "spec/gemfiles/Gemfile.rails50"
47
- - rvm: 2.1.9
48
- gemfile: "spec/gemfiles/Gemfile.rails51"
49
- - rvm: 2.4.2
50
- gemfile: "spec/gemfiles/Gemfile.rails40"
51
- - rvm: 2.5.0
52
- gemfile: "spec/gemfiles/Gemfile.rails40"
53
- - rvm: 2.4.2
54
- gemfile: "spec/gemfiles/Gemfile.rails41"
55
- - rvm: 2.5.0
56
- gemfile: "spec/gemfiles/Gemfile.rails41"
57
- allow_failures:
58
- - gemfile: spec/gemfiles/Gemfile.master
59
-
60
-
61
- services: mongodb
1
+ services: mongodb
2
+
3
+ before_script:
4
+ - "mysql -e 'create database by_star_test;'"
5
+ - "psql -c 'create database by_star_test;' -U postgres"
6
+
7
+ env:
8
+ - DB=sqlite
9
+ - DB=mysql
10
+ - DB=postgres
11
+ - DB=mongodb
12
+
13
+ gemfile:
14
+ - spec/gemfiles/Gemfile.rails32
15
+ - spec/gemfiles/Gemfile.rails40
16
+ - spec/gemfiles/Gemfile.rails41
17
+ - spec/gemfiles/Gemfile.rails42
18
+ - spec/gemfiles/Gemfile.rails50
19
+ - spec/gemfiles/Gemfile.rails51
20
+ - spec/gemfiles/Gemfile.rails52
21
+ - spec/gemfiles/Gemfile.master
22
+
23
+ rvm:
24
+ - 2.0.0
25
+ - 2.1.10
26
+ - 2.2.10
27
+ - 2.3.8
28
+ - 2.4.6
29
+ - 2.5.5
30
+ - 2.6.3
31
+
32
+ matrix:
33
+ fast_finish: true
34
+
35
+ exclude:
36
+ - gemfile: 'spec/gemfiles/Gemfile.rails32'
37
+ rvm: 2.2.10
38
+ - gemfile: 'spec/gemfiles/Gemfile.rails32'
39
+ rvm: 2.3.8
40
+ - gemfile: 'spec/gemfiles/Gemfile.rails32'
41
+ rvm: 2.4.6
42
+ - gemfile: 'spec/gemfiles/Gemfile.rails32'
43
+ rvm: 2.5.5
44
+ - gemfile: 'spec/gemfiles/Gemfile.rails32'
45
+ rvm: 2.6.3
46
+ - gemfile: 'spec/gemfiles/Gemfile.rails40'
47
+ rvm: 2.4.6
48
+ - gemfile: 'spec/gemfiles/Gemfile.rails40'
49
+ rvm: 2.5.5
50
+ - gemfile: 'spec/gemfiles/Gemfile.rails40'
51
+ rvm: 2.6.3
52
+ - gemfile: 'spec/gemfiles/Gemfile.rails41'
53
+ rvm: 2.4.6
54
+ - gemfile: 'spec/gemfiles/Gemfile.rails41'
55
+ rvm: 2.5.5
56
+ - gemfile: 'spec/gemfiles/Gemfile.rails41'
57
+ rvm: 2.6.3
58
+ - gemfile: 'spec/gemfiles/Gemfile.rails50'
59
+ rvm: 2.0.0
60
+ - gemfile: 'spec/gemfiles/Gemfile.rails50'
61
+ rvm: 2.1.10
62
+ - gemfile: 'spec/gemfiles/Gemfile.rails50'
63
+ rvm: 2.6.3
64
+ - gemfile: 'spec/gemfiles/Gemfile.rails51'
65
+ rvm: 2.0.0
66
+ - gemfile: 'spec/gemfiles/Gemfile.rails51'
67
+ rvm: 2.1.10
68
+ - gemfile: 'spec/gemfiles/Gemfile.rails51'
69
+ rvm: 2.6.3
70
+ - gemfile: 'spec/gemfiles/Gemfile.rails52'
71
+ rvm: 2.0.0
72
+ - gemfile: 'spec/gemfiles/Gemfile.rails52'
73
+ rvm: 2.1.10
74
+
75
+ allow_failures:
76
+ - gemfile: 'spec/gemfiles/Gemfile.master'
77
+ - gemfile: 'spec/gemfiles/Gemfile.rails32'
78
+ env: 'DB=sqlite'
79
+ - gemfile: 'spec/gemfiles/Gemfile.rails32'
80
+ env: 'DB=mysql'
81
+ - gemfile: 'spec/gemfiles/Gemfile.rails40'
82
+ env: 'DB=sqlite'
83
+ - gemfile: 'spec/gemfiles/Gemfile.rails40'
84
+ env: 'DB=mysql'
85
+ - gemfile: 'spec/gemfiles/Gemfile.rails41'
86
+ env: 'DB=sqlite'
87
+ - gemfile: 'spec/gemfiles/Gemfile.rails41'
88
+ env: 'DB=mysql'
89
+ - gemfile: 'spec/gemfiles/Gemfile.rails42'
90
+ env: 'DB=sqlite'
91
+ - gemfile: 'spec/gemfiles/Gemfile.rails50'
92
+ env: 'DB=sqlite'
data/CHANGELOG.md CHANGED
@@ -1,44 +1,63 @@
1
- # CHANGELOG
2
-
3
- ## v3.0.0
4
-
5
- * Upgrade Travis for broader coverage of Ruby, ActiveRecord, and Mongoid versions - @johnnyshields
6
- * Removed support for Ruby < 2.0 and Rails < 4.0. They are over 5 years old, and so it's time to upgrade. - @radar
7
- * Removed references to deprecated Fixnum constant - @rgioia - #78
8
- * Mongoid `newest`, `oldest`, `previous`, and `next` now use `reorder` to ignore any default scope, consistent with ActiveRecord - @johnnyshields
9
- * Mongoid 3.x: Add support for `Criteria#reorder` method from version 4+ - @johnnyshields
10
- * Upgrade Rspec tests to version 3.1 - @nhocki
11
-
12
- ## v2.2.1 - 2014-04-21
13
-
14
- * Allow `previous` and `next` to take the current record in their scope - @pnomolos / @johnnyshields
15
- * Alias `Date#in_time_zone` to `#to_time_in_current_zone` if not already defined (e.g. for Rails <= 3) - @jcypret / @johnnyshields
16
- * Add `oldest` and `newest` methods
17
-
18
- ## v2.2.0 - 2014-04-01
19
-
20
- * Add `:scope` parameter support on all finders - @pnomolos / @johnnyshields
21
- * Feature: Add `past_*` and `next_*` finders - @davegudge
22
- * Bug Fix: `:field`, `:start_field`, and `:end_field` options were being ignored on finder - @johnnyshields / @gamov
23
- * Bug Fix: `by_star_field` should accept options without start/end_time args - @johnnyshields
24
- * Improve readme documentation - @johnnyshields
25
-
26
- ## v2.2.0.rc1 - 2014-01-14
27
-
28
- * Begin tracking CHANGELOG
29
- * Drop official support for Ruby <= 1.9.2
30
- * Add Ruby 2.1.0, Rubinius, and JRuby to Travis
31
- * Decouple gem from ActiveRecord, and put ActiveRecord and Mongoid specific methods in ORM modules.
32
- * Consolidate all normalization/parsing functions into new Normalization module
33
- * Remove meta-programming methods, e.g. `send("by_week_#{time_klass}")`
34
- * Support matching timespan-type objects with distinct start and end times (previously only point-in-time matching was supported)
35
- * Make Chronic gem optional; use it only if user has included it externally
36
- * `by_week` always returns a calendar week (i.e. beginning Monday or as specified by Rails setting), regardless of whether Date or Fixnum is given as a parameter.
37
- * `by_week` and `by_calendar_month` now supports optional `:start_day` option (:monday, :tuesday, etc)
38
- * Separate `by_calendar_month` into it's own class
39
- * Rename `between` method to `between_times` internally, as Mongoid already defines `between`. ActiveRecord has an alias of `between` so interface stays consistent.
40
- * Add `:offset` option to all query methods, in order to offset the time the day begins/ends (for example supposing business cycle begins at 8:00 each day until 7:59:59 the next day)
41
- * `by_weekend` can now take a fixnum (parsing logic is same as by_week)
42
- * Two-digit year now considers 70 to be 1970, and 69 to be 2069 (was previously 40 -> 1940)
43
- * Add Time kernel extensions for fortnight and calendar_month
44
- * Add Johnny Shields as a gem co-author
1
+ # CHANGELOG
2
+
3
+ ## v4.0.1 - 2023-01-18
4
+
5
+ * Change `File.exists?` to `File.exist?` to support Ruby 3.2.0 - @JNajera
6
+
7
+ ## v4.0.0 - 2022-03-07
8
+
9
+ * BREAKING CHANGE - `#between` method has been removed (was deprecated in 2.2.0)
10
+ * BREAKING CHANGE - `:order` arg for `#between_times` has been removed.
11
+ * BREAKING CHANGE - Drop support for option `:year` used as a standalone. Use `by_year` instead.
12
+ * BREAKING CHANGE - `#between_times` now queries on records until end of day on `end_time`, if it is a date.
13
+ * `#between_times` now accepts one-sided arguments, e.g. `Time, nil` or `nil, Time`.
14
+ * `#between_times` now accepts `Range` or `Array` as an argument, while continuing to support existing `Time, Time` interface.
15
+ * Add `#at_time` method for point-in-time query.
16
+ * Timespan "strict" query now sets double-sided constraints on both fields to ensure database indexes are used properly.
17
+ * Add optional `:index_scope` option for timespan "non-strict" queries to improve database performance.
18
+ * Fixes `offset` option to set hour, min, and sec of day for queries on dates for better DST support.
19
+ * More consistent application of `Time.zone`.
20
+ * Re-add test coverage for Rails 3.2. This will be removed when we upgrade to Ruby 2.2+ as minimum version.
21
+
22
+ ## v3.0.0
23
+
24
+ * Upgrade Travis for broader coverage of Ruby, ActiveRecord, and Mongoid versions - @johnnyshields
25
+ * Removed support for Ruby < 2.0 and Rails < 4.0. They are over 5 years old, and so it's time to upgrade. - @radar
26
+ * Removed references to deprecated Fixnum constant - @rgioia - #78
27
+ * Mongoid `newest`, `oldest`, `previous`, and `next` now use `reorder` to ignore any default scope, consistent with ActiveRecord - @johnnyshields
28
+ * Mongoid 3.x: Add support for `Criteria#reorder` method from version 4+ - @johnnyshields
29
+ * Upgrade Rspec tests to version 3.1 - @nhocki
30
+
31
+ ## v2.2.1 - 2014-04-21
32
+
33
+ * Allow `previous` and `next` to take the current record in their scope - @pnomolos / @johnnyshields
34
+ * Alias `Date#in_time_zone` to `#to_time_in_current_zone` if not already defined (e.g. for Rails <= 3) - @jcypret / @johnnyshields
35
+ * Add `oldest` and `newest` methods
36
+
37
+ ## v2.2.0 - 2014-04-01
38
+
39
+ * Add `:scope` parameter support on all finders - @pnomolos / @johnnyshields
40
+ * Feature: Add `past_*` and `next_*` finders - @davegudge
41
+ * Bug Fix: `:field`, `:start_field`, and `:end_field` options were being ignored on finder - @johnnyshields / @gamov
42
+ * Bug Fix: `by_star_field` should accept options without start/end_time args - @johnnyshields
43
+ * Improve readme documentation - @johnnyshields
44
+
45
+ ## v2.2.0.rc1 - 2014-01-14
46
+
47
+ * Begin tracking CHANGELOG
48
+ * Drop official support for Ruby <= 1.9.2
49
+ * Add Ruby 2.1.0, Rubinius, and JRuby to Travis
50
+ * Decouple gem from ActiveRecord, and put ActiveRecord and Mongoid specific methods in ORM modules.
51
+ * Consolidate all normalization/parsing functions into new Normalization module
52
+ * Remove meta-programming methods, e.g. `send("by_week_#{time_klass}")`
53
+ * Support matching timespan-type objects with distinct start and end times (previously only point-in-time matching was supported)
54
+ * Make Chronic gem optional; use it only if user has included it externally
55
+ * `by_week` always returns a calendar week (i.e. beginning Monday or as specified by Rails setting), regardless of whether Date or Fixnum is given as a parameter.
56
+ * `by_week` and `by_calendar_month` now supports optional `:start_day` option (:monday, :tuesday, etc)
57
+ * Separate `by_calendar_month` into it's own class
58
+ * Rename `between` method to `between_times` internally, as Mongoid already defines `between`. ActiveRecord has an alias of `between` so interface stays consistent.
59
+ * Add `:offset` option to all query methods, in order to offset the time the day begins/ends (for example supposing business cycle begins at 8:00 each day until 7:59:59 the next day)
60
+ * `by_weekend` can now take a fixnum (parsing logic is same as by_week)
61
+ * Two-digit year now considers 70 to be 1970, and 69 to be 2069 (was previously 40 -> 1940)
62
+ * Add Time kernel extensions for fortnight and calendar_month
63
+ * Add Johnny Shields as a gem co-author
data/Gemfile CHANGED
@@ -1,18 +1,18 @@
1
- source 'http://rubygems.org'
2
-
3
- gemspec
4
-
5
- ar_version = ENV['ACTIVE_RECORD_VERSION']
6
- ar_version = case ar_version
7
- when 'master' then {github: 'rails'}
8
- when String then "~> #{ar_version}"
9
- end
10
-
11
- mo_version = ENV['MONGOID_VERSION']
12
- mo_version = case mo_version
13
- when 'master' then {github: 'mongoid'}
14
- when String then "~> #{mo_version}"
15
- end
16
-
17
- gem 'activerecord', ar_version if ar_version
18
- gem 'mongoid', mo_version if mo_version
1
+ source 'http://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ ar_version = ENV['ACTIVE_RECORD_VERSION']
6
+ ar_version = case ar_version
7
+ when 'master' then {github: 'rails'}
8
+ when String then "~> #{ar_version}"
9
+ end
10
+
11
+ mo_version = ENV['MONGOID_VERSION']
12
+ mo_version = case mo_version
13
+ when 'master' then {github: 'mongoid'}
14
+ when String then "~> #{mo_version}"
15
+ end
16
+
17
+ gem 'activerecord', ar_version if ar_version
18
+ gem 'mongoid', mo_version if mo_version
data/MIT-LICENSE CHANGED
@@ -1,20 +1,20 @@
1
- Copyright (c) 2008 Ryan Bigg
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- "Software"), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1
+ Copyright (c) 2008 Ryan Bigg
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.