ta_by_star 4.0.0
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.
- checksums.yaml +7 -0
- data/CHANGELOG.md +59 -0
- data/Gemfile +18 -0
- data/MIT-LICENSE +20 -0
- data/README.md +616 -0
- data/Rakefile +18 -0
- data/UPGRADING +4 -0
- data/by_star.gemspec +34 -0
- data/cleaner.rb +25 -0
- data/lib/by_star/base.rb +76 -0
- data/lib/by_star/between.rb +190 -0
- data/lib/by_star/directional.rb +35 -0
- data/lib/by_star/kernel/date.rb +41 -0
- data/lib/by_star/kernel/in_time_zone.rb +20 -0
- data/lib/by_star/kernel/time.rb +41 -0
- data/lib/by_star/normalization.rb +156 -0
- data/lib/by_star/orm/active_record/by_star.rb +75 -0
- data/lib/by_star/orm/mongoid/by_star.rb +90 -0
- data/lib/by_star/orm/mongoid/reorder.rb +23 -0
- data/lib/by_star/version.rb +3 -0
- data/lib/by_star.rb +18 -0
- data/spec/database.yml +15 -0
- data/spec/fixtures/active_record/models.rb +12 -0
- data/spec/fixtures/active_record/schema.rb +19 -0
- data/spec/fixtures/mongoid/models.rb +31 -0
- data/spec/fixtures/shared/seeds.rb +36 -0
- data/spec/gemfiles/Gemfile.rails +5 -0
- data/spec/gemfiles/Gemfile.rails32 +7 -0
- data/spec/gemfiles/Gemfile.rails40 +7 -0
- data/spec/gemfiles/Gemfile.rails41 +7 -0
- data/spec/gemfiles/Gemfile.rails42 +7 -0
- data/spec/gemfiles/Gemfile.rails50 +7 -0
- data/spec/gemfiles/Gemfile.rails51 +7 -0
- data/spec/gemfiles/Gemfile.rails52 +7 -0
- data/spec/gemfiles/Gemfile.rails60 +7 -0
- data/spec/gemfiles/Gemfile.rails61 +7 -0
- data/spec/integration/active_record/active_record_spec.rb +41 -0
- data/spec/integration/mongoid/mongoid_spec.rb +39 -0
- data/spec/integration/shared/at_time.rb +53 -0
- data/spec/integration/shared/between_dates.rb +99 -0
- data/spec/integration/shared/between_times.rb +99 -0
- data/spec/integration/shared/by_calendar_month.rb +55 -0
- data/spec/integration/shared/by_cweek.rb +54 -0
- data/spec/integration/shared/by_day.rb +120 -0
- data/spec/integration/shared/by_direction.rb +126 -0
- data/spec/integration/shared/by_fortnight.rb +48 -0
- data/spec/integration/shared/by_month.rb +50 -0
- data/spec/integration/shared/by_quarter.rb +49 -0
- data/spec/integration/shared/by_week.rb +54 -0
- data/spec/integration/shared/by_weekend.rb +49 -0
- data/spec/integration/shared/by_year.rb +48 -0
- data/spec/integration/shared/index_scope_parameter.rb +111 -0
- data/spec/integration/shared/offset_parameter.rb +32 -0
- data/spec/integration/shared/order_parameter.rb +36 -0
- data/spec/integration/shared/relative.rb +174 -0
- data/spec/spec_helper.rb +33 -0
- data/spec/unit/kernel_date_spec.rb +113 -0
- data/spec/unit/kernel_time_spec.rb +57 -0
- data/spec/unit/normalization_spec.rb +384 -0
- data/tmp/.gitignore +1 -0
- metadata +298 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 70c7ecd9a51610dba33682df8ea69432b059baf9111c6de3f9d2724967d6b5ec
|
4
|
+
data.tar.gz: 255d0993ef528bd26ea2f8eb251d0e24f59e8b41f79382c2484364613764bd76
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 575ce56b6d1db5d5d87f274d2951ae8c9d145b8351dc7cde72465104a2656035695a0a4668a43eda8e872192b96a60afa79a0ba7b3396d487ec2a7ae24586234
|
7
|
+
data.tar.gz: ae7ad6a84b909a30977fc0a0e7e41427eeb5c6ada915d0f0cc2733f7432148eb9888fe58d5d949bdc3a9726491806473ee43e2052d1c229cdf98428897dedfb0
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
# CHANGELOG
|
2
|
+
|
3
|
+
## v4.0.0 - Unreleased
|
4
|
+
|
5
|
+
* BREAKING CHANGE - `#between` method has been removed (was deprecated in 2.2.0)
|
6
|
+
* BREAKING CHANGE - `:order` arg for `#between_times` has been removed.
|
7
|
+
* BREAKING CHANGE - Drop support for option `:year` used as a standalone. Use `by_year` instead.
|
8
|
+
* BREAKING CHANGE - `#between_times` now queries on records until end of day on `end_time`, if it is a date.
|
9
|
+
* `#between_times` now accepts one-sided arguments, e.g. `Time, nil` or `nil, Time`.
|
10
|
+
* `#between_times` now accepts `Range` or `Array` as an argument, while continuing to support existing `Time, Time` interface.
|
11
|
+
* Add `#at_time` method for point-in-time query.
|
12
|
+
* Timespan "strict" query now sets double-sided constraints on both fields to ensure database indexes are used properly.
|
13
|
+
* Add optional `:index_scope` option for timespan "non-strict" queries to improve database performance.
|
14
|
+
* Fixes `offset` option to set hour, min, and sec of day for queries on dates for better DST support.
|
15
|
+
* More consistent application of `Time.zone`.
|
16
|
+
* Re-add test coverage for Rails 3.2. This will be removed when we upgrade to Ruby 2.2+ as minimum version.
|
17
|
+
|
18
|
+
## v3.0.0
|
19
|
+
|
20
|
+
* Upgrade Travis for broader coverage of Ruby, ActiveRecord, and Mongoid versions - @johnnyshields
|
21
|
+
* Removed support for Ruby < 2.0 and Rails < 4.0. They are over 5 years old, and so it's time to upgrade. - @radar
|
22
|
+
* Removed references to deprecated Fixnum constant - @rgioia - #78
|
23
|
+
* Mongoid `newest`, `oldest`, `previous`, and `next` now use `reorder` to ignore any default scope, consistent with ActiveRecord - @johnnyshields
|
24
|
+
* Mongoid 3.x: Add support for `Criteria#reorder` method from version 4+ - @johnnyshields
|
25
|
+
* Upgrade Rspec tests to version 3.1 - @nhocki
|
26
|
+
|
27
|
+
## v2.2.1 - 2014-04-21
|
28
|
+
|
29
|
+
* Allow `previous` and `next` to take the current record in their scope - @pnomolos / @johnnyshields
|
30
|
+
* Alias `Date#in_time_zone` to `#to_time_in_current_zone` if not already defined (e.g. for Rails <= 3) - @jcypret / @johnnyshields
|
31
|
+
* Add `oldest` and `newest` methods
|
32
|
+
|
33
|
+
## v2.2.0 - 2014-04-01
|
34
|
+
|
35
|
+
* Add `:scope` parameter support on all finders - @pnomolos / @johnnyshields
|
36
|
+
* Feature: Add `past_*` and `next_*` finders - @davegudge
|
37
|
+
* Bug Fix: `:field`, `:start_field`, and `:end_field` options were being ignored on finder - @johnnyshields / @gamov
|
38
|
+
* Bug Fix: `by_star_field` should accept options without start/end_time args - @johnnyshields
|
39
|
+
* Improve readme documentation - @johnnyshields
|
40
|
+
|
41
|
+
## v2.2.0.rc1 - 2014-01-14
|
42
|
+
|
43
|
+
* Begin tracking CHANGELOG
|
44
|
+
* Drop official support for Ruby <= 1.9.2
|
45
|
+
* Add Ruby 2.1.0, Rubinius, and JRuby to Travis
|
46
|
+
* Decouple gem from ActiveRecord, and put ActiveRecord and Mongoid specific methods in ORM modules.
|
47
|
+
* Consolidate all normalization/parsing functions into new Normalization module
|
48
|
+
* Remove meta-programming methods, e.g. `send("by_week_#{time_klass}")`
|
49
|
+
* Support matching timespan-type objects with distinct start and end times (previously only point-in-time matching was supported)
|
50
|
+
* Make Chronic gem optional; use it only if user has included it externally
|
51
|
+
* `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.
|
52
|
+
* `by_week` and `by_calendar_month` now supports optional `:start_day` option (:monday, :tuesday, etc)
|
53
|
+
* Separate `by_calendar_month` into it's own class
|
54
|
+
* Rename `between` method to `between_times` internally, as Mongoid already defines `between`. ActiveRecord has an alias of `between` so interface stays consistent.
|
55
|
+
* 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)
|
56
|
+
* `by_weekend` can now take a fixnum (parsing logic is same as by_week)
|
57
|
+
* Two-digit year now considers 70 to be 1970, and 69 to be 2069 (was previously 40 -> 1940)
|
58
|
+
* Add Time kernel extensions for fortnight and calendar_month
|
59
|
+
* Add Johnny Shields as a gem co-author
|
data/Gemfile
ADDED
@@ -0,0 +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
|
data/MIT-LICENSE
ADDED
@@ -0,0 +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.
|