mongo_trails 14.0.0 → 14.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.
- checksums.yaml +4 -4
- data/README.md +2 -1
- data/bin/bump-version +67 -0
- data/gemfiles/rails_7.gemfile.lock +2 -2
- data/gemfiles/rails_8.gemfile.lock +2 -2
- data/gemfiles/rails_8_1.gemfile.lock +1 -1
- data/lib/mongo_trails/mongo_support/version.rb +7 -0
- data/lib/mongo_trails/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8895edda2cceb555c7c02c58a0cf16bbdc888ac7c86862f921b50e96b43f5e91
|
|
4
|
+
data.tar.gz: 1c90cdf3b1ef87f319f73af823c03927513de646b9ac108d8115fe8964b4040f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: aea129b5f4cd93a5db2b7e6572387a59015feeafccdd0411648ce83106b4460d5ddd1542a86dbd829803b0f7deaed40ed8b06dcdaa4fc1953215f7ffacb8a16f
|
|
7
|
+
data.tar.gz: 10ef94f3e1fd1f8681bbd8313bfcfa2e2aacbac65185c2bcd66aa26fb224b894607061aba9ee746601e07ed6ed32be05ce038f0d10fc9a2048fc21650189f1e1
|
data/README.md
CHANGED
|
@@ -45,9 +45,10 @@ Done!
|
|
|
45
45
|
|
|
46
46
|
## Releasing
|
|
47
47
|
|
|
48
|
-
Update `MongoTrails::VERSION`
|
|
48
|
+
Update `MongoTrails::VERSION` and all appraisal lockfiles, then validate and release:
|
|
49
49
|
|
|
50
50
|
```bash
|
|
51
|
+
bin/bump-version VERSION
|
|
51
52
|
bundle exec rake test
|
|
52
53
|
bundle exec rubocop
|
|
53
54
|
bundle exec rake release:validate
|
data/bin/bump-version
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require 'bundler'
|
|
5
|
+
require 'pathname'
|
|
6
|
+
|
|
7
|
+
ROOT = Pathname(__dir__).join('..').expand_path
|
|
8
|
+
VERSION_FILE = ROOT.join('lib/mongo_trails/version.rb')
|
|
9
|
+
LOCKFILES = [ROOT.join('Gemfile.lock'), *ROOT.glob('gemfiles/*.gemfile.lock')].freeze
|
|
10
|
+
VERSION_PATTERN = /VERSION = ['"]([^'"]+)['"]/
|
|
11
|
+
|
|
12
|
+
def abort_with_usage
|
|
13
|
+
abort 'Usage: bin/bump-version VERSION'
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
abort_with_usage unless ARGV.one?
|
|
17
|
+
|
|
18
|
+
requested_version = ARGV.first
|
|
19
|
+
unless Gem::Version.correct?(requested_version) && requested_version.match?(/\A\d+\.\d+\.\d+(?:\.[0-9A-Za-z]+)*\z/)
|
|
20
|
+
abort "Invalid version: #{requested_version.inspect}; expected a version such as 14.0.2 or 15.0.0.pre.1"
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
files = [VERSION_FILE, *LOCKFILES]
|
|
24
|
+
original_contents = files.to_h { |path| [path, path.binread] }
|
|
25
|
+
|
|
26
|
+
begin
|
|
27
|
+
version_source = VERSION_FILE.read
|
|
28
|
+
abort "Could not find VERSION assignment in #{VERSION_FILE}" unless version_source.match?(VERSION_PATTERN)
|
|
29
|
+
|
|
30
|
+
VERSION_FILE.write(version_source.sub(VERSION_PATTERN, "VERSION = '#{requested_version}'"))
|
|
31
|
+
|
|
32
|
+
bundle = Gem.bin_path('bundler', 'bundle')
|
|
33
|
+
LOCKFILES.each do |lockfile|
|
|
34
|
+
gemfile = Pathname(lockfile.to_s.delete_suffix('.lock'))
|
|
35
|
+
puts "Updating #{lockfile.relative_path_from(ROOT)}"
|
|
36
|
+
|
|
37
|
+
success = system(
|
|
38
|
+
{
|
|
39
|
+
'BUNDLE_GEMFILE' => gemfile.to_s,
|
|
40
|
+
'BUNDLE_FROZEN' => 'false',
|
|
41
|
+
'BUNDLE_DEPLOYMENT' => 'false'
|
|
42
|
+
},
|
|
43
|
+
Gem.ruby,
|
|
44
|
+
bundle,
|
|
45
|
+
'lock',
|
|
46
|
+
'--local',
|
|
47
|
+
chdir: ROOT.to_s
|
|
48
|
+
)
|
|
49
|
+
raise "Failed to update #{lockfile}" unless success
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
stale_lockfiles = LOCKFILES.reject do |lockfile|
|
|
53
|
+
lockfile.read.match?(/^\s+mongo_trails \(#{Regexp.escape(requested_version)}\)$/)
|
|
54
|
+
end
|
|
55
|
+
raise "Version was not updated in: #{stale_lockfiles.join(', ')}" if stale_lockfiles.any?
|
|
56
|
+
|
|
57
|
+
puts "Updated mongo_trails to #{requested_version}"
|
|
58
|
+
puts 'Next: bundle exec rake test && bundle exec rubocop && git diff --check'
|
|
59
|
+
rescue Interrupt
|
|
60
|
+
original_contents.each { |path, contents| path.binwrite(contents) }
|
|
61
|
+
warn 'Version bump interrupted; changed files were restored'
|
|
62
|
+
exit 130
|
|
63
|
+
rescue StandardError => e
|
|
64
|
+
original_contents.each { |path, contents| path.binwrite(contents) }
|
|
65
|
+
warn "Version bump failed; changed files were restored: #{e.message}"
|
|
66
|
+
exit 1
|
|
67
|
+
end
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: ..
|
|
3
3
|
specs:
|
|
4
|
-
mongo_trails (14.0.
|
|
4
|
+
mongo_trails (14.0.1)
|
|
5
5
|
mongoid (>= 7, < 10)
|
|
6
6
|
ostruct
|
|
7
7
|
paper_trail (~> 16)
|
|
@@ -172,7 +172,7 @@ CHECKSUMS
|
|
|
172
172
|
mcp (0.8.0) sha256=ae8bd146bb8e168852866fd26f805f52744f6326afb3211e073f78a95e0c34fb
|
|
173
173
|
minitest (5.27.0) sha256=2d3b17f8a36fe7801c1adcffdbc38233b938eb0b4966e97a6739055a45fa77d5
|
|
174
174
|
mongo (2.25.0) sha256=b4663884d23523d24f50c579846956444410f939093e8c2a95fa4b76bb929053
|
|
175
|
-
mongo_trails (14.0.
|
|
175
|
+
mongo_trails (14.0.1)
|
|
176
176
|
mongoid (9.1.0) sha256=ef7b50f4c84e636850c3431bc3c92f98481f4e1d147ff06a1c21242d0b242a9e
|
|
177
177
|
ostruct (0.6.3) sha256=95a2ed4a4bd1d190784e666b47b2d3f078e4a9efda2fccf18f84ddc6538ed912
|
|
178
178
|
paper_trail (16.0.0) sha256=e9b9f0fb1b8b590c8231cfa931b282ba92f90e066e393930a5e1c61ae4c5019d
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: ..
|
|
3
3
|
specs:
|
|
4
|
-
mongo_trails (14.0.
|
|
4
|
+
mongo_trails (14.0.1)
|
|
5
5
|
mongoid (>= 7, < 10)
|
|
6
6
|
ostruct
|
|
7
7
|
paper_trail (~> 16)
|
|
@@ -172,7 +172,7 @@ CHECKSUMS
|
|
|
172
172
|
mcp (0.8.0) sha256=ae8bd146bb8e168852866fd26f805f52744f6326afb3211e073f78a95e0c34fb
|
|
173
173
|
minitest (5.27.0) sha256=2d3b17f8a36fe7801c1adcffdbc38233b938eb0b4966e97a6739055a45fa77d5
|
|
174
174
|
mongo (2.25.0) sha256=b4663884d23523d24f50c579846956444410f939093e8c2a95fa4b76bb929053
|
|
175
|
-
mongo_trails (14.0.
|
|
175
|
+
mongo_trails (14.0.1)
|
|
176
176
|
mongoid (9.1.0) sha256=ef7b50f4c84e636850c3431bc3c92f98481f4e1d147ff06a1c21242d0b242a9e
|
|
177
177
|
ostruct (0.6.3) sha256=95a2ed4a4bd1d190784e666b47b2d3f078e4a9efda2fccf18f84ddc6538ed912
|
|
178
178
|
paper_trail (16.0.0) sha256=e9b9f0fb1b8b590c8231cfa931b282ba92f90e066e393930a5e1c61ae4c5019d
|
|
@@ -100,12 +100,19 @@ module MongoTrails
|
|
|
100
100
|
return if existing_counter.present?
|
|
101
101
|
|
|
102
102
|
max_id = maximum_existing_integer_id
|
|
103
|
+
initialize_counter(counter_id, max_id)
|
|
104
|
+
end
|
|
103
105
|
|
|
106
|
+
def initialize_counter(counter_id, max_id)
|
|
104
107
|
AutoIncrementCounters.collection.find(_id: counter_id).find_one_and_update(
|
|
105
108
|
{ '$setOnInsert' => { sequence: max_id } },
|
|
106
109
|
upsert: true,
|
|
107
110
|
return_document: :after
|
|
108
111
|
)
|
|
112
|
+
rescue Mongo::Error::OperationFailure => e
|
|
113
|
+
# DocumentDB can return E11000 when another writer creates this exact counter after the
|
|
114
|
+
# existence check. The caller can safely increment the counter created by that writer.
|
|
115
|
+
raise unless e.code == 11_000
|
|
109
116
|
end
|
|
110
117
|
|
|
111
118
|
def maximum_existing_integer_id
|
data/lib/mongo_trails/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: mongo_trails
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 14.0.
|
|
4
|
+
version: 14.0.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Alex Tsirel
|
|
@@ -97,6 +97,7 @@ files:
|
|
|
97
97
|
- LICENSE
|
|
98
98
|
- README.md
|
|
99
99
|
- Rakefile
|
|
100
|
+
- bin/bump-version
|
|
100
101
|
- gemfiles/rails_7.gemfile
|
|
101
102
|
- gemfiles/rails_7.gemfile.lock
|
|
102
103
|
- gemfiles/rails_8.gemfile
|
|
@@ -139,7 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
139
140
|
- !ruby/object:Gem::Version
|
|
140
141
|
version: '0'
|
|
141
142
|
requirements: []
|
|
142
|
-
rubygems_version:
|
|
143
|
+
rubygems_version: 4.0.16
|
|
143
144
|
specification_version: 4
|
|
144
145
|
summary: PaperTrail addon to store versions in MongoDB
|
|
145
146
|
test_files: []
|