From 14add30e8559fecc238676e5ec5e6ce9b2e62755 Mon Sep 17 00:00:00 2001 From: Dylan William Hardison Date: Wed, 23 Jan 2019 14:25:50 -0500 Subject: [PATCH] make it easier to run the dev server --- Vagrantfile | 21 ++++++++++++++++++++- vagrant_support/bashrc | 1 + vagrant_support/devtools.yml | 3 +++ vagrant_support/hypnotoad.yml | 8 ++++---- vagrant_support/start_morbo | 10 ++++++++++ 5 files changed, 38 insertions(+), 5 deletions(-) create mode 100644 vagrant_support/start_morbo diff --git a/Vagrantfile b/Vagrantfile index f63c707a0..863371276 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -17,7 +17,6 @@ VENDOR_BUNDLE_URL = ENV.fetch "BMO_BUNDLE_URL", RSYNC_ARGS = [ '--verbose', '--archive', - '--delete', '-z', '--copy-links', '--exclude=local/', @@ -28,6 +27,26 @@ RSYNC_ARGS = [ '--include=.git/' ] +# This is a little weird, but we need to update +require 'json' + +Dir.glob(".vagrant/machines/*/*/synced_folders").each do |filename| + synced_folders = JSON.parse(IO.read(filename)) + synced_folder = synced_folders["rsync"]["/vagrant"] + dirty = false + %w( rsync__args args ).each do |key| + if RSYNC_ARGS != synced_folder[key] + dirty = true + synced_folder[key] = RSYNC_ARGS + end + if dirty + say "Updating #{filename} because it has old rsync args" + IO.write(filename + ".new", JSON.unparse(synced_folders)) + end + end +end + + # All Vagrant configuration is done below. The '2' in Vagrant.configure # configures the configuration version (we support older styles for # backwards compatibility). Please don't change it unless you know what diff --git a/vagrant_support/bashrc b/vagrant_support/bashrc index d4dba9f40..72290966a 100644 --- a/vagrant_support/bashrc +++ b/vagrant_support/bashrc @@ -10,5 +10,6 @@ PS1='\[\e[0;31m\]\u\[\e[m\] \[\e[1;34m\]\w\[\e[m\] $ ' export PERL5LIB=/vagrant/local/lib/perl5 export PATH=/vagrant/local/bin:$PATH +export MOJO_LISTEN="http://*:80" cd /vagrant diff --git a/vagrant_support/devtools.yml b/vagrant_support/devtools.yml index 3d4c9dbcd..e44a00dd7 100644 --- a/vagrant_support/devtools.yml +++ b/vagrant_support/devtools.yml @@ -18,6 +18,9 @@ - name: copy re.pl copy: src=re.pl dest=/usr/local/bin/re.pl mode=0755 +- name: copy start_morbo + copy: src=start_morbo dest=/usr/local/bin/start_morbo mode=0755 + - name: copy use-nytprof copy: src=use-nytprof dest=/usr/local/bin/use-nytprof mode=0755 diff --git a/vagrant_support/hypnotoad.yml b/vagrant_support/hypnotoad.yml index a66f9ba04..ebfd27737 100644 --- a/vagrant_support/hypnotoad.yml +++ b/vagrant_support/hypnotoad.yml @@ -18,10 +18,10 @@ group: root mode: 0755 -- name: enable hypnotoad - service: name=hypnotoad enabled=yes +- name: disable hypnotoad + service: name=hypnotoad enabled=no when: LAZY == 0 -- name: restart hypnotoad - service: name=hypnotoad state=restarted +- name: stop hypnotoad + service: name=hypnotoad state=stopped diff --git a/vagrant_support/start_morbo b/vagrant_support/start_morbo new file mode 100644 index 000000000..926655b2e --- /dev/null +++ b/vagrant_support/start_morbo @@ -0,0 +1,10 @@ +#!/usr/bin/env perl + +$ENV{PERL5LIB} = '/vagrant/local/lib/perl5'; +$ENV{PATH} = "/vagrant/local/bin:$ENV{PATH}"; +$ENV{MOJO_LISTEN} = 'http://*:80'; + +my @files = ('Bugzilla.pm', 'Bugzilla', glob("*.cgi"), 'extensions', 'template'); +my @watch= map { ('-w' => $_) } (@files); + +system morbo => @watch, '-v', 'bugzilla.pl'; -- 2.47.3