discard 1.3.0 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 98ef1bd12f3edc82e8e50b429d39989473cf7b917225ce25068a60e09ef7bb06
4
- data.tar.gz: 7762b63af8cd7aeeb848f9778242a02a02be7069586943542916ea3ac12e6d51
3
+ metadata.gz: 0626ecc4ddd0c4d8e9fb8c9c0edbd42aa664576cbea51403d904c58cb4857c2b
4
+ data.tar.gz: 8ec497ce993f3fe49c5ea802021e45b8c04c43b97b5ebd5bc19deb5e91da8843
5
5
  SHA512:
6
- metadata.gz: a43ba463a29c4cd1e1b8c3a79a37b8d140925ef9fe2ee1d23b1aa347c86e746faa390a3a11c60818cf327fb81c0cacd8561a9005a3ddeb9ced016b64258c32ce
7
- data.tar.gz: 1a3516836d8a2f21ef1e0385d6b126bec5f5ca380071f473a80ac8d8bd5dc9cd275954fff9052b9964f5d0763cbbd0b2ba4e8da9317e042dbbdd5cb42836cf56
6
+ metadata.gz: 10c74db9ce658b50d0b2112e34c901a06e69db789d74842400e4b9a9c32ae92b390a67ed6fc189b262d82de8eddeea3e71d85048ce43fbb7a223d758af768b40
7
+ data.tar.gz: bb82e531e3098c835bfcbbf1aabf8d06b1356346b1eeee361f01080b4c0d5c3d682f0987c1959588c84fea44769f32f4da6db4916430f656516d4872951b1a53
@@ -13,27 +13,39 @@ jobs:
13
13
  runs-on: ubuntu-latest
14
14
  name: Test on Rails ${{ matrix.rails_version }} and Ruby ${{ matrix.ruby_version }}
15
15
  strategy:
16
+ fail-fast: false
16
17
  matrix:
17
18
  include:
19
+ - rails_version: 8.0.0.rc1
20
+ ruby_version: '3.3'
21
+ sqlite_version: ~> 2.0
22
+ - rails_version: ~> 7.2.0
23
+ ruby_version: '3.3'
24
+ sqlite_version: ~> 2.0
25
+ - rails_version: ~> 7.2.0
26
+ ruby_version: '3.2'
27
+ sqlite_version: ~> 2.0
28
+ - rails_version: ~> 7.2.0
29
+ ruby_version: '3.1'
30
+ sqlite_version: ~> 2.0
31
+ - rails_version: ~> 7.1.0
32
+ ruby_version: '3.3'
33
+ sqlite_version: ~> 1.0
18
34
  - rails_version: ~> 7.0.0
19
- ruby_version: 3.2
20
- - rails_version: ~> 7.0.0
21
- ruby_version: 3.1
35
+ ruby_version: '3.2'
36
+ sqlite_version: ~> 1.0
22
37
  - rails_version: ~> 6.1.0
23
38
  ruby_version: '3.0'
24
- - rails_version: ~> 6.0.0
25
- ruby_version: 2.7
26
- - rails_version: ~> 5.2.0
27
- ruby_version: 2.6
28
- - rails_version: ~> 5.1.0
29
- ruby_version: 2.5
39
+ sqlite_version: ~> 1.0
30
40
  env:
31
41
  RAILS_VERSION: ${{ matrix.rails_version }}
42
+ SQLITE_VERSION: ${{ matrix.sqlite_version }}
32
43
  steps:
33
- - uses: actions/checkout@v3
44
+ - uses: actions/checkout@v4
34
45
  - uses: ruby/setup-ruby@v1
35
46
  with:
36
47
  ruby-version: ${{ matrix.ruby_version }}
37
- bundler-cache: true
48
+ - name: Bundle install
49
+ run: bundle install
38
50
  - name: Test
39
51
  run: bundle exec rake
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  ### Unreleased
2
2
 
3
+ ### Version 1.4.0
4
+ Release date: 2024-11-05
5
+
6
+ * Support Rails 8.0 and 8.1 (#110, #111)
7
+
8
+ * More descriptive error messages (#108)
9
+
3
10
  ### Version 1.3.0
4
11
  Release date: 2023-08-17
5
12
 
data/README.md CHANGED
@@ -13,7 +13,7 @@ A simple ActiveRecord mixin to add conventions for flagging records as discarded
13
13
  Add this line to your application's Gemfile:
14
14
 
15
15
  ```ruby
16
- gem 'discard', '~> 1.2'
16
+ gem 'discard', '~> 1.4'
17
17
  ```
18
18
 
19
19
  And then execute:
data/discard.gemspec CHANGED
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
22
22
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
23
  spec.require_paths = ["lib"]
24
24
 
25
- spec.add_dependency "activerecord", ">= 4.2", "< 8"
25
+ spec.add_dependency "activerecord", ">= 4.2", "< 9.0"
26
26
  spec.add_development_dependency "bundler"
27
27
  spec.add_development_dependency "rake", ">= 10.0"
28
28
  spec.add_development_dependency "rspec", "~> 3.5.0"
data/lib/discard/model.rb CHANGED
@@ -144,7 +144,7 @@ module Discard
144
144
  end
145
145
  end
146
146
 
147
- # Discard the record in the database
147
+ # Undiscard the record in the database
148
148
  #
149
149
  # There's a series of callbacks associated with #undiscard!. If the
150
150
  # <tt>before_undiscard</tt> callback throws +:abort+ the action is cancelled
@@ -159,11 +159,23 @@ module Discard
159
159
  private
160
160
 
161
161
  def _raise_record_not_discarded
162
- raise ::Discard::RecordNotDiscarded.new("Failed to discard the record", self)
162
+ raise ::Discard::RecordNotDiscarded.new(discarded_fail_message, self)
163
163
  end
164
164
 
165
165
  def _raise_record_not_undiscarded
166
- raise ::Discard::RecordNotUndiscarded.new("Failed to undiscard the record", self)
166
+ raise ::Discard::RecordNotUndiscarded.new(undiscarded_fail_message, self)
167
+ end
168
+
169
+ def discarded_fail_message
170
+ return "A discarded record cannot be discarded" if discarded?
171
+
172
+ "Failed to discard the record"
173
+ end
174
+
175
+ def undiscarded_fail_message
176
+ return "An undiscarded record cannot be undiscarded" if undiscarded?
177
+
178
+ "Failed to undiscard the record"
167
179
  end
168
180
  end
169
181
  end
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Discard
4
4
  # Discard version
5
- VERSION = "1.3.0".freeze
5
+ VERSION = "1.4.0".freeze
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: discard
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Hawthorn
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-08-17 00:00:00.000000000 Z
11
+ date: 2024-11-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: '4.2'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '8'
22
+ version: '9.0'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,7 @@ dependencies:
29
29
  version: '4.2'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '8'
32
+ version: '9.0'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: bundler
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -128,7 +128,6 @@ files:
128
128
  - ".github/workflows/test.yml"
129
129
  - ".gitignore"
130
130
  - ".rspec"
131
- - ".travis.yml"
132
131
  - ".yardopts"
133
132
  - CHANGELOG.md
134
133
  - CODE_OF_CONDUCT.md
@@ -162,7 +161,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
162
161
  - !ruby/object:Gem::Version
163
162
  version: '0'
164
163
  requirements: []
165
- rubygems_version: 3.4.10
164
+ rubygems_version: 3.5.16
166
165
  signing_key:
167
166
  specification_version: 4
168
167
  summary: ActiveRecord soft-deletes done right
data/.travis.yml DELETED
@@ -1,28 +0,0 @@
1
- language: ruby
2
- cache: bundler
3
- rvm:
4
- - 2.2
5
- - 2.3
6
- - 2.4
7
- - 2.5
8
- - 2.6
9
- - 2.7
10
- env:
11
- matrix:
12
- - RAILS_VERSION='~> 4.2.0' SQLITE_VERSION='~> 1.3.6'
13
- - RAILS_VERSION='~> 5.0.0' SQLITE_VERSION='~> 1.3.6'
14
- - RAILS_VERSION='~> 5.1.0'
15
- - RAILS_VERSION='~> 5.2.0'
16
- - RAILS_VERSION='~> 6.0.0'
17
-
18
- matrix:
19
- exclude:
20
- - rvm: 2.2
21
- env: RAILS_VERSION='~> 6.0.0'
22
- - rvm: 2.3
23
- env: RAILS_VERSION='~> 6.0.0'
24
- - rvm: 2.4
25
- env: RAILS_VERSION='~> 6.0.0'
26
- # Rails 4.2 uses BigDecimal.new, which Ruby 2.7 removed
27
- - rvm: 2.7
28
- env: RAILS_VERSION='~> 4.2.0' SQLITE_VERSION='~> 1.3.6'