From 5b954b93e3bd65e9505b3694eb8f188c3d120dbe Mon Sep 17 00:00:00 2001 From: Trae Robrock Date: Tue, 16 Jul 2013 21:13:03 -0700 Subject: [PATCH] Fix #19 homesickrc pathname needs a to_s to eval Also, moved the file evaluation into a new function so the script can be ran manually which should make testing these scripts easier. --- lib/homesick.rb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/homesick.rb b/lib/homesick.rb index 9af78eb..7fe7842 100644 --- a/lib/homesick.rb +++ b/lib/homesick.rb @@ -53,13 +53,21 @@ class Homesick < Thor end end + rc(destination) + end + end + + desc 'rc CASTLE', 'Run the .homesickrc for the specified castle' + def rc(name = DEFAULT_CASTLE_NAME) + inside repos_dir do + destination = Pathname.new(name) homesickrc = destination.join('.homesickrc').expand_path if homesickrc.exist? - proceed = shell.yes?("#{uri} has a .homesickrc. Proceed with evaling it? (This could be destructive)") + proceed = shell.yes?("#{name} has a .homesickrc. Proceed with evaling it? (This could be destructive)") if proceed shell.say_status 'eval', homesickrc inside destination do - eval homesickrc.read, binding, homesickrc.expand_path + eval homesickrc.read, binding, homesickrc.expand_path.to_s end else shell.say_status 'eval skip', "not evaling #{homesickrc}, #{destination} may need manual configuration", :blue