From fc4cc722173020a489dccb875d95382e467d3e56 Mon Sep 17 00:00:00 2001 From: Ken Dreyer Date: Fri, 27 Dec 2013 12:35:22 -0700 Subject: initial package import --- .gitignore | 2 + rubygem-github-linguist-generate-test-tarball.sh | 39 ++++++++++ rubygem-github-linguist.spec | 98 ++++++++++++++++++++++++ sources | 2 + 4 files changed, 141 insertions(+) create mode 100644 .gitignore create mode 100755 rubygem-github-linguist-generate-test-tarball.sh create mode 100644 rubygem-github-linguist.spec create mode 100644 sources diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..60e66b8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/github-linguist-2.10.7.gem +/github-linguist-2.10.7-tests.tar.xz diff --git a/rubygem-github-linguist-generate-test-tarball.sh b/rubygem-github-linguist-generate-test-tarball.sh new file mode 100755 index 0000000..183b151 --- /dev/null +++ b/rubygem-github-linguist-generate-test-tarball.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +set -e + +VERSION=2.10.7 + +# GitHub has not pushed a tag for 2.10.7. +# https://github.com/github/linguist/issues/869 +GITSHA=3ece15b3984191e5b0f5656173d7cd8575a2b6c7 + +# If you are using a public tag, then comment out the GITSHA definition above. +if [ -z "$GITSHA" ]; then + # Upstream has pushed a public tag for $VERSION. + GITHUBURL=https://github.com/github/linguist/archive/v${VERSION}.zip + DIRNAME=linguist-${VERSION} +else + # We don't have a public tag, so we have to go off a SHA instead. + GITHUBURL=https://github.com/github/linguist/archive/${GITSHA}.zip + DIRNAME=linguist-${GITSHA} +fi + +# download zipball +if [[ ! -f github-linguist-$VERSION.zip ]]; then + curl -o github-linguist-$VERSION.zip -L $GITHUBURL +fi + +# extract zipball +[ -d $DIRNAME ] && rm -r $DIRNAME +unzip github-linguist-$VERSION.zip + +pushd $DIRNAME + # repack + tar -cJvf github-linguist-$VERSION-tests.tar.xz test samples + mv github-linguist-$VERSION-tests.tar.xz .. +popd + +# Clean up +rm github-linguist-$VERSION.zip +rm -r $DIRNAME diff --git a/rubygem-github-linguist.spec b/rubygem-github-linguist.spec new file mode 100644 index 0000000..e2c28fb --- /dev/null +++ b/rubygem-github-linguist.spec @@ -0,0 +1,98 @@ +%global gem_name github-linguist + +Name: rubygem-%{gem_name} +Version: 2.10.7 +Release: 1%{?dist} +Summary: GitHub Language detection +Group: Development/Languages +License: MIT +URL: https://github.com/github/linguist +Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem +# Upstream does not ship the test suite in the gem. +Source1: %{name}-generate-test-tarball.sh +Source2: %{gem_name}-%{version}-tests.tar.xz +Requires: ruby(release) +Requires: ruby(rubygems) +Requires: rubygem(charlock_holmes) => 0.6.6 +Requires: rubygem(charlock_holmes) < 0.7 +Requires: rubygem(escape_utils) >= 0.3.1 +Requires: rubygem(mime-types) => 1.19 +Requires: rubygem(mime-types) < 2 +Requires: rubygem(pygments.rb) => 0.5.4 +Requires: rubygem(pygments.rb) < 0.6 +BuildRequires: ruby(release) +BuildRequires: rubygems-devel +BuildRequires: rubygem(minitest) +BuildRequires: rubygem(mocha) +BuildRequires: rubygem(charlock_holmes) => 0.6.6 +BuildRequires: rubygem(charlock_holmes) < 0.7 +BuildRequires: rubygem(escape_utils) >= 0.3.1 +BuildRequires: rubygem(mime-types) => 1.19 +BuildRequires: rubygem(mime-types) < 2 +BuildRequires: rubygem(pygments.rb) => 0.5.4 +BuildRequires: rubygem(pygments.rb) < 0.6 +BuildArch: noarch +Provides: rubygem(%{gem_name}) = %{version} + +%description +Use this library to detect blob languages, highlight code, ignore binary +files, suppress generated files in diffs, and generate language breakdown +graphs. + +%package doc +Summary: Documentation for %{name} +Group: Documentation +Requires: %{name} = %{version}-%{release} +BuildArch: noarch + +%description doc +Documentation for %{name} + +%prep +gem unpack %{SOURCE0} + +%setup -q -D -T -n %{gem_name}-%{version} -a 2 + +gem spec %{SOURCE0} -l --ruby > %{gem_name}.gemspec + +%build +# Create the gem as gem install only works on a gem file +gem build %{gem_name}.gemspec + +%gem_install + +%install +mkdir -p %{buildroot}%{gem_dir} +cp -pa .%{gem_dir}/* \ + %{buildroot}%{gem_dir}/ + +mkdir -p %{buildroot}%{_bindir} +cp -pa .%{_bindir}/* \ + %{buildroot}%{_bindir}/ + +find %{buildroot}%{gem_instdir}/bin -type f | xargs chmod a+x + +%check +export LANG=en_US.UTF-8 +cp -pr test .%{gem_instdir} +cp -pr samples .%{gem_instdir} +pushd .%{gem_instdir} + ruby -Ilib test/test_*.rb + rm -rf test samples +popd + + +%files +%dir %{gem_instdir} +%{_bindir}/linguist +%{gem_instdir}/bin +%{gem_libdir} +%exclude %{gem_cache} +%{gem_spec} + +%files doc +%doc %{gem_docdir} + +%changelog +* Fri Dec 27 2013 Ken Dreyer - 2.10.7-1 +- Initial package diff --git a/sources b/sources new file mode 100644 index 0000000..7505c4b --- /dev/null +++ b/sources @@ -0,0 +1,2 @@ +78ad92c0d2bc3fff45b71f1392a39c0b github-linguist-2.10.7.gem +51348140bc427edb56adf19777c67991 github-linguist-2.10.7-tests.tar.xz -- cgit