Add and apply Style/RedundantBegin rubocop rule

We're about to add code which might fall into the `RedundantBegin`
category, so we're adding the rule in order to prevent that.
This commit is contained in:
Javi Martín
2024-10-30 15:55:29 +01:00
parent 9f38ed6bae
commit 07202fea10
9 changed files with 109 additions and 124 deletions

View File

@@ -84,18 +84,16 @@ end
task :install_ruby do
on roles(:app) do
within release_path do
begin
current_ruby = capture(:rvm, "current")
rescue SSHKit::Command::Failed
current_ruby = capture(:rvm, "current")
rescue SSHKit::Command::Failed
after "install_ruby", "rvm1:install:rvm"
after "install_ruby", "rvm1:install:ruby"
else
if current_ruby.include?("not installed")
after "install_ruby", "rvm1:install:rvm"
after "install_ruby", "rvm1:install:ruby"
else
if current_ruby.include?("not installed")
after "install_ruby", "rvm1:install:rvm"
after "install_ruby", "rvm1:install:ruby"
else
info "Ruby: Using #{current_ruby}"
end
info "Ruby: Using #{current_ruby}"
end
end
end
@@ -104,19 +102,17 @@ end
task :install_node do
on roles(:app) do
with rails_env: fetch(:rails_env) do
execute fetch(:fnm_install_node_command)
rescue SSHKit::Command::Failed
begin
execute fetch(:fnm_install_node_command)
execute fetch(:fnm_setup_command)
rescue SSHKit::Command::Failed
begin
execute fetch(:fnm_setup_command)
rescue SSHKit::Command::Failed
execute fetch(:fnm_install_command)
else
execute fetch(:fnm_update_command)
end
execute fetch(:fnm_install_node_command)
execute fetch(:fnm_install_command)
else
execute fetch(:fnm_update_command)
end
execute fetch(:fnm_install_node_command)
end
end
end