Minor fixes suggested by rubocop.
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
module Homesick
|
||||
module Actions
|
||||
# File-related helper methods for Homesick
|
||||
@@ -6,13 +5,10 @@ module Homesick
|
||||
def mv(source, destination)
|
||||
source = Pathname.new(source)
|
||||
destination = Pathname.new(destination + source.basename)
|
||||
case
|
||||
when destination.exist? && (options[:force] || shell.file_collision(destination) { source })
|
||||
if destination.exist? && (options[:force] || shell.file_collision(destination) { source })
|
||||
say_status :conflict, "#{destination} exists", :red
|
||||
FileUtils.mv source, destination unless options[:pretend]
|
||||
else
|
||||
FileUtils.mv source, destination unless options[:pretend]
|
||||
end
|
||||
FileUtils.mv source, destination unless options[:pretend]
|
||||
end
|
||||
|
||||
def rm_rf(dir)
|
||||
@@ -24,7 +20,7 @@ module Homesick
|
||||
target = Pathname.new(target)
|
||||
|
||||
if target.symlink?
|
||||
say_status :unlink, "#{target.expand_path}", :green
|
||||
say_status :unlink, target.expand_path.to_s, :green
|
||||
FileUtils.rm_rf target
|
||||
else
|
||||
say_status :conflict, "#{target} is not a symlink", :red
|
||||
|
||||
@@ -136,11 +136,12 @@ module Homesick
|
||||
def link(name = DEFAULT_CASTLE_NAME)
|
||||
check_castle_existance(name, 'symlink')
|
||||
|
||||
inside castle_dir(name) do
|
||||
castle_path = castle_dir(name)
|
||||
inside castle_path do
|
||||
subdirs = subdirs(name)
|
||||
|
||||
# link files
|
||||
symlink_each(name, castle_dir(name), subdirs)
|
||||
symlink_each(name, castle_path, subdirs)
|
||||
|
||||
# link files in subdirs
|
||||
subdirs.each do |subdir|
|
||||
|
||||
Reference in New Issue
Block a user