boolean_timestamp 0.2.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.git-blame-ignore-revs +13 -0
- data/.github/workflows/ci.yml +83 -0
- data/.gitignore +0 -1
- data/.standard.yml +3 -0
- data/Appraisals +8 -22
- data/CHANGELOG.md +25 -1
- data/Gemfile +10 -1
- data/Gemfile.lock +102 -0
- data/README.md +79 -6
- data/Rakefile +3 -1
- data/boolean_timestamp.gemspec +17 -27
- data/gemfiles/activerecord_5_2.gemfile +8 -0
- data/gemfiles/activerecord_6_0.gemfile +19 -0
- data/gemfiles/activerecord_6_1.gemfile +19 -0
- data/gemfiles/activerecord_7_0.gemfile +19 -0
- data/lib/boolean_timestamp/version.rb +1 -1
- data/lib/boolean_timestamp.rb +36 -21
- metadata +19 -145
- data/.travis.yml +0 -41
- data/gemfiles/activerecord_4_0.gemfile +0 -13
- data/gemfiles/activerecord_4_1.gemfile +0 -13
- data/gemfiles/activerecord_4_2.gemfile +0 -13
- data/gemfiles/activerecord_5_0.gemfile +0 -11
- data/gemfiles/activerecord_5_1.gemfile +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 3738817bfe23ad90e764681488a280e00781a7d666d76abf0c2694afc89f396b
|
4
|
+
data.tar.gz: ba3d43865593bb497ecb98546fa1027801fbd8598686e81ce724cb4c897a836f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 63c110852a36838f83e618d00e02e3dff1542cfa5f1004bc218535aee73886754c0aefdfabdd1d50d46ce8aa1334d02291ceebbf8564fadb8fca44831161c72c
|
7
|
+
data.tar.gz: 509344e839b843bb8da7f24354e84956cf5fb06b766dcfed950249229a6e06362e4647340dfcedc88e092a85d49e85431b18b3b4082a2c5c1683e2de07750b84
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# These commits should be ignored by git-blame, making it much easier to step through the history
|
2
|
+
# of a line without hitting formatting commits (esp. large, update-all-the-files sorts of commits).
|
3
|
+
#
|
4
|
+
# For git-blame to ignore these revisions, you'll need to tell it about this file.
|
5
|
+
#
|
6
|
+
# You can either pass it to the command each time:
|
7
|
+
# git blame --ignore-rev-file=.git-blame-ignore-revs -L 12,14 lib/repeatable/conversions.rb
|
8
|
+
#
|
9
|
+
# Or you can set it as a config value, which will be used by all git-blame commands henceforth:
|
10
|
+
# git config blame.ignoreRevsFile .git-blame-ignore-revs
|
11
|
+
|
12
|
+
# Initial style fix after introducing Standard
|
13
|
+
16899ecbfea2c371ed1fafada52e6abe227b3b1d
|
@@ -0,0 +1,83 @@
|
|
1
|
+
name: CI
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- main
|
7
|
+
- 'ml/**'
|
8
|
+
pull_request:
|
9
|
+
branches:
|
10
|
+
- main
|
11
|
+
|
12
|
+
jobs:
|
13
|
+
RSpec:
|
14
|
+
runs-on: ubuntu-latest
|
15
|
+
strategy:
|
16
|
+
fail-fast: false
|
17
|
+
matrix:
|
18
|
+
ruby-version:
|
19
|
+
- '2.5' # deprecated
|
20
|
+
- '2.6'
|
21
|
+
- '2.7'
|
22
|
+
- '3.0'
|
23
|
+
- '3.1'
|
24
|
+
gemfile:
|
25
|
+
- activerecord_5_2 # deprecated
|
26
|
+
- activerecord_6_0
|
27
|
+
- activerecord_6_1
|
28
|
+
- activerecord_7_0
|
29
|
+
include:
|
30
|
+
- ruby-version: '3.0'
|
31
|
+
gemfile: activerecord_7_0
|
32
|
+
coverage: 'true'
|
33
|
+
exclude:
|
34
|
+
- ruby-version: 2.5
|
35
|
+
gemfile: activerecord_7_0
|
36
|
+
- ruby-version: 2.6
|
37
|
+
gemfile: activerecord_7_0
|
38
|
+
- ruby-version: 3.0
|
39
|
+
gemfile: activerecord_5_2
|
40
|
+
- ruby-version: 3.1
|
41
|
+
gemfile: activerecord_5_2
|
42
|
+
env:
|
43
|
+
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile
|
44
|
+
steps:
|
45
|
+
- name: Database setup
|
46
|
+
run: |
|
47
|
+
sudo sed -i s/peer/trust/g /etc/postgresql/*/main/pg_hba.conf
|
48
|
+
sudo systemctl start postgresql.service
|
49
|
+
sudo systemctl start mysql.service
|
50
|
+
- uses: actions/checkout@v2
|
51
|
+
- name: Set up Ruby ${{ matrix.ruby-version }}
|
52
|
+
uses: ruby/setup-ruby@v1
|
53
|
+
with:
|
54
|
+
ruby-version: ${{ matrix.ruby-version }}
|
55
|
+
bundler-cache: true
|
56
|
+
- uses: amancevice/setup-code-climate@v0
|
57
|
+
name: CodeClimate setup
|
58
|
+
if: ${{ matrix.coverage == 'true' }}
|
59
|
+
with:
|
60
|
+
cc_test_reporter_id: ${{ secrets.CC_TEST_REPORTER_ID }}
|
61
|
+
- name: CodeClimate before-build
|
62
|
+
run: cc-test-reporter before-build
|
63
|
+
if: ${{ matrix.coverage == 'true' }}
|
64
|
+
continue-on-error: true
|
65
|
+
- name: Run tests
|
66
|
+
env:
|
67
|
+
COVERAGE: ${{ matrix.coverage }}
|
68
|
+
run: bundle exec rake spec:all
|
69
|
+
- name: CodeClimate after-build
|
70
|
+
run: cc-test-reporter after-build
|
71
|
+
if: ${{ matrix.coverage == 'true' }}
|
72
|
+
continue-on-error: true
|
73
|
+
Standard:
|
74
|
+
runs-on: ubuntu-latest
|
75
|
+
steps:
|
76
|
+
- uses: actions/checkout@v2
|
77
|
+
- name: Set up Ruby
|
78
|
+
uses: ruby/setup-ruby@v1
|
79
|
+
with:
|
80
|
+
ruby-version: '3.0'
|
81
|
+
bundler-cache: true
|
82
|
+
- name: Standard
|
83
|
+
run: bundle exec rake standard
|
data/.gitignore
CHANGED
data/.standard.yml
ADDED
data/Appraisals
CHANGED
@@ -1,29 +1,15 @@
|
|
1
|
-
appraise "activerecord-
|
2
|
-
gem "activerecord", "~>
|
3
|
-
gem "mysql2", "~> 0.3.21"
|
4
|
-
gem "pg", "~> 0.21.0"
|
5
|
-
end
|
6
|
-
|
7
|
-
appraise "activerecord-4-1" do
|
8
|
-
gem "activerecord", "~> 4.1.16"
|
9
|
-
gem "mysql2", "~> 0.3.21"
|
10
|
-
gem "pg", "~> 0.21.0"
|
11
|
-
end
|
12
|
-
|
13
|
-
appraise "activerecord-4-2" do
|
14
|
-
gem "activerecord", "~> 4.2.10"
|
15
|
-
gem "mysql2", "~> 0.3.21"
|
16
|
-
gem "pg", "~> 0.21.0"
|
1
|
+
appraise "activerecord-5-2" do
|
2
|
+
gem "activerecord", "~> 5.2.0"
|
17
3
|
end
|
18
4
|
|
19
|
-
appraise "activerecord-
|
20
|
-
gem "activerecord", "~>
|
5
|
+
appraise "activerecord-6-0" do
|
6
|
+
gem "activerecord", "~> 6.0.3"
|
21
7
|
end
|
22
8
|
|
23
|
-
appraise "activerecord-
|
24
|
-
gem "activerecord", "~>
|
9
|
+
appraise "activerecord-6-1" do
|
10
|
+
gem "activerecord", "~> 6.1.2"
|
25
11
|
end
|
26
12
|
|
27
|
-
appraise "activerecord-
|
28
|
-
gem "activerecord", "~>
|
13
|
+
appraise "activerecord-7-0" do
|
14
|
+
gem "activerecord", "~> 7.0.1"
|
29
15
|
end
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,27 @@
|
|
2
2
|
|
3
3
|
## [Unreleased]
|
4
4
|
|
5
|
+
## [1.1.0] - 2022-02-25
|
6
|
+
### Added
|
7
|
+
- Support for Rails 7.0
|
8
|
+
- Support for Ruby 3.1
|
9
|
+
- Deprecate support for Ruby 2.5
|
10
|
+
- Deprecate support for Rails 5.2
|
11
|
+
|
12
|
+
## [1.0.0] - 2021-03-26
|
13
|
+
### Breaking
|
14
|
+
- Drop support for Rails < 5.2.0
|
15
|
+
- Drop support for Ruby < 2.5.0
|
16
|
+
|
17
|
+
### Added
|
18
|
+
- `strict: false` option for simpler querying where possible
|
19
|
+
- Support for Rails 6.0 and 6.1
|
20
|
+
- Support for Ruby 2.7 and 3.0
|
21
|
+
|
22
|
+
## [0.2.1] - 2018-08-01
|
23
|
+
### Fixed
|
24
|
+
- Remove over-eager check for column existence
|
25
|
+
|
5
26
|
## [0.2.0] - 2018-07-31
|
6
27
|
### Added
|
7
28
|
- Support for Rails 4.x (in addition to 5.x)
|
@@ -12,5 +33,8 @@
|
|
12
33
|
### Added
|
13
34
|
- Copy/paste of code from app where it was originally used
|
14
35
|
|
15
|
-
[Unreleased]: https://github.com/molawson/boolean_timestamp/compare/
|
36
|
+
[Unreleased]: https://github.com/molawson/boolean_timestamp/compare/v1.1.0...HEAD
|
37
|
+
[1.1.0]: https://github.com/molawson/boolean_timestamp/compare/v1.0.0...v1.1.0
|
38
|
+
[1.0.0]: https://github.com/molawson/boolean_timestamp/compare/v0.2.1...v1.0.0
|
39
|
+
[0.2.1]: https://github.com/molawson/boolean_timestamp/compare/v0.2.0...v0.2.1
|
16
40
|
[0.2.0]: https://github.com/molawson/boolean_timestamp/compare/v0.1.0...v0.2.0
|
data/Gemfile
CHANGED
@@ -1,10 +1,19 @@
|
|
1
1
|
source "https://rubygems.org"
|
2
2
|
|
3
|
-
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
|
3
|
+
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
|
4
4
|
|
5
5
|
# Specify your gem's dependencies in boolean_timestamp.gemspec
|
6
6
|
gemspec
|
7
7
|
|
8
|
+
gem "appraisal"
|
9
|
+
gem "mysql2"
|
10
|
+
gem "pg"
|
11
|
+
gem "rake", ">= 12.3.3"
|
12
|
+
gem "rspec", "~> 3.0"
|
13
|
+
gem "sqlite3"
|
14
|
+
gem "standard", "~> 1.0"
|
15
|
+
gem "timecop"
|
16
|
+
|
8
17
|
group :test do
|
9
18
|
gem "simplecov", require: false
|
10
19
|
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,102 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
boolean_timestamp (1.1.0)
|
5
|
+
activerecord (>= 5.2.0)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
activemodel (7.0.1)
|
11
|
+
activesupport (= 7.0.1)
|
12
|
+
activerecord (7.0.1)
|
13
|
+
activemodel (= 7.0.1)
|
14
|
+
activesupport (= 7.0.1)
|
15
|
+
activesupport (7.0.1)
|
16
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
17
|
+
i18n (>= 1.6, < 2)
|
18
|
+
minitest (>= 5.1)
|
19
|
+
tzinfo (~> 2.0)
|
20
|
+
appraisal (2.4.1)
|
21
|
+
bundler
|
22
|
+
rake
|
23
|
+
thor (>= 0.14.0)
|
24
|
+
ast (2.4.2)
|
25
|
+
concurrent-ruby (1.1.9)
|
26
|
+
diff-lcs (1.5.0)
|
27
|
+
docile (1.4.0)
|
28
|
+
i18n (1.8.11)
|
29
|
+
concurrent-ruby (~> 1.0)
|
30
|
+
minitest (5.15.0)
|
31
|
+
mysql2 (0.5.3)
|
32
|
+
parallel (1.21.0)
|
33
|
+
parser (3.1.0.0)
|
34
|
+
ast (~> 2.4.1)
|
35
|
+
pg (1.2.3)
|
36
|
+
rainbow (3.1.1)
|
37
|
+
rake (13.0.6)
|
38
|
+
regexp_parser (2.2.0)
|
39
|
+
rexml (3.2.5)
|
40
|
+
rspec (3.10.0)
|
41
|
+
rspec-core (~> 3.10.0)
|
42
|
+
rspec-expectations (~> 3.10.0)
|
43
|
+
rspec-mocks (~> 3.10.0)
|
44
|
+
rspec-core (3.10.1)
|
45
|
+
rspec-support (~> 3.10.0)
|
46
|
+
rspec-expectations (3.10.2)
|
47
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
48
|
+
rspec-support (~> 3.10.0)
|
49
|
+
rspec-mocks (3.10.2)
|
50
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
51
|
+
rspec-support (~> 3.10.0)
|
52
|
+
rspec-support (3.10.3)
|
53
|
+
rubocop (1.25.0)
|
54
|
+
parallel (~> 1.10)
|
55
|
+
parser (>= 3.1.0.0)
|
56
|
+
rainbow (>= 2.2.2, < 4.0)
|
57
|
+
regexp_parser (>= 1.8, < 3.0)
|
58
|
+
rexml
|
59
|
+
rubocop-ast (>= 1.15.1, < 2.0)
|
60
|
+
ruby-progressbar (~> 1.7)
|
61
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
62
|
+
rubocop-ast (1.15.1)
|
63
|
+
parser (>= 3.0.1.1)
|
64
|
+
rubocop-performance (1.13.2)
|
65
|
+
rubocop (>= 1.7.0, < 2.0)
|
66
|
+
rubocop-ast (>= 0.4.0)
|
67
|
+
ruby-progressbar (1.11.0)
|
68
|
+
simplecov (0.21.2)
|
69
|
+
docile (~> 1.1)
|
70
|
+
simplecov-html (~> 0.11)
|
71
|
+
simplecov_json_formatter (~> 0.1)
|
72
|
+
simplecov-html (0.12.3)
|
73
|
+
simplecov_json_formatter (0.1.3)
|
74
|
+
sqlite3 (1.4.2)
|
75
|
+
standard (1.7.0)
|
76
|
+
rubocop (= 1.25.0)
|
77
|
+
rubocop-performance (= 1.13.2)
|
78
|
+
thor (1.2.1)
|
79
|
+
timecop (0.9.4)
|
80
|
+
tzinfo (2.0.4)
|
81
|
+
concurrent-ruby (~> 1.0)
|
82
|
+
unicode-display_width (2.1.0)
|
83
|
+
|
84
|
+
PLATFORMS
|
85
|
+
arm64-darwin-21
|
86
|
+
x86_64-darwin-19
|
87
|
+
x86_64-linux
|
88
|
+
|
89
|
+
DEPENDENCIES
|
90
|
+
appraisal
|
91
|
+
boolean_timestamp!
|
92
|
+
mysql2
|
93
|
+
pg
|
94
|
+
rake (>= 12.3.3)
|
95
|
+
rspec (~> 3.0)
|
96
|
+
simplecov
|
97
|
+
sqlite3
|
98
|
+
standard (~> 1.0)
|
99
|
+
timecop
|
100
|
+
|
101
|
+
BUNDLED WITH
|
102
|
+
2.3.8
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# BooleanTimestamp
|
2
2
|
|
3
|
-
[![
|
3
|
+
[![CI](https://github.com/molawson/boolean_timestamp/actions/workflows/ci.yml/badge.svg)](https://github.com/molawson/boolean_timestamp/actions/workflows/ci.yml)
|
4
4
|
[![Maintainability](https://api.codeclimate.com/v1/badges/23eb9fb7a853d24551fa/maintainability)](https://codeclimate.com/github/molawson/boolean_timestamp/maintainability)
|
5
5
|
[![Test Coverage](https://api.codeclimate.com/v1/badges/23eb9fb7a853d24551fa/test_coverage)](https://codeclimate.com/github/molawson/boolean_timestamp/test_coverage)
|
6
6
|
|
@@ -21,37 +21,110 @@ And then execute:
|
|
21
21
|
|
22
22
|
$ bundle
|
23
23
|
|
24
|
-
Or install it yourself
|
24
|
+
Or install it yourself with:
|
25
25
|
|
26
26
|
$ gem install boolean_timestamp
|
27
27
|
|
28
28
|
## Usage
|
29
29
|
|
30
|
+
### Model Setup
|
30
31
|
In any `ActiveRecord` model, you can define a boolean field based on a timestamp column by including the `BooleanTimestmap` module and calling a single method.
|
31
32
|
|
32
33
|
```ruby
|
33
34
|
class Article < ActiveRecord::Base
|
34
35
|
include BooleanTimestamp
|
35
|
-
boolean_timestamp :published
|
36
|
+
boolean_timestamp :published
|
36
37
|
end
|
37
38
|
```
|
38
39
|
|
39
|
-
|
40
|
+
### Database Requirements
|
41
|
+
The only requirement is that you have a time-based column with a matching name, including the standard `_at` suffix. In the example above, you'd need an `articles.published_at` column.
|
42
|
+
|
43
|
+
The gem does not provide any code for setting up the database column. You'll need to use Rails migrations (or any other means you choose) to create the tables and columns you need.
|
44
|
+
|
45
|
+
### Convenience Methods
|
46
|
+
With this model setup, you get a number of methods for reading, writing, and querying a timestamp column as if it were a boolean, without restricting or altering any of the attributes that Rails adds for accessing the column directly.
|
47
|
+
|
48
|
+
```ruby
|
49
|
+
article = Article.new
|
50
|
+
article.published? # => false
|
51
|
+
|
52
|
+
article.published = true
|
53
|
+
article.published? # => true
|
54
|
+
article.published_at # => 2021-03-25 10:00:00 -0500
|
55
|
+
|
56
|
+
Article.new(published_at: Time.now).published? # => true
|
57
|
+
|
58
|
+
published = Article.create(title: "Published", published: true)
|
59
|
+
draft = Article.create(title: "Draft")
|
60
|
+
future = Article.create(title: "Future", published_at: Time.now + 86400)
|
61
|
+
Article.published # => [published]
|
62
|
+
Article.not_published # => [draft, future]
|
63
|
+
```
|
64
|
+
|
65
|
+
### (Not-so-)Strict Mode
|
66
|
+
|
67
|
+
By default, `boolean_timestamp` is strict about which `Time` values are considered `true` or `false`. A value in the future is considered false because if an article has a `published_at` value of "tomorrow at noon", then strictly speaking it hasn't been published yet.
|
68
|
+
|
69
|
+
This is most useful in circumstances where you really care about that time value. For example, being strict about this lets you add features like auto-publishing articles at a future date. A user can finish writing the article and set a future `published_at` value when they want the article to be "released", and any query that fetches published articles will automatically start including it after we reach the `published_at` time.
|
70
|
+
|
71
|
+
In other cases, it's useful to have the timestamp value for debugging and reporting, but for all other intents and purposes, your code treats this data as boolean column. For example, you could have a `payments.failed_at` column. The timestamp is there mostly for historical reasons, the primary functio of that column is about separating the failed payments from those that didn't fail. You're not using this "a future value is falsey" feature of the library, but every time you lookup failed payments with `Payment.failed`, the query is going to use the current time, which can be needlessly slow (for this use-case) and is more difficult to cache (either explicitly in application code or by the database engine itself).
|
72
|
+
|
73
|
+
You can disable the current time checks for both querying and reading values on a per-attribute basis by passing the `strict: false` option. This will only treat `nil` values as `false`. Everything else is `true`. This does not change how values are written to the database.
|
74
|
+
|
75
|
+
```ruby
|
76
|
+
class Article < ActiveRecord::Base
|
77
|
+
include BooleanTimestamp
|
78
|
+
boolean_timestamp :published, strict: false
|
79
|
+
end
|
80
|
+
|
81
|
+
published = Article.create(title: "Published", published: true)
|
82
|
+
draft = Article.create(title: "Draft")
|
83
|
+
future = Article.create(title: "Future", published: Time.now + 86400)
|
84
|
+
|
85
|
+
# Where things start to behave differently
|
86
|
+
|
87
|
+
future.published? # => true
|
88
|
+
Article.published # => [published, future]
|
89
|
+
Article.not_published # => [draft]
|
90
|
+
```
|
91
|
+
## Version Support
|
92
|
+
|
93
|
+
This gem works with a variety of Ruby and Rails versions. The aim is to cover as broad a range of versions as is practical. This matrix should mostly reflect the versions of Ruby and Rails that are supported in some way by their maintainers (i.e. receiving at least some security patches).
|
94
|
+
|
95
|
+
| | Ruby 2.5 | Ruby 2.6 | Ruby 2.7 | Ruby 3.0 | Ruby 3.1 |
|
96
|
+
| --- | :---: | :---: | :---: | :---: | :---: |
|
97
|
+
| **Rails 5.2** | :warning: | :warning: | :warning: | :no_entry: | :no_entry: |
|
98
|
+
| **Rails 6.0** | :warning: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
99
|
+
| **Rails 6.1** | :warning: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
100
|
+
| **Rails 7.0** | :no_entry: | :no_entry: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
101
|
+
|
102
|
+
* :white_check_mark: - fully tested and supported
|
103
|
+
* :no_entry: - not tested or supported
|
104
|
+
* :warning: - support and testing will be removed in the next major release of this gem (usually because at least one of the versions of Ruby or Rails has reached EOL for its maintainers)
|
40
105
|
|
41
106
|
## Development
|
42
107
|
|
43
108
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
44
109
|
|
45
|
-
|
110
|
+
You can run the tests with `bundle exec rake`. That will run the tests against the latest version of Rails (from Gemfile.lock) and the SQLite database, so you'll need to have SQLite setup locally. You can also run the tests selectively against another database with `bundle exec rake spec:mysql` or `bundle exec rake spec:postgres`. Or run all three database engine tests with `bundle exec rake spec:all`.
|
111
|
+
|
112
|
+
If you're feeling even more ambitious, this project uses [appraisal](https://github.com/thoughtbot/appraisal) to test against multiple versions of `ActiveRecord`. You can get all of those tests setup with `bundle exec appraisal install` and run them all with `bundle exec appraisal rake spec:all` (see the appraisal docs for more usage info, including running a single appraisal).
|
46
113
|
|
47
114
|
## Contributing
|
48
115
|
|
49
116
|
Bug reports and pull requests are welcome on GitHub at https://github.com/molawson/boolean_timestamp. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
50
117
|
|
118
|
+
1. Fork it ( https://github.com/molawson/repeatable/fork )
|
119
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
120
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
121
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
122
|
+
5. Create a new Pull Request
|
123
|
+
|
51
124
|
## License
|
52
125
|
|
53
126
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
54
127
|
|
55
128
|
## Code of Conduct
|
56
129
|
|
57
|
-
Everyone interacting in the BooleanTimestamp project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/molawson/boolean_timestamp/blob/
|
130
|
+
Everyone interacting in the BooleanTimestamp project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/molawson/boolean_timestamp/blob/main/CODE_OF_CONDUCT.md).
|
data/Rakefile
CHANGED
@@ -3,6 +3,8 @@ require "rspec/core/rake_task"
|
|
3
3
|
|
4
4
|
RSpec::Core::RakeTask.new(:spec)
|
5
5
|
|
6
|
+
require "standard/rake"
|
7
|
+
|
6
8
|
namespace :spec do
|
7
9
|
desc "Run tests with sqlite3 adapter"
|
8
10
|
task :sqlite do
|
@@ -30,4 +32,4 @@ namespace :spec do
|
|
30
32
|
end
|
31
33
|
end
|
32
34
|
|
33
|
-
task default:
|
35
|
+
task default: %i[spec standard]
|
data/boolean_timestamp.gemspec
CHANGED
@@ -1,48 +1,38 @@
|
|
1
|
-
|
2
1
|
lib = File.expand_path("../lib", __FILE__)
|
3
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
3
|
require "boolean_timestamp/version"
|
5
4
|
|
6
5
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name
|
8
|
-
spec.version
|
9
|
-
spec.authors
|
10
|
-
spec.email
|
6
|
+
spec.name = "boolean_timestamp"
|
7
|
+
spec.version = BooleanTimestamp::VERSION
|
8
|
+
spec.authors = ["Mo Lawson"]
|
9
|
+
spec.email = ["moklawson@gmail.com"]
|
11
10
|
|
12
|
-
spec.summary
|
13
|
-
spec.description
|
11
|
+
spec.summary = "The precision of a timestamp column with the API of a boolean column"
|
12
|
+
spec.description = "True/False fields have a great simplicity about them, and many times
|
14
13
|
they're perfect for the job! But, it's not uncommon end up in a place where you'd really love to
|
15
14
|
keep some degree of simplicity with a little more detail about when the value was changed.
|
16
15
|
Sometimes you'll want to display that information to the user and other times you'll keep it for
|
17
16
|
auditing or debugging purposes. Either way, boolean_timestamp makes the job easy from the
|
18
|
-
beginning and adds very little code to your app.
|
19
|
-
spec.homepage
|
20
|
-
spec.license
|
21
|
-
spec.metadata
|
17
|
+
beginning and adds very little code to your app."
|
18
|
+
spec.homepage = "https://github.com/molawson/boolean_timestamp"
|
19
|
+
spec.license = "MIT"
|
20
|
+
spec.metadata = {
|
22
21
|
"homepage_uri" => "https://github.com/molawson/boolean_timestamp",
|
23
|
-
"changelog_uri" => "https://github.com/molawson/boolean_timestamp/blob/
|
22
|
+
"changelog_uri" => "https://github.com/molawson/boolean_timestamp/blob/main/CHANGELOG.md",
|
24
23
|
"source_code_uri" => "https://github.com/molawson/boolean_timestamp",
|
25
|
-
"bug_tracker_uri" => "https://github.com/molawson/boolean_timestamp/issues"
|
24
|
+
"bug_tracker_uri" => "https://github.com/molawson/boolean_timestamp/issues"
|
26
25
|
}
|
26
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
|
27
27
|
|
28
28
|
# Specify which files should be added to the gem when it is released.
|
29
29
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
30
|
-
spec.files
|
30
|
+
spec.files = Dir.chdir(File.expand_path("..", __FILE__)) do
|
31
31
|
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
32
32
|
end
|
33
|
-
spec.bindir
|
34
|
-
spec.executables
|
33
|
+
spec.bindir = "exe"
|
34
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
35
35
|
spec.require_paths = ["lib"]
|
36
36
|
|
37
|
-
spec.
|
38
|
-
spec.add_development_dependency "bundler", "~> 1.16"
|
39
|
-
spec.add_development_dependency "rake", "~> 10.0"
|
40
|
-
spec.add_development_dependency "rspec", "~> 3.0"
|
41
|
-
spec.add_development_dependency "rubocop", "0.54.0"
|
42
|
-
spec.add_development_dependency "sqlite3"
|
43
|
-
spec.add_development_dependency "mysql2"
|
44
|
-
spec.add_development_dependency "pg"
|
45
|
-
spec.add_development_dependency "timecop"
|
46
|
-
|
47
|
-
spec.add_dependency "activerecord", "> 4.0"
|
37
|
+
spec.add_dependency "activerecord", ">= 5.2.0"
|
48
38
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# This file was generated by Appraisal
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
gem "appraisal"
|
6
|
+
gem "mysql2"
|
7
|
+
gem "pg"
|
8
|
+
gem "rake", ">= 12.3.3"
|
9
|
+
gem "rspec", "~> 3.0"
|
10
|
+
gem "sqlite3"
|
11
|
+
gem "standard", "~> 1.0"
|
12
|
+
gem "timecop"
|
13
|
+
gem "activerecord", "~> 6.0.3"
|
14
|
+
|
15
|
+
group :test do
|
16
|
+
gem "simplecov", require: false
|
17
|
+
end
|
18
|
+
|
19
|
+
gemspec path: "../"
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# This file was generated by Appraisal
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
gem "appraisal"
|
6
|
+
gem "mysql2"
|
7
|
+
gem "pg"
|
8
|
+
gem "rake", ">= 12.3.3"
|
9
|
+
gem "rspec", "~> 3.0"
|
10
|
+
gem "sqlite3"
|
11
|
+
gem "standard", "~> 1.0"
|
12
|
+
gem "timecop"
|
13
|
+
gem "activerecord", "~> 6.1.2"
|
14
|
+
|
15
|
+
group :test do
|
16
|
+
gem "simplecov", require: false
|
17
|
+
end
|
18
|
+
|
19
|
+
gemspec path: "../"
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# This file was generated by Appraisal
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
gem "appraisal"
|
6
|
+
gem "mysql2"
|
7
|
+
gem "pg"
|
8
|
+
gem "rake", ">= 12.3.3"
|
9
|
+
gem "rspec", "~> 3.0"
|
10
|
+
gem "sqlite3"
|
11
|
+
gem "standard", "~> 1.0"
|
12
|
+
gem "timecop"
|
13
|
+
gem "activerecord", "~> 7.0.1"
|
14
|
+
|
15
|
+
group :test do
|
16
|
+
gem "simplecov", require: false
|
17
|
+
end
|
18
|
+
|
19
|
+
gemspec path: "../"
|
data/lib/boolean_timestamp.rb
CHANGED
@@ -8,24 +8,26 @@ module BooleanTimestamp
|
|
8
8
|
end
|
9
9
|
|
10
10
|
module ClassMethods
|
11
|
-
def boolean_timestamp(method_name)
|
11
|
+
def boolean_timestamp(method_name, strict: true)
|
12
12
|
method_name = String(method_name)
|
13
13
|
column_name = "#{method_name}_at"
|
14
14
|
fully_qualified_column_name = "#{table_name}.#{column_name}"
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
ArgumentError,
|
19
|
-
"Can't build boolean methods from unknown column '#{fully_qualified_column_name}'",
|
20
|
-
)
|
21
|
-
end
|
22
|
-
define_boolean_timestamp_scopes(method_name, fully_qualified_column_name)
|
23
|
-
define_boolean_timestamp_accessors(method_name, column_name)
|
16
|
+
define_boolean_timestamp_scopes(method_name, fully_qualified_column_name, strict: strict)
|
17
|
+
define_boolean_timestamp_accessors(method_name, column_name, strict: strict)
|
24
18
|
end
|
25
19
|
|
26
20
|
private
|
27
21
|
|
28
|
-
def define_boolean_timestamp_scopes(method_name, fully_qualified_column_name)
|
22
|
+
def define_boolean_timestamp_scopes(method_name, fully_qualified_column_name, strict:)
|
23
|
+
if strict
|
24
|
+
define_boolean_timestamp_strict_scopes(method_name, fully_qualified_column_name)
|
25
|
+
else
|
26
|
+
define_boolean_timestamp_loose_scopes(method_name, fully_qualified_column_name)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def define_boolean_timestamp_strict_scopes(method_name, fully_qualified_column_name)
|
29
31
|
scope(method_name, -> { where("#{fully_qualified_column_name} <= ?", Time.current) })
|
30
32
|
|
31
33
|
scope(
|
@@ -33,32 +35,45 @@ module BooleanTimestamp
|
|
33
35
|
lambda do
|
34
36
|
where(
|
35
37
|
"#{fully_qualified_column_name} IS NULL OR #{fully_qualified_column_name} > ?",
|
36
|
-
Time.current
|
38
|
+
Time.current
|
37
39
|
)
|
38
|
-
end
|
40
|
+
end
|
39
41
|
)
|
40
42
|
end
|
41
43
|
|
42
|
-
def
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
ActiveRecord::ConnectionAdapters::Column::FALSE_VALUES
|
47
|
-
end
|
44
|
+
def define_boolean_timestamp_loose_scopes(method_name, fully_qualified_column_name)
|
45
|
+
scope(method_name, -> { where("#{fully_qualified_column_name} IS NOT NULL") })
|
46
|
+
scope("not_#{method_name}", -> { where("#{fully_qualified_column_name} IS NULL") })
|
47
|
+
end
|
48
48
|
|
49
|
-
|
50
|
-
|
49
|
+
def define_boolean_timestamp_accessors(method_name, column_name, strict:)
|
50
|
+
if strict
|
51
|
+
define_boolean_timestamp_strict_reader(method_name, column_name)
|
52
|
+
else
|
53
|
+
define_boolean_timestamp_loose_reader(method_name, column_name)
|
51
54
|
end
|
52
55
|
|
53
56
|
alias_method("#{method_name}?", method_name)
|
54
57
|
|
55
58
|
define_method("#{method_name}=") do |value|
|
56
|
-
if
|
59
|
+
if ActiveModel::Type::Boolean::FALSE_VALUES.include?(value)
|
57
60
|
public_send("#{column_name}=", nil)
|
58
61
|
elsif !public_send(method_name)
|
59
62
|
public_send("#{column_name}=", Time.current)
|
60
63
|
end
|
61
64
|
end
|
62
65
|
end
|
66
|
+
|
67
|
+
def define_boolean_timestamp_strict_reader(method_name, column_name)
|
68
|
+
define_method(method_name) do
|
69
|
+
public_send(column_name).present? && !public_send(column_name).future?
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
def define_boolean_timestamp_loose_reader(method_name, column_name)
|
74
|
+
define_method(method_name) do
|
75
|
+
public_send(column_name).present?
|
76
|
+
end
|
77
|
+
end
|
63
78
|
end
|
64
79
|
end
|
metadata
CHANGED
@@ -1,155 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: boolean_timestamp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mo Lawson
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-02-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: appraisal
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: bundler
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '1.16'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '1.16'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: rake
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '10.0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '10.0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: rspec
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '3.0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '3.0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: rubocop
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - '='
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: 0.54.0
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - '='
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: 0.54.0
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: sqlite3
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - ">="
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - ">="
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '0'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: mysql2
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - ">="
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '0'
|
104
|
-
type: :development
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - ">="
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '0'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: pg
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - ">="
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '0'
|
118
|
-
type: :development
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - ">="
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: '0'
|
125
|
-
- !ruby/object:Gem::Dependency
|
126
|
-
name: timecop
|
127
|
-
requirement: !ruby/object:Gem::Requirement
|
128
|
-
requirements:
|
129
|
-
- - ">="
|
130
|
-
- !ruby/object:Gem::Version
|
131
|
-
version: '0'
|
132
|
-
type: :development
|
133
|
-
prerelease: false
|
134
|
-
version_requirements: !ruby/object:Gem::Requirement
|
135
|
-
requirements:
|
136
|
-
- - ">="
|
137
|
-
- !ruby/object:Gem::Version
|
138
|
-
version: '0'
|
139
13
|
- !ruby/object:Gem::Dependency
|
140
14
|
name: activerecord
|
141
15
|
requirement: !ruby/object:Gem::Requirement
|
142
16
|
requirements:
|
143
|
-
- - "
|
17
|
+
- - ">="
|
144
18
|
- !ruby/object:Gem::Version
|
145
|
-
version:
|
19
|
+
version: 5.2.0
|
146
20
|
type: :runtime
|
147
21
|
prerelease: false
|
148
22
|
version_requirements: !ruby/object:Gem::Requirement
|
149
23
|
requirements:
|
150
|
-
- - "
|
24
|
+
- - ">="
|
151
25
|
- !ruby/object:Gem::Version
|
152
|
-
version:
|
26
|
+
version: 5.2.0
|
153
27
|
description: |-
|
154
28
|
True/False fields have a great simplicity about them, and many times
|
155
29
|
they're perfect for the job! But, it's not uncommon end up in a place where you'd really love to
|
@@ -164,26 +38,27 @@ extensions: []
|
|
164
38
|
extra_rdoc_files: []
|
165
39
|
files:
|
166
40
|
- ".editorconfig"
|
41
|
+
- ".git-blame-ignore-revs"
|
42
|
+
- ".github/workflows/ci.yml"
|
167
43
|
- ".gitignore"
|
168
44
|
- ".rspec"
|
169
45
|
- ".rubocop.yml"
|
170
|
-
- ".
|
46
|
+
- ".standard.yml"
|
171
47
|
- Appraisals
|
172
48
|
- CHANGELOG.md
|
173
49
|
- CODE_OF_CONDUCT.md
|
174
50
|
- Gemfile
|
51
|
+
- Gemfile.lock
|
175
52
|
- LICENSE.txt
|
176
53
|
- README.md
|
177
54
|
- Rakefile
|
178
55
|
- bin/console
|
179
56
|
- bin/setup
|
180
57
|
- boolean_timestamp.gemspec
|
181
|
-
- gemfiles/activerecord_4_0.gemfile
|
182
|
-
- gemfiles/activerecord_4_1.gemfile
|
183
|
-
- gemfiles/activerecord_4_2.gemfile
|
184
|
-
- gemfiles/activerecord_5_0.gemfile
|
185
|
-
- gemfiles/activerecord_5_1.gemfile
|
186
58
|
- gemfiles/activerecord_5_2.gemfile
|
59
|
+
- gemfiles/activerecord_6_0.gemfile
|
60
|
+
- gemfiles/activerecord_6_1.gemfile
|
61
|
+
- gemfiles/activerecord_7_0.gemfile
|
187
62
|
- lib/boolean_timestamp.rb
|
188
63
|
- lib/boolean_timestamp/version.rb
|
189
64
|
homepage: https://github.com/molawson/boolean_timestamp
|
@@ -191,10 +66,10 @@ licenses:
|
|
191
66
|
- MIT
|
192
67
|
metadata:
|
193
68
|
homepage_uri: https://github.com/molawson/boolean_timestamp
|
194
|
-
changelog_uri: https://github.com/molawson/boolean_timestamp/blob/
|
69
|
+
changelog_uri: https://github.com/molawson/boolean_timestamp/blob/main/CHANGELOG.md
|
195
70
|
source_code_uri: https://github.com/molawson/boolean_timestamp
|
196
71
|
bug_tracker_uri: https://github.com/molawson/boolean_timestamp/issues
|
197
|
-
post_install_message:
|
72
|
+
post_install_message:
|
198
73
|
rdoc_options: []
|
199
74
|
require_paths:
|
200
75
|
- lib
|
@@ -202,16 +77,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
202
77
|
requirements:
|
203
78
|
- - ">="
|
204
79
|
- !ruby/object:Gem::Version
|
205
|
-
version:
|
80
|
+
version: 2.5.0
|
206
81
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
207
82
|
requirements:
|
208
83
|
- - ">="
|
209
84
|
- !ruby/object:Gem::Version
|
210
85
|
version: '0'
|
211
86
|
requirements: []
|
212
|
-
|
213
|
-
|
214
|
-
signing_key:
|
87
|
+
rubygems_version: 3.2.22
|
88
|
+
signing_key:
|
215
89
|
specification_version: 4
|
216
90
|
summary: The precision of a timestamp column with the API of a boolean column
|
217
91
|
test_files: []
|
data/.travis.yml
DELETED
@@ -1,41 +0,0 @@
|
|
1
|
-
sudo: false
|
2
|
-
env:
|
3
|
-
global:
|
4
|
-
- CC_TEST_REPORTER_ID=a7a2478b2a951030d73fbb60cb2b78e485ab91fbd4f608e891cb2bf98b285998
|
5
|
-
- COVERAGE=true
|
6
|
-
language: ruby
|
7
|
-
rvm:
|
8
|
-
- 2.3
|
9
|
-
- 2.4
|
10
|
-
- 2.5
|
11
|
-
- 2.6
|
12
|
-
gemfile:
|
13
|
-
- gemfiles/activerecord_4_0.gemfile
|
14
|
-
- gemfiles/activerecord_4_1.gemfile
|
15
|
-
- gemfiles/activerecord_4_2.gemfile
|
16
|
-
- gemfiles/activerecord_5_0.gemfile
|
17
|
-
- gemfiles/activerecord_5_1.gemfile
|
18
|
-
- gemfiles/activerecord_5_2.gemfile
|
19
|
-
matrix:
|
20
|
-
exclude:
|
21
|
-
- rvm: 2.4
|
22
|
-
gemfile: gemfiles/activerecord_4_0.gemfile
|
23
|
-
- rvm: 2.4
|
24
|
-
gemfile: gemfiles/activerecord_4_1.gemfile
|
25
|
-
- rvm: 2.5
|
26
|
-
gemfile: gemfiles/activerecord_4_0.gemfile
|
27
|
-
- rvm: 2.5
|
28
|
-
gemfile: gemfiles/activerecord_4_1.gemfile
|
29
|
-
- rvm: 2.6
|
30
|
-
gemfile: gemfiles/activerecord_4_0.gemfile
|
31
|
-
- rvm: 2.6
|
32
|
-
gemfile: gemfiles/activerecord_4_1.gemfile
|
33
|
-
before_install: gem install bundler -v 1.16.2
|
34
|
-
before_script:
|
35
|
-
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
36
|
-
- chmod +x ./cc-test-reporter
|
37
|
-
- ./cc-test-reporter before-build
|
38
|
-
script:
|
39
|
-
- bundle exec rake spec:all
|
40
|
-
after_script:
|
41
|
-
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
|