Skip to content

Commit 3511ca2

Browse files
authored
RR-433: Unpin sorbet dependencies (#17)
* Unpin sorbet * Add tapioca * be tapioca init * rm pre-tapioca shims * Update gem RBIs * Ruby 3.4.5 * Balanced parens
1 parent 80a2935 commit 3511ca2

File tree

83 files changed

+143847
-39109
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+143847
-39109
lines changed

Dockerfile.test

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,37 @@
1-
FROM ruby:2.7.2
1+
FROM ruby:3.4.5
22

33
# Setup the buildkite-agent user/group
44
RUN groupadd -r buildkite-agent && \
55
useradd -u 9999 -r -g buildkite-agent buildkite-agent && \
66
mkdir -p /home/buildkite-agent
7-
7+
88
# Setup the work directory where the application will live
99
ENV APP_HOME /var/www
1010
WORKDIR $APP_HOME
11-
11+
1212
# Setup bundler options to install gems in the work directory and use our gem mirror
1313
RUN gem install bundler && \
1414
bundle config --local app_config /usr/local/bundle/config && \
1515
bundle config --local path vendor/bundle && \
1616
bundle config --local "mirror.https://rubygems.org" "https://gemstash.zp-int.com" && \
1717
mkdir /home/buildkite-agent/.gem # This is needed for publishing gems from inside your container
18-
18+
1919
# RAILS APP: Add Gemfile and Gemfile.lock to the work directory
2020
COPY Gemfile* $APP_HOME/
21-
21+
2222
# LIBRARY: Add Gemfile, Gemfile.lock, and gemspec to the work directory
2323
COPY Gemfile* explicit_activerecord.gemspec $APP_HOME/
24-
24+
2525
# Run bundle install with minimal dependencies
2626
RUN bundle install
27-
27+
2828
# Add the rest of the source, now that dependencies are installed
2929
COPY . $APP_HOME
30-
30+
3131
# Change the owner of the relevant directories to the buildkite-agent
3232
RUN chown -R buildkite-agent:buildkite-agent /home/buildkite-agent && \
3333
chown -R buildkite-agent:buildkite-agent $APP_HOME && \
3434
chown -R buildkite-agent:buildkite-agent /usr/local/bundle/config
35-
35+
3636
# Setup the container to run as the buildkite-agent user
3737
USER buildkite-agent

Gemfile.lock

Lines changed: 95 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -5,65 +5,122 @@ PATH
55
activerecord
66
activesupport
77
deprecation_helper
8-
sorbet-runtime (~> 0.5.6293)
8+
sorbet-runtime (>= 0.5.6293)
99

1010
GEM
1111
remote: https://rubygems.org/
1212
specs:
13-
activemodel (6.1.3)
14-
activesupport (= 6.1.3)
15-
activerecord (6.1.3)
16-
activemodel (= 6.1.3)
17-
activesupport (= 6.1.3)
18-
activesupport (6.1.3)
19-
concurrent-ruby (~> 1.0, >= 1.0.2)
13+
activemodel (8.0.2.1)
14+
activesupport (= 8.0.2.1)
15+
activerecord (8.0.2.1)
16+
activemodel (= 8.0.2.1)
17+
activesupport (= 8.0.2.1)
18+
timeout (>= 0.4.0)
19+
activesupport (8.0.2.1)
20+
base64
21+
benchmark (>= 0.3)
22+
bigdecimal
23+
concurrent-ruby (~> 1.0, >= 1.3.1)
24+
connection_pool (>= 2.2.5)
25+
drb
2026
i18n (>= 1.6, < 2)
27+
logger (>= 1.4.2)
2128
minitest (>= 5.1)
22-
tzinfo (~> 2.0)
23-
zeitwerk (~> 2.3)
29+
securerandom (>= 0.3)
30+
tzinfo (~> 2.0, >= 2.0.5)
31+
uri (>= 0.13.1)
32+
base64 (0.3.0)
33+
benchmark (0.4.1)
34+
bigdecimal (3.2.3)
2435
coderay (1.1.3)
25-
concurrent-ruby (1.1.8)
26-
deprecation_helper (0.1.0)
36+
concurrent-ruby (1.3.5)
37+
connection_pool (2.5.4)
38+
deprecation_helper (0.3.0)
2739
sorbet-runtime (~> 0.5.6293)
28-
diff-lcs (1.4.4)
29-
i18n (1.8.9)
40+
diff-lcs (1.6.2)
41+
drb (2.2.3)
42+
erubi (1.13.1)
43+
i18n (1.14.7)
3044
concurrent-ruby (~> 1.0)
31-
method_source (1.0.0)
32-
minitest (5.14.3)
33-
pry (0.14.0)
45+
logger (1.7.0)
46+
method_source (1.1.0)
47+
minitest (5.25.5)
48+
netrc (0.11.0)
49+
parallel (1.27.0)
50+
prism (1.5.1)
51+
pry (0.15.2)
3452
coderay (~> 1.1)
3553
method_source (~> 1.0)
36-
rspec (3.10.0)
37-
rspec-core (~> 3.10.0)
38-
rspec-expectations (~> 3.10.0)
39-
rspec-mocks (~> 3.10.0)
40-
rspec-core (3.10.1)
41-
rspec-support (~> 3.10.0)
42-
rspec-expectations (3.10.1)
54+
rbi (0.3.6)
55+
prism (~> 1.0)
56+
rbs (>= 3.4.4)
57+
rbs (4.0.0.dev.4)
58+
logger
59+
prism (>= 1.3.0)
60+
require-hooks (0.2.2)
61+
rexml (3.4.2)
62+
rspec (3.13.1)
63+
rspec-core (~> 3.13.0)
64+
rspec-expectations (~> 3.13.0)
65+
rspec-mocks (~> 3.13.0)
66+
rspec-core (3.13.5)
67+
rspec-support (~> 3.13.0)
68+
rspec-expectations (3.13.5)
4369
diff-lcs (>= 1.2.0, < 2.0)
44-
rspec-support (~> 3.10.0)
45-
rspec-mocks (3.10.2)
70+
rspec-support (~> 3.13.0)
71+
rspec-mocks (3.13.5)
4672
diff-lcs (>= 1.2.0, < 2.0)
47-
rspec-support (~> 3.10.0)
48-
rspec-support (3.10.2)
49-
sorbet (0.5.6389)
50-
sorbet-static (= 0.5.6389)
51-
sorbet-runtime (0.5.6295)
52-
sorbet-static (0.5.6389-universal-darwin-14)
53-
sqlite3 (1.4.2)
54-
tzinfo (2.0.4)
73+
rspec-support (~> 3.13.0)
74+
rspec-support (3.13.5)
75+
securerandom (0.4.1)
76+
sorbet (0.5.12435)
77+
sorbet-static (= 0.5.12435)
78+
sorbet-runtime (0.5.12435)
79+
sorbet-static (0.5.12435-universal-darwin)
80+
sorbet-static-and-runtime (0.5.12435)
81+
sorbet (= 0.5.12435)
82+
sorbet-runtime (= 0.5.12435)
83+
spoom (1.7.6)
84+
erubi (>= 1.10.0)
85+
prism (>= 0.28.0)
86+
rbi (>= 0.3.3)
87+
rbs (>= 4.0.0.dev.4)
88+
rexml (>= 3.2.6)
89+
sorbet-static-and-runtime (>= 0.5.10187)
90+
thor (>= 0.19.2)
91+
sqlite3 (2.7.3-arm64-darwin)
92+
tapioca (0.17.7)
93+
benchmark
94+
bundler (>= 2.2.25)
95+
netrc (>= 0.11.0)
96+
parallel (>= 1.21.0)
97+
rbi (>= 0.3.1)
98+
require-hooks (>= 0.2.2)
99+
sorbet-static-and-runtime (>= 0.5.11087)
100+
spoom (>= 1.7.0)
101+
thor (>= 1.2.0)
102+
yard-sorbet
103+
thor (1.4.0)
104+
timeout (0.4.3)
105+
tzinfo (2.0.6)
55106
concurrent-ruby (~> 1.0)
56-
zeitwerk (2.4.2)
107+
uri (1.0.3)
108+
yard (0.9.37)
109+
yard-sorbet (0.9.0)
110+
sorbet-runtime
111+
yard
57112

58113
PLATFORMS
59-
ruby
114+
arm64-darwin
115+
universal-darwin
60116

61117
DEPENDENCIES
62118
explicit_activerecord!
63119
pry
64120
rspec (~> 3.0)
65-
sorbet (~> 0.5.6389)
121+
sorbet
66122
sqlite3
123+
tapioca
67124

68125
BUNDLED WITH
69-
2.1.4
126+
2.7.1

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Once your model is configured correctly to use `ExplicitActiveRecord::Persistenc
4545
### Incremental
4646
`ExplicitActiveRecord::Persistence` is *incremental*. This means that you can include `ExplicitActiveRecord::Persistence`, and specify a *non-raising* behavior when the model is persisted implicitly, and use your logs or bug tracking system to find places where the model is implicitly raising, without breaking production. [See the `README` for `deprecation_helper` for more information on this](https://github.com/Gusto/deprecation_helper/blob/main/README.md).
4747

48-
### Usage
48+
### Usage
4949
The first step is to `include ExplicitActiveRecord::Persistence` in your models:
5050

5151
Secondly, you'll need to configure `dangerous_update_behaviors` (see the `deprecation_helper` gem for more info).
@@ -91,7 +91,7 @@ Note that you cannot pass in a relation to `with_explicit_persistence_for` — o
9191
It is *not* recommended to use this dynamically, such as:
9292
```ruby
9393
# Don't do this!
94-
self.class.with_explicit_persistence_forinstance) do
94+
self.class.with_explicit_persistence_for(instance) do
9595
instance.save!
9696
end
9797
```
@@ -102,23 +102,23 @@ You can specify multiple behaviors to invoke when the model is updated implicitl
102102

103103
Note that by default, `ExplicitActiveRecord` uses the global configuration for `DeprecationHelper`. If your project has already configured `DeprecationHelper`, using:
104104
```ruby
105-
DeprecationHelper.configure { |config| config.deprecation_strategies = [...] })
105+
DeprecationHelper.configure { |config| config.deprecation_strategies = [...] }
106106
```
107107
then `ExplicitActiveRecord` will use the global configuration.
108108

109109
### How it works
110-
When a client calls `my_model.save!` or `my_model.update!` without using the explicit persistence wrapper, `ExplicitActiveRecord::Persistence` will invoke `DeprecationHelper` with whatever deprecation strategies your model is configured with.
110+
When a client calls `my_model.save!` or `my_model.update!` without using the explicit persistence wrapper, `ExplicitActiveRecord::Persistence` will invoke `DeprecationHelper` with whatever deprecation strategies your model is configured with.
111111

112112

113-
## ExplicitActiveRecord::NoDbAccess
113+
## ExplicitActiveRecord::NoDbAccess
114114
`ExplicitActiveRecord::NoDbAccess` has a single public method to restrict the use of the database.
115115

116-
Once your class or module is configured correctly to use `ExplicitActiveRecord::NoDbAccess`, you will not be able to use the database within the `no_db_access` block.
116+
Once your class or module is configured correctly to use `ExplicitActiveRecord::NoDbAccess`, you will not be able to use the database within the `no_db_access` block.
117117

118118
### Incremental
119119
Note that unlike `ExplicitActiveRecord::Persistence`, `ExplicitActiveRecord::NoDbAccess` is NOT *incremental*. This means that using the DB within one of these blocks *will raise*. If you're interested in allowing `no_db_access` to behave like `Persistence`, please file an issue. It is recommended to use `NoDbAccess` in new code where you are very confident your code should not be using the DB.
120120

121-
### Usage
121+
### Usage
122122
The first step is to `include ExplicitActiveRecord::NoDbAccess` in your module or class.
123123

124124
Then, you can use the `no_db_access` block.
@@ -127,7 +127,7 @@ All together, this looks like this:
127127
```ruby
128128
class MyClass # can also be a module
129129
include ExplicitActiveRecord::NoDbAccess
130-
130+
131131
# Class method
132132
def self.my_method
133133
no_db_access do

bin/tapioca

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env ruby
2+
# frozen_string_literal: true
3+
4+
#
5+
# This file was generated by Bundler.
6+
#
7+
# The application 'tapioca' is installed as part of a gem, and
8+
# this file is here to facilitate running it.
9+
#
10+
11+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
12+
13+
require "rubygems"
14+
require "bundler/setup"
15+
16+
load Gem.bin_path("tapioca", "tapioca")

explicit_activerecord.gemspec

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Gem::Specification.new do |spec|
1616
spec.executables = spec.files.grep(%r{Aexe/}) { |f| File.basename(f) }
1717
spec.require_paths = ['lib']
1818

19-
spec.add_dependency 'sorbet-runtime', '~> 0.5.6293'
19+
spec.add_dependency 'sorbet-runtime', '>= 0.5.6293'
2020

2121
# This dependency powers the behavior for ExplicitActiveRecord
2222
spec.add_dependency 'deprecation_helper'
@@ -27,8 +27,8 @@ Gem::Specification.new do |spec|
2727

2828
spec.add_development_dependency 'pry'
2929
spec.add_development_dependency 'rspec', '~> 3.0'
30-
spec.add_development_dependency 'sorbet', '~> 0.5.6389'
31-
32-
# This allows us to test ActiveRecord business logic without needing an underlying database
30+
spec.add_development_dependency 'sorbet'
31+
# This allows us to test ActiveRecord business logic without needing an underlying database:
3332
spec.add_development_dependency 'sqlite3'
33+
spec.add_development_dependency 'tapioca'
3434
end
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
**/*.rbi linguist-vendored=true

sorbet/rbi/annotations/activemodel.rbi

Lines changed: 89 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)