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.
This commit is contained in:
Trae Robrock
2013-07-16 21:13:03 -07:00
parent 846c5c202b
commit 75dcad8ea4

View File

@@ -52,13 +52,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