aboutsummaryrefslogtreecommitdiffstats
path: root/testing
diff options
context:
space:
mode:
authorJakub Jirutka <jakub@jirutka.cz>2017-03-25 21:49:17 +0100
committerJakub Jirutka <jakub@jirutka.cz>2017-03-25 21:57:04 +0100
commit869f90445e4ed0509bc19994c1a4900901160855 (patch)
treedbb19a769371a2a5e010903c614175239b149e8c /testing
parente7d5b42322707ed0978875a84c17f0e89a97acff (diff)
downloadaports-869f90445e4ed0509bc19994c1a4900901160855.tar.bz2
aports-869f90445e4ed0509bc19994c1a4900901160855.tar.xz
testing/ruby-pygments: new aport
https://github.com/tmm1/pygments.rb Pygments syntax highlighting in Ruby This gem depends on Python, often causes troubles to install and includes ~5 MiB of bundled dependencies, so let's make an aport for it. It's commonly used with asciidoctor.
Diffstat (limited to 'testing')
-rw-r--r--testing/ruby-pygments/APKBUILD52
-rw-r--r--testing/ruby-pygments/use-system-pygments-only.patch29
2 files changed, 81 insertions, 0 deletions
diff --git a/testing/ruby-pygments/APKBUILD b/testing/ruby-pygments/APKBUILD
new file mode 100644
index 0000000000..aa328e775c
--- /dev/null
+++ b/testing/ruby-pygments/APKBUILD
@@ -0,0 +1,52 @@
+# Contributor: Jakub Jirutka <jakub@jirutka.cz>
+# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
+pkgname=ruby-pygments
+_gemname=pygments.rb
+pkgver=1.1.1
+pkgrel=0
+pkgdesc="Pygments syntax highlighting in Ruby"
+url="https://github.com/tmm1/pygments.rb"
+arch="noarch"
+license="MIT"
+depends="python2 py2-pygments ruby ruby-json ruby-multi_json"
+checkdepends="ruby-bundler ruby-rake ruby-test-unit"
+source="$pkgname-$pkgver.tar.gz::https://github.com/tmm1/$_gemname/archive/v$pkgver.tar.gz
+ use-system-pygments-only.patch"
+builddir="$srcdir/$_gemname-$pkgver"
+
+prepare() {
+ default_prepare
+
+ cd "$builddir"
+
+ # Specify files to be installed.
+ sed -i 's|`git ls-files.*|Dir["lib/**/*", "lexers"]|' $_gemname.gemspec
+
+ # Remove bundled dependencies.
+ rm -r vendor
+}
+
+build() {
+ cd "$builddir"
+ gem build $_gemname.gemspec
+}
+
+check() {
+ cd "$builddir"
+ rake test
+}
+
+package() {
+ local gemdir="$pkgdir/$(ruby -rubygems -e 'puts Gem.default_dir')"
+
+ cd "$builddir"
+ gem install --local \
+ --install-dir "$gemdir" \
+ --ignore-dependencies \
+ --no-document \
+ --verbose \
+ $_gemname-$pkgver.gem
+}
+
+sha512sums="a3b687c0de3206e0d7220bbe3345f7e2abeb7bc03625f044f6bf0e75d45a8e6743ab91e14b950faa5ad80ca1514c764a6b919e592bd626d7002e435cc489ca5b ruby-pygments-1.1.1.tar.gz
+a8e5d64d8209dacb5090378e8507095359b38ef55ac6896f5bd95fa9676691beb278d6d19eb47cbc51fac843b326b8e21fbf1dd9ed39e123ed0943293b0a82ca use-system-pygments-only.patch"
diff --git a/testing/ruby-pygments/use-system-pygments-only.patch b/testing/ruby-pygments/use-system-pygments-only.patch
new file mode 100644
index 0000000000..6b4be89820
--- /dev/null
+++ b/testing/ruby-pygments/use-system-pygments-only.patch
@@ -0,0 +1,29 @@
+Use only system-provided pygments and json module.
+
+--- a/lib/pygments/mentos.py
++++ b/lib/pygments/mentos.py
+@@ -6,13 +6,6 @@
+ if 'PYGMENTS_PATH' in os.environ:
+ sys.path.insert(0, os.environ['PYGMENTS_PATH'])
+
+-dirname = os.path.dirname
+-
+-base_dir = dirname(dirname(dirname(os.path.abspath(__file__))))
+-sys.path.append(base_dir + "/vendor")
+-sys.path.append(base_dir + "/vendor/pygments-main")
+-sys.path.append(base_dir + "/vendor/simplejson")
+-
+ import pygments
+ from pygments import lexers, formatters, styles, filters
+
+--- a/lib/pygments/popen.rb
++++ b/lib/pygments/popen.rb
+@@ -24,7 +24,7 @@
+ # Get things started by opening a pipe to mentos (the freshmaker), a
+ # Python process that talks to the Pygments library. We'll talk back and
+ # forth across this pipe.
+- def start(pygments_path = File.expand_path('../../../vendor/pygments-main/', __FILE__))
++ def start(pygments_path = '/usr/bin/pygmentize-2')
+ begin
+ @log = Logger.new(ENV['MENTOS_LOG'] ||= File::NULL)
+ @log.level = Logger::INFO