Skip to content
This repository was archived by the owner on Jan 25, 2022. It is now read-only.

Commit 02db207

Browse files
committed
Changed back to using Ruby code for generating the IP address.
1 parent 7871d43 commit 02db207

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

Vagrantfile

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,14 @@
5454
#
5555
# REFERENCE:
5656
#
57-
# system('scripts/before-vagrant.sh')
57+
# File.write('IP', "10.10.10.#{rand(10..250)}") if not File.exists?('IP')
5858
#
59-
# This line calls a `before-vagrant.sh` script to be run
60-
# before any other part of `Vagrantfile` is run.
61-
#
62-
# Currently this script generates a random non-routable IP
63-
# address starting with 10 and randomly selects from 0..254
64-
# for the remaining three octets. It then writes the IP
59+
# This line creates a randomly-generated and non-routable IP
60+
# address starting with 10.10.10. and randomly selects the
61+
# final octet between 10 and 250. It then writes the IP
6562
# address to a file named 'IP' in the project's root folder
6663
# which is the same folder where this Vagrantfile is found
67-
# to ensure future runs of "vagrant up" or "vagrant reload"
64+
# to ensure future runs of "vagrant up" or "vagrand reload"
6865
# will use the same IP address.
6966
#
7067
# The assumption here is that it is very unlikely that this
@@ -79,8 +76,8 @@
7976
# choose to at least evaluate WPLib Box, although someone
8077
# may occasionally need to debug why it is not working.
8178
#
82-
# If we can find a better approach, we will be happy to
83-
# to switch to it later. Suggestions welcome.
79+
# If we can find a better approach later, we will be happy
80+
# to switch to it.
8481
#
8582
# config.vm.box = "wplib/wplib"
8683
#
@@ -255,7 +252,7 @@
255252

256253
Vagrant.configure(2) do |config|
257254

258-
system('scripts/before-vagrant.sh')
255+
File.write('IP', "10.10.10.#{rand(10..250)}") if not File.exists?('IP')
259256

260257
config.vm.box = "wplib/wplib"
261258
config.vm.hostname = "wplib.box"

0 commit comments

Comments
 (0)