Skip to content

Commit

Permalink
Fix Style/Next cop
Browse files Browse the repository at this point in the history
  • Loading branch information
archanaserver committed May 9, 2024
1 parent 2c4e91d commit 359d419
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions rename.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,16 @@ def usage

Find.find('.') do |path|
# Change all the paths to the new snake_case name
if /foreman_plugin_template/i.match?(path)
new = path.gsub('foreman_plugin_template', snake)
# Recursively copy the directory and store the original for deletion
# Check for $ because we don't need to copy template/hosts for example
if File.directory?(path) && path =~ /foreman_plugin_template$/i
FileUtils.cp_r(path, new)
old_dirs << path
else
# gsub replaces all instances, so it will work on the new directories
FileUtils.mv(path, new)
end
next unless /foreman_plugin_template/i.match?(path)
new = path.gsub('foreman_plugin_template', snake)
# Recursively copy the directory and store the original for deletion
# Check for $ because we don't need to copy template/hosts for example
if File.directory?(path) && path =~ /foreman_plugin_template$/i
FileUtils.cp_r(path, new)
old_dirs << path
else
# gsub replaces all instances, so it will work on the new directories
FileUtils.mv(path, new)
end
end

Expand Down

0 comments on commit 359d419

Please sign in to comment.