Coding standards fixes based off of Rubocop and minor edits to make

logic flow easier to understand.
This commit is contained in:
Jeremy Cook
2015-10-12 14:20:47 -04:00
parent a9a5b81dc5
commit 7632591681
6 changed files with 70 additions and 126 deletions

View File

@@ -3,16 +3,14 @@ module Homesick
module Actions
# File-related helper methods for Homesick
module FileActions
def mv(source, destination, config = {})
def mv(source, destination)
source = Pathname.new(source)
destination = Pathname.new(destination + source.basename)
if destination.exist?
case
when destination.exist? && (options[:force] || shell.file_collision(destination) { source })
say_status :conflict, "#{destination} exists", :red
FileUtils.mv source, destination if (options[:force] || shell.file_collision(destination) { source }) && !options[:pretend]
FileUtils.mv source, destination unless options[:pretend]
else
# this needs some sort of message here.
FileUtils.mv source, destination unless options[:pretend]
end
end
@@ -43,7 +41,7 @@ module Homesick
FileUtils.rm_r dir
end
def ln_s(source, destination, config = {})
def ln_s(source, destination)
source = Pathname.new(source)
destination = Pathname.new(destination)
FileUtils.mkdir_p destination.dirname