diff options
author | Matthew Somerville <matthew@mysociety.org> | 2014-11-05 15:07:54 +0000 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2014-11-05 15:33:27 +0000 |
commit | 92fc64655c5b51ddec3286befd87d9693ca718c2 (patch) | |
tree | 2904171f3c8940659305f8e627e36ef3558c9d12 /bin | |
parent | cdf0d0f5129bd03a2f7990bee6c176cb77fabd3d (diff) |
Update to use bundler and work on Ubuntu Trusty.
Switching to bundler saves confusion about gem paths when running
sass/compass to compile the CSS.
Trusty can use precisely the same packages as precise, with a few tweaks
to generalise the contents.
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/install-as-user | 21 | ||||
-rwxr-xr-x | bin/make_css | 14 | ||||
-rwxr-xr-x | bin/make_css_watch | 14 |
3 files changed, 31 insertions, 18 deletions
diff --git a/bin/install-as-user b/bin/install-as-user index bd48bdebb..ebff69ed2 100755 --- a/bin/install-as-user +++ b/bin/install-as-user @@ -71,25 +71,22 @@ if [ ! "$DEVELOPMENT_INSTALL" = true ]; then fi # Install the compass gem locally - it's required for generating the -# CSS: +# CSS. Don't trust the bundled bundler in e.g. precise. echo "Setting up CSS... " -export GEM_HOME="$DIRECTORY/gems" -mkdir -p "$GEM_HOME" -export GEM_PATH= -export PATH="$GEM_HOME/bin:$PATH" +gem1.9.1 install --user-install --no-ri --no-rdoc bundler +FMS_GEMPATH="$DIRECTORY/gem-bin" +FMS_GEMPATH="$FMS_GEMPATH:$(ruby1.9.1 -rubygems -e 'puts Gem.user_dir')/bin" +export PATH="$FMS_GEMPATH:$PATH" -if ! grep -q 'Set up local gem directory for FixMyStreet' $HOME/.bashrc; then +if ! grep -q 'Set up local PATH for FixMyStreet' $HOME/.bashrc; then cat >>$HOME/.bashrc <<EOBRC -# Set up local gem directory for FixMyStreet -export GEM_HOME="$DIRECTORY/gems" -export GEM_PATH= -export PATH="\$GEM_HOME/bin:\$PATH" +# Set up local PATH for FixMyStreet +export PATH="$FMS_GEMPATH:\$PATH" EOBRC fi -gem install --no-ri --no-rdoc sass -v 3.2.14 -gem install --no-ri --no-rdoc compass -v 0.12.2 +bundle install --deployment --path "$DIRECTORY/gems" --binstubs "$DIRECTORY/gem-bin" # Use compass to generate the CSS, if it doesn't seem to already # exist: diff --git a/bin/make_css b/bin/make_css index 4465f1f9b..a8afafb27 100755 --- a/bin/make_css +++ b/bin/make_css @@ -8,8 +8,14 @@ # # Copyright (c) 2012 UK Citizens Online Democracy. All rights reserved. # Email: matthew@mysociety.org. WWW: http://www.mysociety.org -# -# $Id: send-reports,v 1.79 2010-01-06 16:50:26 louise Exp $ + +COMPASS=compass +SASS=sass +PARENT=$(cd `dirname $0`/../.. && pwd) +if [ -f "$PARENT/gem-bin/compass" ]; then + COMPASS=$PARENT/gem-bin/compass + SASS=$PARENT/gem-bin/sass +fi DIRECTORY=$(cd `dirname $0`/../web && pwd) @@ -17,8 +23,8 @@ DIRS=${@:-`find $DIRECTORY -name "*.scss" -exec dirname {} \; | uniq`} for dir in $DIRS; do if [ -e "$dir/config.rb" ]; then - compass compile --output-style compressed $dir + $COMPASS compile --output-style compressed $dir else - sass --scss --update --style compressed $dir + $SASS --scss --update --style compressed $dir fi done diff --git a/bin/make_css_watch b/bin/make_css_watch index d46ee8997..63a27a35e 100755 --- a/bin/make_css_watch +++ b/bin/make_css_watch @@ -2,8 +2,10 @@ use strict; use warnings; use feature 'say'; +use Cwd qw(abs_path); use File::ChangeNotify; use File::Find::Rule; +use FindBin; use Path::Tiny; my @exts = qw/ @@ -24,6 +26,14 @@ my $watcher = File::ChangeNotify->instantiate_watcher( filter => $filter, ); +my $script_compass = 'compass'; +my $script_sass = 'sass'; +my $gem_bin = abs_path("$FindBin::Bin/../../gem-bin"); +if (-f "$gem_bin/compass") { + $script_compass = "$gem_bin/compass"; + $script_sass = "$gem_bin/sass"; +} + sub title { my $what = shift; # TODO, check if xtitle is installed and if so, run following command: @@ -61,13 +71,13 @@ while ( my @events = $watcher->wait_for_events() ) { } for my $dir (@update_dirs) { if (-e "$dir/config.rb") { - system compass => + system $script_compass, 'compile', '--output-style' => 'compressed', $dir; } else { - system sass => + system $script_sass, '--scss', '--update', '--style' => 'compressed', |