#!/bin/sh

rm -rf fluentd
mkdir fluentd
cd fluentd
(   echo 'source "http://rubygems.org"'
    echo 'gem "fluentd"'
) >Gemfile
HOME=`pwd` bundle package --gemfile Gemfile --no-install --path tmp --cache-path gems
version=`ls -1 tmp/gems/fluentd-*.gem | sed -e 's;.*fluentd-;;' -e 's;\.gem$;;'`
mv tmp/gems fluentd-$version
tar cvf - fluentd-$version | xz -9 >../fluentd-$version.tar.xz
cd ..
rm -rf fluentd

