aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md2
-rwxr-xr-xbin/switch-site35
-rw-r--r--conf/.gitignore2
-rw-r--r--perllib/FixMyStreet/TestAppProve.pm4
4 files changed, 40 insertions, 3 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0f8e64bb8..50c937b10 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -12,6 +12,8 @@
- Stop errors from JS validator due to form in form.
- Stop update form toggle causing report submission.
- Update map size if an extra column has appeared.
+ - Development improvements:
+ - `switch-site` script to automate switching config.yml files. #1741
* v2.1.1 (3rd August 2017)
- Email improvements:
diff --git a/bin/switch-site b/bin/switch-site
new file mode 100755
index 000000000..c4ca53ca9
--- /dev/null
+++ b/bin/switch-site
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+# Symlinks a file like conf/general-foobar.yml to conf/general.yml,
+# to make switching between cobrands simpler while debugging.
+
+# Takes a single argument which should be a site name from one of
+# your config files, like "oxfordshire" from conf/general-oxforshire.yml
+
+# Run from the fixmystreet directory, like so:
+# $ bin/switch-site oxfordshire
+
+if [ -z "$1" ]
+then
+ current_target=$(readlink conf/general.yml)
+ if [ -z $current_target ]
+ then
+ echo 'Supply a config name, from the following list:'
+ else
+ echo 'Currently using settings from:'
+ echo " $current_target"
+ echo 'To change, supply a config name from the following list:'
+ fi
+ ls conf/general-*.yml | sed 's/.*general-\(.*\)\.yml/ \1/'
+ exit 1
+fi
+
+if [ -e "conf/general-$1.yml" ]
+then
+ # -f flag replaces the target file if it already exists.
+ # Remember that 1st argument is a file path relative to
+ # the file specified in the second argument.
+ ln -sf general-$1.yml conf/general.yml
+else
+ echo "File conf/general-$1.yml does not exist."
+fi
diff --git a/conf/.gitignore b/conf/.gitignore
index 86ecc7e03..25c6cc743 100644
--- a/conf/.gitignore
+++ b/conf/.gitignore
@@ -1,6 +1,6 @@
/general.yml
/general.yml.deployed
-/general.test-autogenerated*.yml
+/general-*.yml
/httpd.conf
/httpd.conf.deployed
/crontab
diff --git a/perllib/FixMyStreet/TestAppProve.pm b/perllib/FixMyStreet/TestAppProve.pm
index 806608b8b..f6e09fbe9 100644
--- a/perllib/FixMyStreet/TestAppProve.pm
+++ b/perllib/FixMyStreet/TestAppProve.pm
@@ -21,7 +21,7 @@ see bin/run-tests for usage
=cut
sub cleanup {
- unlink "conf/general.test-autogenerated.$$.yml";
+ unlink "conf/general-test-autogenerated.$$.yml";
}
sub signal_handler {
@@ -86,7 +86,7 @@ sub run {
$config->{FMS_DB_PASS} = '';
}
- my $config_out = "general.test-autogenerated.$$";
+ my $config_out = "general-test-autogenerated.$$";
path("conf/$config_out.yml")->spew( YAML::Dump($config) );
local $ENV{FMS_OVERRIDE_CONFIG} = $config_out;