Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate list of hosted development sites after vagrant up #1521

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Vagrant.configure('2') do |config|
config.vm.box = box
config.vm.box_version = vconfig.fetch('vagrant_box_version')
config.ssh.forward_agent = true
config.vm.post_up_message = post_up_message
config.vm.post_up_message = post_up_message(trellis_config)

# Fix for: "stdin: is not a tty"
# https://github.com/mitchellh/vagrant/issues/1673#issuecomment-28288042
Expand Down
17 changes: 16 additions & 1 deletion lib/trellis/vagrant.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,29 @@ def mount_options(mount_type, dmode:, fmode:)
end
end

def post_up_message
def post_up_message(trellis_config)
msg = 'Your Trellis Vagrant box is ready to use!'
msg << "\n* Composer and WP-CLI commands need to be run on the virtual machine"
msg << "\n for any post-provision modifications."
msg << "\n* You can SSH into the machine with `vagrant ssh`."
msg << "\n* Then navigate to your WordPress sites at `/srv/www`"
msg << "\n or to your Trellis files at `#{ANSIBLE_PATH_ON_VM}`."

if trellis_config.wordpress_sites.any?
msg << "\n\n\e[35m🚀 Development URLs: \e[0m"
trellis_config.wordpress_sites.each do |site_name, site|
site_url = site['site_hosts'].first
site_url = site_url.is_a?(Hash) ? site_url['canonical'] : site_url
site_url = site['ssl']['enabled'] ? "https://#{site_url}" : "http://#{site_url}"
MWDelaney marked this conversation as resolved.
Show resolved Hide resolved
msg << "\n
🌱 \e[37mName:\e[33m #{site_name}\e[0m
├── 🔗 \e[37mURL:\e[33m #{site_url}\e[0m
├── 🛠️ \e[37mAdmin:\e[33m #{site_url}/wp-admin\e[0m
└── 📩 \e[37mMailpit:\e[33m #{site_url}:8025\e[0m
"
end
end

msg
end

Expand Down
Loading