Skip to content

Commit a8c528a

Browse files
committed
Update Ruby version and Gems to secure versions
* Ruby 3.0 is EOL; update to the standard 3.3 we're using everywhere. * Ensure Docker image is ruby:3.3-slim to match version update. * Update the Gems to fix CVEs. * Update RuboCop to a version that supports Ruby 3.3. * Fix new RuboCop issues (because we went > 3.1 for new syntax).
1 parent 3a90a3b commit a8c528a

6 files changed

Lines changed: 42 additions & 30 deletions

File tree

.ruby-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.0.3
1+
~> 3.3

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# The base stage scaffolds elements which are common to building and running
55
# the application, such as installing ca-certificates, creating the app user,
66
# and installing runtime system dependencies.
7-
FROM ruby:3.0.3-slim AS base
7+
FROM ruby:3.3-slim AS base
88

99
# ------------------------------------------------------------
1010
# Create the application user/group and installation directory

Gemfile.lock

Lines changed: 34 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,32 @@
11
GEM
22
remote: https://rubygems.org/
33
specs:
4-
addressable (2.8.0)
5-
public_suffix (>= 2.0.2, < 5.0)
6-
ast (2.4.2)
4+
addressable (2.9.0)
5+
public_suffix (>= 2.0.2, < 8.0)
6+
ast (2.4.3)
77
berkeley_library-docker (0.1.1)
88
chronic (0.10.2)
99
colorize (0.8.1)
1010
crack (0.4.5)
1111
rexml
1212
diff-lcs (1.5.0)
1313
hashdiff (1.0.1)
14+
json (2.20.0)
15+
language_server-protocol (3.17.0.5)
16+
lint_roller (1.1.0)
1417
net-sftp (3.0.0)
1518
net-ssh (>= 5.0.0, < 7.0.0)
1619
net-ssh (6.1.0)
17-
parallel (1.21.0)
18-
parser (3.1.1.0)
20+
parallel (2.1.0)
21+
parser (3.3.11.1)
1922
ast (~> 2.4.1)
20-
public_suffix (4.0.6)
23+
racc
24+
prism (1.9.0)
25+
public_suffix (7.0.5)
26+
racc (1.8.1)
2127
rainbow (3.1.1)
22-
regexp_parser (2.2.1)
23-
rexml (3.2.5)
28+
regexp_parser (2.12.0)
29+
rexml (3.4.4)
2430
rspec (3.11.0)
2531
rspec-core (~> 3.11.0)
2632
rspec-expectations (~> 3.11.0)
@@ -39,30 +45,36 @@ GEM
3945
rspec-support (3.11.0)
4046
rspec_junit_formatter (0.5.1)
4147
rspec-core (>= 2, < 4, != 2.12.0)
42-
rubocop (1.26.0)
43-
parallel (~> 1.10)
44-
parser (>= 3.1.0.0)
48+
rubocop (1.88.0)
49+
json (~> 2.3)
50+
language_server-protocol (~> 3.17.0.2)
51+
lint_roller (~> 1.1.0)
52+
parallel (>= 1.10)
53+
parser (>= 3.3.0.2)
4554
rainbow (>= 2.2.2, < 4.0)
46-
regexp_parser (>= 1.8, < 3.0)
47-
rexml
48-
rubocop-ast (>= 1.16.0, < 2.0)
55+
regexp_parser (>= 2.9.3, < 3.0)
56+
rubocop-ast (>= 1.49.0, < 2.0)
4957
ruby-progressbar (~> 1.7)
50-
unicode-display_width (>= 1.4.0, < 3.0)
51-
rubocop-ast (1.16.0)
52-
parser (>= 3.1.1.0)
58+
unicode-display_width (>= 2.4.0, < 4.0)
59+
rubocop-ast (1.49.1)
60+
parser (>= 3.3.7.2)
61+
prism (~> 1.7)
5362
rubocop-checkstyle_formatter (0.5.0)
5463
rubocop (>= 1.14.0)
55-
ruby-progressbar (1.11.0)
56-
thor (1.2.1)
64+
ruby-progressbar (1.13.0)
65+
thor (1.5.0)
5766
timecop (0.9.5)
58-
unicode-display_width (2.1.0)
67+
unicode-display_width (3.2.0)
68+
unicode-emoji (~> 4.1)
69+
unicode-emoji (4.2.0)
5970
webmock (3.14.0)
6071
addressable (>= 2.8.0)
6172
crack (>= 0.3.2)
6273
hashdiff (>= 0.4.0, < 2.0.0)
6374

6475
PLATFORMS
6576
aarch64-linux
77+
arm64-darwin-24
6678
x86_64-darwin-19
6779
x86_64-linux
6880

@@ -81,7 +93,7 @@ DEPENDENCIES
8193
webmock
8294

8395
RUBY VERSION
84-
ruby 3.0.3p157
96+
ruby 3.3.11
8597

8698
BUNDLED WITH
87-
2.2.32
99+
4.0.9

lib/berkeley_library/sftp_handler/downloader/base.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ def initialize(host: nil, username: nil, password: nil, keys: nil, key_data: nil
2828
@key_data = key_data.is_a?(Array) ? key_data : [key_data].compact
2929
end
3030

31-
def connect(&block)
31+
def connect(&)
3232
puts "Connecting to sftp://#{@username}@#{@host}"
33-
Net::SFTP.start(@host, @username, ssh_options, sftp_options, &block)
33+
Net::SFTP.start(@host, @username, ssh_options, sftp_options, &)
3434
end
3535

3636
def ssh_options
@@ -53,7 +53,7 @@ def sftp_options
5353
# Helper method for pulling default initializer values from the environment
5454
def default_for(option, fallback = nil)
5555
envvar = "#{config_prefix}#{option.to_s.upcase}"
56-
getter = "default_#{option}".to_sym
56+
getter = :"default_#{option}"
5757
ENV.fetch(envvar, respond_to?(getter) ? send(getter) : fallback)
5858
end
5959

lib/berkeley_library/sftp_handler/downloader/gobi.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def default_host
4343
end
4444

4545
def default_username
46-
ENV['LIT_GOBI_USERNAME']
46+
ENV.fetch('LIT_GOBI_USERNAME', nil)
4747
end
4848

4949
def ssh_options

lib/berkeley_library/sftp_handler/downloader/lbnl.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ def default_host
3535
end
3636

3737
def default_username
38-
ENV['LIT_LBNL_USERNAME']
38+
ENV.fetch('LIT_LBNL_USERNAME', nil)
3939
end
4040

4141
def default_filename
42-
@default_filename ||= "#{ENV['LBNL_FILENAME']}_#{most_recent_monday.strftime('%Y%m%d')}.zip"
42+
@default_filename ||= "#{ENV.fetch('LBNL_FILENAME', nil)}_#{most_recent_monday.strftime('%Y%m%d')}.zip"
4343
end
4444

4545
def most_recent_monday

0 commit comments

Comments
 (0)