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 | |
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.
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | Gemfile | 3 | ||||
-rw-r--r-- | Gemfile.lock | 16 | ||||
-rwxr-xr-x | bin/install-as-user | 21 | ||||
-rwxr-xr-x | bin/make_css | 14 | ||||
-rwxr-xr-x | bin/make_css_watch | 14 | ||||
-rw-r--r-- | conf/packages.debian-squeeze | 4 | ||||
-rw-r--r-- | conf/packages.debian-wheezy | 4 | ||||
-rw-r--r-- | conf/packages.ubuntu-precise | 6 |
9 files changed, 58 insertions, 25 deletions
diff --git a/.gitignore b/.gitignore index 577167f34..72bc29420 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ ._* .vagrant +.bundle .DS_Store .carton local-lib5 diff --git a/Gemfile b/Gemfile new file mode 100644 index 000000000..eca052933 --- /dev/null +++ b/Gemfile @@ -0,0 +1,3 @@ +source "https://rubygems.org" + +gem "compass", "0.12.7" diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 000000000..c86a5ca9a --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,16 @@ +GEM + remote: https://rubygems.org/ + specs: + chunky_png (1.3.3) + compass (0.12.7) + chunky_png (~> 1.2) + fssm (>= 0.2.7) + sass (~> 3.2.19) + fssm (0.2.10) + sass (3.2.19) + +PLATFORMS + ruby + +DEPENDENCIES + compass (= 0.12.7) 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', diff --git a/conf/packages.debian-squeeze b/conf/packages.debian-squeeze index 4f7887484..21e5d0485 100644 --- a/conf/packages.debian-squeeze +++ b/conf/packages.debian-squeeze @@ -8,8 +8,8 @@ perl perlmagick libmath-bigint-gmp-perl gettext -libhaml-ruby -postgresql-8.4 +ruby1.9.1 +postgresql postgresql-server-dev-8.4 gnuplot ttf-bitstream-vera diff --git a/conf/packages.debian-wheezy b/conf/packages.debian-wheezy index d925dfcad..546cdf72f 100644 --- a/conf/packages.debian-wheezy +++ b/conf/packages.debian-wheezy @@ -8,9 +8,9 @@ perl perlmagick libmath-bigint-gmp-perl gettext -ruby-compass +ruby1.9.1 postgresql -postgresql-server-dev-9.1 +postgresql-server-dev-all gnuplot ttf-bitstream-vera libexpat1-dev diff --git a/conf/packages.ubuntu-precise b/conf/packages.ubuntu-precise index fc8a7d511..546cdf72f 100644 --- a/conf/packages.ubuntu-precise +++ b/conf/packages.ubuntu-precise @@ -8,9 +8,9 @@ perl perlmagick libmath-bigint-gmp-perl gettext -libhaml-ruby -postgresql-9.1 -postgresql-server-dev-9.1 +ruby1.9.1 +postgresql +postgresql-server-dev-all gnuplot ttf-bitstream-vera libexpat1-dev |