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

Commit 43245c1

Browse files
committed
Merge branch '0.17.1'
2 parents cd11629 + 9797000 commit 43245c1

File tree

13 files changed

+274
-541
lines changed

13 files changed

+274
-541
lines changed

.gitignore

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,23 @@
1-
.*.swp
2-
/box
3-
/.idea
4-
/IP
5-
/.vagrant
6-
/.vscode
7-
/logs
1+
#
2+
# THESE .gitignore FILES FOR THE WPLib Box REPO.
3+
# DELETE these to meet the needs of your project.
4+
#
85
/sql/*
96
!/sql/README.sql.md
10-
!/sql/provision.sql
7+
/sql/provision.sql
118
/docs
129
!/docs/README.docs.md
10+
/project.json.lock
11+
/www/wp-content/mu-plugins/wplib-box-db-provisioner/provisioned
12+
/box
13+
14+
#
15+
# These are useful for any project that uses WPLib Box.
16+
#
17+
/.vagrant/machines
18+
!/.vagrant/box.rb
19+
.*.swp
20+
/.idea
21+
/IP
22+
/logs
1323

.vagrant/box.rb

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
#
2+
# WPLib Box Bootstrapping Script
3+
#
4+
# @example
5+
# b = Box.new(Vagrant)
6+
#
7+
# puts b.filepath
8+
# puts b.hostname
9+
# puts b.box_version
10+
#
11+
# b = Box.new()
12+
# b.prerequisites()
13+
# b.add_aliases([
14+
# "www.{hostname}",
15+
# "adminer.{hostname}",
16+
# "mailhog.{hostname}",
17+
# "docs.{hostname}",
18+
# ])
19+
# b.startup(config)
20+
#
21+
22+
require 'json'
23+
24+
class Box
25+
attr_accessor :filepath
26+
27+
def hostname()
28+
@project['hostname']
29+
end
30+
31+
def box_version()
32+
@project['localdev']['version']
33+
end
34+
35+
def add_aliases(aliases)
36+
@project['aliases'] = aliases
37+
end
38+
39+
def initialize()
40+
@filepath = File.expand_path "project.json"
41+
if File.exists?(@filepath)
42+
@project = JSON.parse(File.read(@filepath))
43+
else
44+
@project = {}
45+
@project['readme'] = []
46+
@project['readme'] << "This file allows you to configure WPLib Box."
47+
@project['readme'] << "Find available components by typing 'vagrant ssh' in terminal followed by 'box component available'."
48+
@project['readme'] << "You can delete this `readme` section assuming it is still valid JSON after deletion."
49+
@project['hostname'] = "wplib.box"
50+
@project['aliases'] = %w( docs.{hostname} www.{hostname} adminer.{hostname} mailhog.{hostname} )
51+
@project['localdev'] = {}
52+
@project['localdev']['name'] = "WPLib Box"
53+
@project['localdev']['version'] = "0.17.1"
54+
@project['localdev']['website'] = "http://wplib.org/box/"
55+
@project['stack'] = {}
56+
@project['stack']['wordpress/dbserver'] = 'wplib/mysql:5.5.60'
57+
@project['stack']['wordpress/webserver'] = 'wplib/nginx:1.14.0'
58+
@project['stack']['wordpress/processvm'] = 'wplib/php:7.1.18'
59+
@project['stack']['wordpress/cacheserver'] = 'wplib/redis:4.0.9'
60+
@project['stack']['mkdocs/webserver'] = 'wplib/mkdocs:0.15.3'
61+
@project['stack']['box/mailsender'] = 'wplib/mailhog:1.0.0'
62+
@project['stack']['box/webproxy'] = 'wplib/proxy:1.14.0'
63+
@project['stack']['box/sqladmin'] = 'wplib/adminer:4.6.2'
64+
File.write(@filepath,JSON.pretty_generate(@project))
65+
end
66+
@project
67+
end
68+
69+
def prerequisites()
70+
Vagrant.require_version ">= 2.1"
71+
72+
vboxmanage = Vagrant::Util::Which.which("VBoxManage") || Vagrant::Util::Which.which("VBoxManage.exe")
73+
if vboxmanage == nil
74+
abort "\nWPLib Box could not find VirtualBox 5.2+. If you know it is installed please\n" \
75+
"check your path to ensure we can find it. If not installed, please download\n" \
76+
"version 5.2 or greater from:\n\n\thttps://www.virtualbox.org/wiki/Downloads\n"
77+
else
78+
version = Vagrant::Util::Subprocess.execute(vboxmanage, '--version')
79+
version = Gem::Version.create(version.stdout.strip!)
80+
unless version >= Gem::Version.create('5.2')
81+
abort "\nWPLib Box needs VirtualBox 5.2 or greater. Your current version is " + version.version + "\n" \
82+
"Please download a newer version of VirtualBox from:\n\n\thttps://www.virtualbox.org/wiki/Downloads\n"
83+
end
84+
end
85+
86+
system "vagrant plugin install vagrant-hostsupdater" \
87+
unless Vagrant.has_plugin? "vagrant-hostsupdater"
88+
89+
end
90+
91+
def start(config)
92+
93+
config.vm.box = "wplib/wplib"
94+
config.vm.box_version = box_version
95+
96+
config.vm.hostname = hostname
97+
98+
config.hostsupdater.aliases = @project['aliases']
99+
config.hostsupdater.aliases.map! do |_alias|
100+
_alias.sub! '{hostname}', hostname
101+
end
102+
103+
config.vm.provider :vmware_fusion do |vmware|
104+
vmware.vmx["ethernet0.pcislotnumber"] = "33"
105+
end
106+
107+
File.write('IP', "10.10.10.#{rand(10..250)}") if not File.exists?('IP')
108+
config.vm.network 'private_network', ip: IO.read('IP').strip
109+
110+
if Gem::Version.new(box_version) >= Gem::Version.new("0.17.0")
111+
# 0.17.0 and onwards.
112+
config.vm.synced_folder ".", "/vagrant", disabled: true
113+
config.vm.synced_folder ".", "/projects/wplib.box"
114+
config.ssh.username = "boxuser"
115+
else
116+
#pre-0.17.0.
117+
config.vm.synced_folder "www", "/var/www"
118+
config.ssh.username = "vagrant"
119+
end
120+
121+
config.ssh.forward_agent = true
122+
config.ssh.insert_key = false
123+
124+
config.trigger.after [:up, :reload] do |trigger|
125+
trigger.run_remote = {inline: "box first-time-provision --short"}
126+
end
127+
128+
config.trigger.after [:up, :reload] do |trigger|
129+
trigger.run_remote = {inline: "box startup --short"}
130+
end
131+
132+
config.trigger.before :halt do |trigger|
133+
trigger.run_remote = {inline: "box database backup"}
134+
end
135+
end
136+
137+
138+
end
139+

CHANGELOG.md

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,28 @@
11
# WPLib Box ChangeLog
22

3+
## 0.17.1
4+
=========
5+
+ Greatly simplified Vagrantfile while expanding capabilities.
6+
+ Expanded `project.json` to include `hostname` and `localdev.version`.
7+
+ `services` in `project.json` renamed to `stack`
8+
+ User experience improved and small fixes for `box self-update`
9+
+ Fixed several broken aspects of WP CLI
10+
+ Fixed several broken aspects of Composer
11+
+ Fixed WP CLI so it no longer requires being included in `stack` to run.
12+
+ Elinated the creation of `/provision` directory in root of
13+
+ Added `$_ENV['CLI_HOST']` to contain `wplib.box` when running WP CLI.
14+
+ Added `$_ENV['DB_HOST']` to contain `wplib.box` when running WP CLI.
15+
+ Fixed `mkdocs` to be run without arguments to allow for help text.
16+
+ Fixed Nginx and Apache to load `index.html` as default document.
17+
+ `box startup` no longer has side-effect of backuping database.
18+
+ Created `--short` version of `box status`, `box version`, etc.
19+
+ Fixed bug in component install script.
20+
+ Upgraded Docker to `18.06.0-ce`
21+
22+
323
## 0.17.0
4-
=======
5-
+ Prebuilt PHP component containers for 5.2.4, 5.6.36, 7.0.30, 7.1.18 & 7.2.6. (5.3.29, 5.4.45 & 5.5.38 to follow in 0.17.1).
24+
=========
25+
+ Prebuilt PHP component containers for 5.2.4, 5.6.36, 7.0.30, 7.1.18 & 7.2.6. (5.3.29, 5.4.45 & 5.5.38 to follow soon.)
626
+ New project.json layout.
727
+ Merging of official project.json release file with user project.json file.
828
+ New sub-command `box component` with simpler command set.

HOSTNAME

Lines changed: 0 additions & 1 deletion
This file was deleted.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
![Latest Stable Version](https://img.shields.io/badge/stable-0.17.0-blue.svg)
2-
![Latest Testing Version](https://img.shields.io/badge/testing-0.17.1-red.svg)
1+
![Latest Stable Version](https://img.shields.io/badge/stable-0.17.1-blue.svg)
2+
![Latest Testing Version](https://img.shields.io/badge/testing-0.17.2-red.svg)
33
![License](https://poser.pugx.org/wplib/wplib-box/license)
44

55
# ![WPLib-Box](https://github.com/wplib/wplib.github.io/raw/master/WPLib-Box-100x.png)

VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.17.1

0 commit comments

Comments
 (0)