[DRE-commits] [gem2deb] 01/01: create gem2deb-test-assets-package

Praveen Arimbrathodiyil praveen at moszumanska.debian.org
Wed Sep 16 21:52:57 UTC 2015


This is an automated email from the git hooks/post-receive script.

praveen pushed a commit to branch test-assets-package
in repository gem2deb.

commit 64ebd9a980462d380b190524ded08075d4d8bde6
Author: Praveen Arimbrathodiyil <praveen at debian.org>
Date:   Thu Sep 17 03:22:23 2015 +0530

    create gem2deb-test-assets-package
---
 bin/gem2deb-test-assets-package | 56 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 56 insertions(+)

diff --git a/bin/gem2deb-test-assets-package b/bin/gem2deb-test-assets-package
new file mode 100755
index 0000000..741726b
--- /dev/null
+++ b/bin/gem2deb-test-assets-package
@@ -0,0 +1,56 @@
+#!/bin/sh
+
+if test -z $1
+then
+  echo "Usage: gem2deb-test-assets-package <gem name> [<asset name>]"
+  exit 1
+fi
+
+exec 2>&1
+set -ex
+
+gem_name=$1
+
+# Extract asset name from gem name
+if echo ${gem_name} | grep "^rails-assets-"
+then
+  asset_name=`echo ${gem_name} | cut -d'-' -f3-`
+elif echo ${gem_name} | grep "\-rails\$"
+then
+  asset_name=`echo ${gem_name} | rev| cut -d'-' -f2-|rev`
+elif ! test -z $2
+then
+  asset_name=$2
+else
+  echo "You should provide asset name as second argument if gem name"
+  echo "does not start with rails-assets or ends with rails"
+  exit 1
+fi
+
+if test -z $ADTTMP
+then
+  tmpdir=`mktemp -d`
+else
+  tmpdir=$ADTTMP
+fi
+
+# Create a sample rails application
+cd ${tmpdir}
+rails new foo
+cd foo
+
+# Use asset in application
+cat >> app/assets/javascripts/application.js <<EOF
+# =require ${asset_name}
+EOF
+
+# Add gem to Gemfile
+cat >> Gemfile <<EOF
+gem '${gem_name}'
+EOF
+
+# See if gem is found locally
+bundle install --local
+
+# Check if assets can be loaded
+bundle exec rake assets:precompile

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/gem2deb.git



More information about the Pkg-ruby-extras-commits mailing list