summaryrefslogtreecommitdiff
path: root/lib/rubygems/commands/sources_command.rb
diff options
context:
space:
mode:
authorHiroshi SHIBATA <[email protected]>2023-03-16 13:53:44 +0900
committerHiroshi SHIBATA <[email protected]>2023-03-17 18:50:55 +0900
commitf4b073ef7ad959c43b7d14acad2df49a5d056874 (patch)
tree4423be6ccaa43221d133f14d624c7dd52a51f6c7 /lib/rubygems/commands/sources_command.rb
parent4868cfcf1d8480ae13dc5e84c0e66dd44b950a89 (diff)
[rubygems/rubygems] util/rubocop -A --only Style/UnlessElse
https://github.com/rubygems/rubygems/commit/184c03270c
Diffstat (limited to 'lib/rubygems/commands/sources_command.rb')
-rw-r--r--lib/rubygems/commands/sources_command.rb18
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/rubygems/commands/sources_command.rb b/lib/rubygems/commands/sources_command.rb
index 0ed5b4a8f8..aa2fdd9239 100644
--- a/lib/rubygems/commands/sources_command.rb
+++ b/lib/rubygems/commands/sources_command.rb
@@ -98,16 +98,16 @@ Do you want to add this insecure source?
path = Gem.spec_cache_dir
FileUtils.rm_rf path
- unless File.exist? path
- say "*** Removed specs cache ***"
- else
- unless File.writable? path
- say "*** Unable to remove source cache (write protected) ***"
- else
+ if File.exist? path
+ if File.writable? path
say "*** Unable to remove source cache ***"
+ else
+ say "*** Unable to remove source cache (write protected) ***"
end
terminate_interaction 1
+ else
+ say "*** Removed specs cache ***"
end
end
@@ -193,13 +193,13 @@ To remove a source use the --remove argument:
end
def remove_source(source_uri) # :nodoc:
- unless Gem.sources.include? source_uri
- say "source #{source_uri} not present in cache"
- else
+ if Gem.sources.include? source_uri
Gem.sources.delete source_uri
Gem.configuration.write
say "#{source_uri} removed from sources"
+ else
+ say "source #{source_uri} not present in cache"
end
end