Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added install for rubber rules

  • Loading branch information...
commit de6d3996ecf210b5a206b408629c8060b4a989cc 1 parent 3e0369c
@fikovnik authored
Showing with 46 additions and 127 deletions.
  1. +0 −127 rules.ini
  2. +46 −0 setup-rubber.sh
View
127 rules.ini
@@ -1,127 +0,0 @@
-; This is the rule file for Rubber.
-;
-; Each rule is introduced by an identifier in square brackets and contains
-; entries of the form "key = value". See the texinfo documentation for a
-; precise description of the entries.
-
-;-- XFig figures
-
-[fig2dev-vec]
-target = (.*)\.(eps|pdf)
-source = \1.fig
-cost = 0
-rule = fig2dev
-
-[fig2dev-bmp]
-target = (.*)\.png
-source = \1.fig
-cost = 10
-rule = fig2dev
-
-[fig2dev-tex]
-target = (.*)\.(eps|pstex|pdf|pdftex)_t
-source = \1.fig
-cost = 0
-rule = fig2dev
-
-;-- Metapost figures
-
-[mpost]
-target = (.*)\.[0-9]+
-source = \1.mp
-cost = 0
-rule = mpost
-
-;-- Rules using "convert" (from ImageMagick)
-
-[convert-vec-vec]
-target = (.*)\.(ps|eps|pdf|epdf)
-source = \1.{ps,eps,pdf,epdf,wmf}
-cost = 2
-rule = shell
-command = convert $source $target
-message = converting $source into $target
-
-[convert-bmp-vec]
-target = (.*)\.(ps|eps|pdf|epdf)
-source = \1.{bmp,gif,jbg,jbig,pct,pcx,pgm,pict,png,pnm,ppm,tga,tif,tiff,xbm,xcf,xpm}
-cost = 8
-rule = shell
-command = convert $source $target
-message = converting $source into $target
-
-[convert-lossy-vec]
-target = (.*)\.(ps|eps|pdf|epdf)
-source = \1.{jpeg,jpg}
-cost = 11
-rule = shell
-command = convert $source $target
-message = converting $source into $target
-
-[convert-bmp-bmp]
-target = (.*).(gif|png|tif|bmp|tga|pcx)
-source = \1.{bmp,gif,jbg,jbig,pct,pcx,pgm,pict,png,pnm,ppm,tga,tif,tiff,xbm,xcf,xpm}
-cost = 2
-rule = shell
-command = convert $source $target
-message = converting $source into $target
-
-; more rules ?
-
-;-- Bounding box extraction from gzipped EPS (built-in rule)
-
-[eps_gz]
-target = (.*\.e?ps).bb
-source = \1.gz
-cost = 0
-rule = eps_gz
-
-;-- Miscellaneous graphics converters
-
-[epstopdf]
-target = (.*)\.pdf
-source = \1.eps
-cost = 1
-rule = shell
-command = epstopdf --outfile=$target $source
-message = converting $source to PDF
-
-[jpeg2ps]
-target = (.*)\.eps
-source = \1.{jpeg,jpg}
-cost = 10
-rule = shell
-command = jpeg2ps -o $target $source
-message = converting $source to EPS
-
-[sam2p]
-target = (.*)\.(ps|eps|pdf)
-source = \1.{bmp,gif,jpeg,jpg,lbm,pbm,pcx,pdf,pgm,png,pnm,ppm,ps,tga,tif,tiff,xpm}
-cost = 7
-rule = shell
-command = sam2p $source $target
-message = converting $source into $target
-
-[dia]
-target = (.*)\.eps
-source = \1.dia
-cost = 1
-rule = shell
-command = dia --export $target $source
-message = converting $source to EPS
-
-;-- Source conversion with lhs2TeX
-
-[lhs2TeX]
-target = (.*)\.tex
-source = \1.lhs
-cost = 0
-rule = lhs2TeX
-
-[convert-omnigraffle]
-target = (.*):(.*)\.(eps|pdf)
-source = \1.graffle
-cost = 0
-rule = shell
-command = /Users/krikava/Documents/Projects/rubbery-omnigraffle/omnigraffle-rubber $target
-message = converting $source into $target
View
46 setup-rubber.sh
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+install_dir=$(dirname $(readlink -f $(which python)))
+rubber_dir=$(cat $(which rubber) | grep sys.path.append | cut -f 2 -d'"')
+
+rubber_export=$install_dir/omnigraffle-export-rubber
+rules_ini=$rubber_dir/rules.ini
+
+if [ "$(id -u)" != "0" ]; then
+ echo "You must be root in order to setup rubber rules"
+ exit 1
+fi
+
+echo "Initialization"
+
+if [ ! -f "$rubber_export" ]; then
+ echo "ERROR: unable to find $rubber_export"
+ exit 1
+fi
+echo "- omnigraffle-export: $rubber_export"
+
+if [ ! -f "$rules_ini" ]; then
+ echo "ERROR: unable to find $rules_ini"
+ exit 1
+fi
+echo "- rules.ini: $rules_ini"
+
+grep "convert-omnigraffle" $rules_ini > /dev/null
+if [ $? == 0 ]; then
+ echo "ERROR: omnigraffle rule already exists in $rules_ini"
+ exit 1
+fi
+
+echo "Modifying $rules_ini"
+cat <<EOF >> $rules_ini
+
+[convert-omnigraffle]
+target = (.*):(.*)\.(eps|pdf)
+source = \1.graffle
+cost = 0
+rule = shell
+command = $rubber_export \$target
+message = converting omigraffle \$source into \$target
+EOF
+
+echo "Done"
Please sign in to comment.
Something went wrong with that request. Please try again.