From 2067c1bd0fecf40a2cadb90bf02df525ce6d2fbc Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Fri, 30 Aug 2013 13:02:38 +0100 Subject: Allow a version override for the install script. So you can more easily set up a development environment on a clean server, checking out master. --- bin/site-specific-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bin') diff --git a/bin/site-specific-install.sh b/bin/site-specific-install.sh index 7b841dd64..e43da65b1 100644 --- a/bin/site-specific-install.sh +++ b/bin/site-specific-install.sh @@ -1,7 +1,7 @@ #!/bin/sh # Set this to the version we want to check out -VERSION=v1.2.2 +VERSION=${VERSION_OVERRIDE:-v1.2.2} PARENT_SCRIPT_URL=https://github.com/mysociety/commonlib/blob/master/bin/install-site.sh -- cgit v1.2.3 From 510969a35f871b69135404316036995db2da6626 Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Fri, 30 Aug 2013 18:26:41 +0100 Subject: Better make_css, doesn't die if grep too long. --- bin/make_css | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) (limited to 'bin') diff --git a/bin/make_css b/bin/make_css index 80fcb462f..c48dda4d6 100755 --- a/bin/make_css +++ b/bin/make_css @@ -13,20 +13,12 @@ DIRECTORY=$(cd `dirname $0`/../web && pwd) -# FixMyStreet uses compass -NEWSTYLE=${1:-`find $DIRECTORY -name "config.rb" -exec dirname {} \;`} -NEWSTYLE_REGEX=$(sed 's/ /\\|/g' <<< $NEWSTYLE) -for site in $NEWSTYLE; do - compass compile --output-style compressed $site -done - -# If given a command line argument, assume was a compass directory and exit -if [ -n "$1" ]; then - exit 0 -fi +DIRS=${1:-`find $DIRECTORY -name "*.scss" -exec dirname {} \; | uniq`} -# The rest are plain sass -for scss in `find $DIRECTORY -name "*.scss" -exec dirname {} \; | uniq | grep -v "\($NEWSTYLE_REGEX\)"` -do - sass --scss --update --style compressed $scss +for dir in $DIRS; do + if [ -e "$dir/config.rb" ]; then + compass compile --output-style compressed $dir + else + sass --scss --update --style compressed $dir + fi done -- cgit v1.2.3 From d1151ce347010f73f60b857f0254fe8a311ed92e Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Tue, 3 Sep 2013 11:10:54 +0100 Subject: Version 1.2.3. --- bin/site-specific-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bin') diff --git a/bin/site-specific-install.sh b/bin/site-specific-install.sh index e43da65b1..d5d10d308 100644 --- a/bin/site-specific-install.sh +++ b/bin/site-specific-install.sh @@ -1,7 +1,7 @@ #!/bin/sh # Set this to the version we want to check out -VERSION=${VERSION_OVERRIDE:-v1.2.2} +VERSION=${VERSION_OVERRIDE:-v1.2.3} PARENT_SCRIPT_URL=https://github.com/mysociety/commonlib/blob/master/bin/install-site.sh -- cgit v1.2.3 From 991ed7a90e3fbfdab04f06f699bf7587ad858834 Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Thu, 5 Sep 2013 18:17:28 +0100 Subject: Version 1.2.4. --- bin/site-specific-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bin') diff --git a/bin/site-specific-install.sh b/bin/site-specific-install.sh index d5d10d308..d3da12104 100644 --- a/bin/site-specific-install.sh +++ b/bin/site-specific-install.sh @@ -1,7 +1,7 @@ #!/bin/sh # Set this to the version we want to check out -VERSION=${VERSION_OVERRIDE:-v1.2.3} +VERSION=${VERSION_OVERRIDE:-v1.2.4} PARENT_SCRIPT_URL=https://github.com/mysociety/commonlib/blob/master/bin/install-site.sh -- cgit v1.2.3 From 72f991818fa1a7a027fbfc3de04185b38d2aee14 Mon Sep 17 00:00:00 2001 From: Edmund von der Burg Date: Tue, 10 Sep 2013 11:19:56 +0100 Subject: [Zurich] add migration script to convert internal_notes in extra field into comments --- bin/zurich/convert_internal_notes_to_comments | 74 +++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100755 bin/zurich/convert_internal_notes_to_comments (limited to 'bin') diff --git a/bin/zurich/convert_internal_notes_to_comments b/bin/zurich/convert_internal_notes_to_comments new file mode 100755 index 000000000..e92be40b3 --- /dev/null +++ b/bin/zurich/convert_internal_notes_to_comments @@ -0,0 +1,74 @@ +#!/usr/bin/env perl + +=head1 DESCRIPTION + +This is a Zurich specific migration script. + +It converts the internal notes that used to be stored on the problem in the +extra hash into comments instead. + + ./bin/zurich/convert_internal_notes_to_comments user_id + +You need to select a user to have the internal notes be associated with, perhaps +the superuser, or one created just for this purpose? + +=cut + +use strict; +use warnings; + +use FixMyStreet::App; + +# Because it is not possible to determine the user that last edited the +# internal_notes we need require a user to assign all the comments to. +my $comment_user_id = $ARGV[0] + || die "Usage: $0 id_of_user_for_comments"; +my $comment_user = FixMyStreet::App # + ->model('DB::User') # + ->find($comment_user_id) + || die "Could not find user with id '$comment_user_id'"; + +# We use now as the time for the internal note. This is not the time it was +# actually created, but I don't think that can be extracted from the problem. +my $comment_timestamp = DateTime->now(); + +# The state of 'hidden' seems most appropriate for these internal_notes - as +# they should not be shown to the public. Certainly more suitable than +# 'unconfirmed' or 'confirmed'. +my $comment_state = 'hidden'; + +# Load all the comments, more reliable than trying to search on the contents of +# the extra field. +my $problems = FixMyStreet::App->model('DB::Problem')->search(); + +while ( my $problem = $problems->next() ) { + + my $problem_id = $problem->id; + + # Extract the bits we are interested in. May not exist, in which case + # skip on. + my $extra = $problem->extra || {}; + next unless exists $extra->{internal_notes}; + + # If there is something to save create a comment with the notes in them + if ( my $internal_notes = $extra->{internal_notes} ) { + print "Creating internal note comment for problem '$problem_id'\n"; + $problem->add_to_comments( + { + text => $internal_notes, + created => $comment_timestamp, + user => $comment_user, + state => $comment_state, + mark_fixed => 0, + problem_state => $problem->state, + anonymous => 1, + extra => { is_internal_note => 1 }, + } + ); + } + + # Remove the notes from extra and save back to the problem + delete $extra->{internal_notes}; + $problem->update({ extra => $extra }); +} + -- cgit v1.2.3 From 6d75192471bf910a1e36e0bd2b58e12e6d9a6768 Mon Sep 17 00:00:00 2001 From: Chris Mytton Date: Tue, 10 Sep 2013 16:41:25 +0100 Subject: [Zurich] Add schema migration 0029 to bin/update-schema --- bin/update-schema | 1 + 1 file changed, 1 insertion(+) (limited to 'bin') diff --git a/bin/update-schema b/bin/update-schema index f728f8c56..81c9ff4ab 100644 --- a/bin/update-schema +++ b/bin/update-schema @@ -84,6 +84,7 @@ print "Nothing to do\n" if $nothing; # By querying the database schema, we can see where we're currently at # (assuming schema change files are never half-applied, which should be the case) sub get_db_version { + return '0029' if column_exists('body', 'deleted'); return '0028' if table_exists('body'); return '0027' if column_exists('problem', 'subcategory'); return '0026' if column_exists('open311conf', 'send_extended_statuses'); -- cgit v1.2.3