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
committed by thilko
parent b596e063f5
commit 5b954b93e3

View File

@@ -53,13 +53,21 @@ class Homesick < Thor
end end
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 homesickrc = destination.join('.homesickrc').expand_path
if homesickrc.exist? 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 if proceed
shell.say_status 'eval', homesickrc shell.say_status 'eval', homesickrc
inside destination do inside destination do
eval homesickrc.read, binding, homesickrc.expand_path eval homesickrc.read, binding, homesickrc.expand_path.to_s
end end
else else
shell.say_status 'eval skip', "not evaling #{homesickrc}, #{destination} may need manual configuration", :blue shell.say_status 'eval skip', "not evaling #{homesickrc}, #{destination} may need manual configuration", :blue