core: Persist box URL and download date into a JSON file under boxes directory

This commit is contained in:
Fabio Rehm 2013-10-18 17:56:51 -03:00
parent 05a8cf523a
commit 500deb5138
1 changed files with 10 additions and 0 deletions

View File

@ -77,6 +77,9 @@ module Vagrant
env[:ui].success(
I18n.t("vagrant.actions.box.add.added", name: box_added.name, provider: box_added.provider))
# Persists URL used on download and the time it was added
write_extra_info(box_added, url)
# Passes on the newly added box to the rest of the middleware chain
env[:box_added] = box_added
@ -89,6 +92,13 @@ module Vagrant
File.unlink(@temp_path)
end
end
def write_extra_info(box_added, url)
info = {'url' => url, 'downloaded_at' => Time.now.utc}
box_added.directory.join('info.json').open("w+") do |f|
f.write(JSON.dump(info))
end
end
end
end
end