Created
April 13, 2012 15:13
-
-
Save msabramo/2377571 to your computer and use it in GitHub Desktop.
A crude way of getting all of the host-only IP addresses I've used for vagrant vms
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env ruby | |
| require 'find' | |
| def process_vagrantfile(vagrantfile) | |
| box = nil | |
| f = File.open(vagrantfile).each do |line| | |
| if match = /^\s*config\.vm\.box = "([^"]+)"/.match(line) then | |
| box = match[1] | |
| end | |
| if match = /^\s*config\.vm\.network :hostonly, "([^"]+)"/.match(line) then | |
| puts "#{match[1]} #{box}" | |
| end | |
| end | |
| end | |
| Find.find(ENV["PWD"]) do |path| | |
| if path.end_with? "Vagrantfile" then | |
| process_vagrantfile path | |
| end | |
| end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment