Skip to content

Commit 84117e9

Browse files
authored
feat: Update dependencies. (#2)
1 parent f539f87 commit 84117e9

14 files changed

Lines changed: 176 additions & 89 deletions

File tree

.github/dependabot.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: bundler
4+
directory: "/"
5+
schedule:
6+
interval: daily
7+
open-pull-requests-limit: 10
8+
groups:
9+
development-and-testing:
10+
dependency-type: development
11+
production:
12+
dependency-type: production
13+
- package-ecosystem: github-actions
14+
directory: "/"
15+
schedule:
16+
interval: daily
17+
open-pull-requests-limit: 10

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
!sample.env
55
coverage/
66
out/
7+
settings.local.json
78

89
# Ignore Byebug command history file.
910
.byebug_history

.rubocop.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
require:
2-
- rubocop-yard
3-
41
plugins:
52
- rubocop-md
3+
- rubocop-performance
64
- rubocop-rake
75
- rubocop-rspec
6+
- rubocop-yard
87

98
AllCops:
109
NewCops: enable

.ruby-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.3.4
1+
4.0.3

.tool-versions

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ruby 4.0.3

Gemfile

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,15 @@ gemspec
88
gem 'configsl', git: 'https://github.com/jamesiarmes/configsl.git', branch: 'collections'
99

1010
group :development do
11-
gem 'rake', '~> 13.2'
12-
gem 'rubocop', '~> 1.75'
11+
gem 'rake', '~> 13.4'
12+
gem 'rubocop', '~> 1.86'
1313
gem 'rubocop-md', '~> 2.0'
14+
gem 'rubocop-performance', '~> 1.26'
1415
gem 'rubocop-rake', '~> 0.7'
15-
gem 'rubocop-rspec', '~> 3.5'
16-
gem 'rubocop-yard', '~> 0.10'
16+
gem 'rubocop-rspec', '~> 3.9'
17+
gem 'rubocop-yard', '~> 1.1'
18+
gem 'ruby-lsp', '~> 0.26'
19+
gem 'ruby-lsp-rspec', '~> 0.1'
1720
end
1821

1922
group :test do

Gemfile.lock

Lines changed: 66 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -19,95 +19,113 @@ GEM
1919
remote: https://rubygems.org/
2020
specs:
2121
ast (2.4.3)
22-
aws-eventstream (1.3.2)
23-
aws-partitions (1.1083.0)
24-
aws-sdk-core (3.222.1)
22+
aws-eventstream (1.4.0)
23+
aws-partitions (1.1245.0)
24+
aws-sdk-core (3.246.0)
2525
aws-eventstream (~> 1, >= 1.3.0)
2626
aws-partitions (~> 1, >= 1.992.0)
2727
aws-sigv4 (~> 1.9)
2828
base64
29+
bigdecimal
2930
jmespath (~> 1, >= 1.6.1)
3031
logger
31-
aws-sdk-ec2 (1.515.0)
32-
aws-sdk-core (~> 3, >= 3.216.0)
32+
aws-sdk-ec2 (1.614.0)
33+
aws-sdk-core (~> 3, >= 3.244.0)
3334
aws-sigv4 (~> 1.5)
34-
aws-sdk-ssm (1.192.0)
35-
aws-sdk-core (~> 3, >= 3.216.0)
35+
aws-sdk-ssm (1.212.0)
36+
aws-sdk-core (~> 3, >= 3.244.0)
3637
aws-sigv4 (~> 1.5)
37-
aws-sigv4 (1.11.0)
38+
aws-sigv4 (1.12.1)
3839
aws-eventstream (~> 1, >= 1.0.2)
39-
base64 (0.2.0)
40-
diff-lcs (1.6.1)
40+
base64 (0.3.0)
41+
bigdecimal (4.1.2)
42+
diff-lcs (1.6.2)
4143
docile (1.4.1)
42-
facets (3.1.0)
44+
facets (3.2.0)
4345
jmespath (1.6.2)
44-
json (2.10.2)
45-
language_server-protocol (3.17.0.4)
46-
libxml-ruby (5.0.3)
46+
json (2.19.5)
47+
language_server-protocol (3.17.0.5)
48+
libxml-ruby (5.0.6)
4749
lint_roller (1.1.0)
4850
logger (1.7.0)
49-
parallel (1.26.3)
50-
parser (3.3.7.4)
51+
parallel (2.1.0)
52+
parser (3.3.11.1)
5153
ast (~> 2.4.1)
5254
racc
53-
prism (1.4.0)
55+
prism (1.9.0)
5456
racc (1.8.1)
5557
rainbow (3.1.1)
56-
rake (13.2.1)
57-
regexp_parser (2.10.0)
58-
rspec (3.13.0)
58+
rake (13.4.2)
59+
rbs (4.0.2)
60+
logger
61+
prism (>= 1.6.0)
62+
tsort
63+
regexp_parser (2.12.0)
64+
rspec (3.13.2)
5965
rspec-core (~> 3.13.0)
6066
rspec-expectations (~> 3.13.0)
6167
rspec-mocks (~> 3.13.0)
62-
rspec-core (3.13.3)
68+
rspec-core (3.13.6)
6369
rspec-support (~> 3.13.0)
64-
rspec-expectations (3.13.3)
70+
rspec-expectations (3.13.5)
6571
diff-lcs (>= 1.2.0, < 2.0)
6672
rspec-support (~> 3.13.0)
6773
rspec-github (3.0.0)
6874
rspec-core (~> 3.0)
69-
rspec-mocks (3.13.2)
75+
rspec-mocks (3.13.8)
7076
diff-lcs (>= 1.2.0, < 2.0)
7177
rspec-support (~> 3.13.0)
72-
rspec-support (3.13.2)
73-
rubocop (1.75.2)
78+
rspec-support (3.13.7)
79+
rubocop (1.86.1)
7480
json (~> 2.3)
7581
language_server-protocol (~> 3.17.0.2)
7682
lint_roller (~> 1.1.0)
77-
parallel (~> 1.10)
83+
parallel (>= 1.10)
7884
parser (>= 3.3.0.2)
7985
rainbow (>= 2.2.2, < 4.0)
8086
regexp_parser (>= 2.9.3, < 3.0)
81-
rubocop-ast (>= 1.44.0, < 2.0)
87+
rubocop-ast (>= 1.49.0, < 2.0)
8288
ruby-progressbar (~> 1.7)
8389
unicode-display_width (>= 2.4.0, < 4.0)
84-
rubocop-ast (1.44.0)
90+
rubocop-ast (1.49.1)
8591
parser (>= 3.3.7.2)
86-
prism (~> 1.4)
87-
rubocop-md (2.0.0)
92+
prism (~> 1.7)
93+
rubocop-md (2.0.4)
8894
lint_roller (~> 1.1)
8995
rubocop (>= 1.72.1)
96+
rubocop-performance (1.26.1)
97+
lint_roller (~> 1.1)
98+
rubocop (>= 1.75.0, < 2.0)
99+
rubocop-ast (>= 1.47.1, < 2.0)
90100
rubocop-rake (0.7.1)
91101
lint_roller (~> 1.1)
92102
rubocop (>= 1.72.1)
93-
rubocop-rspec (3.5.0)
103+
rubocop-rspec (3.9.0)
94104
lint_roller (~> 1.1)
95-
rubocop (~> 1.72, >= 1.72.1)
96-
rubocop-yard (0.10.0)
97-
rubocop (~> 1.21)
105+
rubocop (~> 1.81)
106+
rubocop-yard (1.1.0)
107+
lint_roller
108+
rubocop (~> 1.72)
98109
yard
110+
ruby-lsp (0.26.9)
111+
language_server-protocol (~> 3.17.0)
112+
prism (>= 1.2, < 2.0)
113+
rbs (>= 3, < 5)
114+
ruby-lsp-rspec (0.1.29)
115+
ruby-lsp (~> 0.26.0)
99116
ruby-progressbar (1.13.0)
100117
simplecov (0.22.0)
101118
docile (~> 1.1)
102119
simplecov-html (~> 0.11)
103120
simplecov_json_formatter (~> 0.1)
104-
simplecov-html (0.13.1)
121+
simplecov-html (0.13.2)
105122
simplecov_json_formatter (0.1.4)
106-
thor (1.3.2)
107-
unicode-display_width (3.1.4)
108-
unicode-emoji (~> 4.0, >= 4.0.4)
109-
unicode-emoji (4.0.4)
110-
yard (0.9.37)
123+
thor (1.5.0)
124+
tsort (0.2.0)
125+
unicode-display_width (3.2.0)
126+
unicode-emoji (~> 4.1)
127+
unicode-emoji (4.2.0)
128+
yard (0.9.43)
111129

112130
PLATFORMS
113131
arm64-darwin-23
@@ -116,15 +134,18 @@ PLATFORMS
116134
DEPENDENCIES
117135
cfa-eng-cli!
118136
configsl!
119-
rake (~> 13.2)
137+
rake (~> 13.4)
120138
rspec (~> 3.13)
121139
rspec-github (~> 3.0)
122-
rubocop (~> 1.75)
140+
rubocop (~> 1.86)
123141
rubocop-md (~> 2.0)
142+
rubocop-performance (~> 1.26)
124143
rubocop-rake (~> 0.7)
125-
rubocop-rspec (~> 3.5)
126-
rubocop-yard (~> 0.10)
144+
rubocop-rspec (~> 3.9)
145+
rubocop-yard (~> 1.1)
146+
ruby-lsp (~> 0.26)
147+
ruby-lsp-rspec (~> 0.1)
127148
simplecov (~> 0.22)
128149

129150
BUNDLED WITH
130-
2.6.8
151+
4.0.6

Rakefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ Bundler::GemHelper.install_tasks
1010

1111
RuboCop::RakeTask.new(:rubocop) do |task|
1212
task.requires << 'rubocop'
13-
task.formatters = %w[pacman]
1413
task.formatters << 'github' if ENV.fetch('GITHUB_ACTIONS', false)
1514
end
1615

lib/cfa_eng_cli/commands/bastion.rb

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,22 @@
11
# frozen_string_literal: true
22

3-
require 'thor'
4-
3+
require_relative 'command'
54
require_relative '../bastion'
65
require_relative '../config/profile'
76
require_relative '../session_manager'
87

98
module CfaEngCli
109
module Commands
1110
# Commands for interacting with bastion hosts.
12-
class Bastion < Thor
11+
class Bastion < Command
1312
class_option :profile, type: :string, required: true, default: ENV.fetch('CFA_PROFILE', nil)
1413

1514
desc 'create-tunnel', 'Create a new tunnel configuration'
1615
def create_tunnel
17-
params = {}
1816
profile = Config::Profile.load(options[:profile])
19-
Config::RemoteTunnel.options.each do |name, opts|
20-
unless options[name]
21-
value = ask("#{opts[:prompt]} [#{opts[:default] if opts[:default]}]:")
22-
options[name] = value.empty? ? opts[:default] : value
23-
end
24-
25-
params[name] = options[name]
26-
end
17+
params = collect_tunnel_params
2718

28-
profile.tunnels[params[:name]] = Config::RemoteTunnel.new(params)
19+
profile.tunnels[params[:name].to_sym] = Config::RemoteTunnel.new(params)
2920
profile.write
3021
end
3122

@@ -40,13 +31,34 @@ def delete_tunnel(name)
4031
option :name, type: :string
4132
def tunnel
4233
profile = Config::Profile.load(options[:profile])
43-
tunnel = profile.tunnels[options[:name].to_sym]
44-
raise Thor::Error, "No tunnel found for #{options[:name]}" if tunnel.nil?
34+
config = profile.tunnels[options[:name].to_sym]
35+
raise Thor::Error, "No tunnel found for #{options[:name]}" if config.nil?
36+
37+
open_tunnel(profile, config)
38+
end
4539

40+
private
41+
42+
# Collects the parameters for a new tunnel configuration.
43+
#
44+
# @return [Hash] The parameters for the new tunnel configuration.
45+
def collect_tunnel_params
46+
Config::RemoteTunnel.options.each_with_object({}) do |(name, opts), params|
47+
options[name] = prompt_for_parameter(opts) unless options[name]
48+
params[name] = options[name]
49+
end
50+
end
51+
52+
# Opens a tunnel to the bastion for remote port forwarding.
53+
#
54+
# @param profile [Config::Profile] Profile to use for the bastion.
55+
# @param config [Config::RemoteTunnel] Configuration for the tunnel.
56+
def open_tunnel(profile, config)
4657
bastion = CfaEngCli::Bastion.new(profile)
4758
session = SessionManager.new(
48-
bastion.tunnel(tunnel.remote_port, tunnel.host, tunnel.local_port)
59+
bastion.tunnel(config.remote_port, config.host, config.local_port)
4960
)
61+
5062
session.open(bastion.target)
5163
end
5264
end
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# frozen_string_literal: true
2+
3+
require 'thor'
4+
5+
module CfaEngCli
6+
module Commands
7+
# Base class for all CLI commands.
8+
class Command < Thor
9+
private
10+
11+
# Prompts the user for a parameter value.
12+
#
13+
# @param opts [Hash] Options for the parameter to prompt for.
14+
# @return [Object] Provided or default value of the parameter.
15+
def prompt_for_parameter(opts)
16+
value = ask("#{opts[:prompt]} [#{opts[:default] if opts[:default]}]:")
17+
value.empty? ? opts[:default] : value
18+
end
19+
end
20+
end
21+
end

0 commit comments

Comments
 (0)