diff options
Diffstat (limited to 'rubygem-closure-compiler.spec')
-rw-r--r-- | rubygem-closure-compiler.spec | 120 |
1 files changed, 64 insertions, 56 deletions
diff --git a/rubygem-closure-compiler.spec b/rubygem-closure-compiler.spec index 7783676..41cca6f 100644 --- a/rubygem-closure-compiler.spec +++ b/rubygem-closure-compiler.spec @@ -1,34 +1,26 @@ # Generated from closure-compiler-1.1.1.gem by gem2rpm -*- rpm-spec -*- -%global gemname closure-compiler +%global gem_name closure-compiler -%global gemdir %(ruby -rubygems -e 'puts Gem::dir' 2>/dev/null) -%global geminstdir %{gemdir}/gems/%{gemname}-%{version} -%global rubyabi 1.8 - -%global testdir %{_tmppath}/%{gemname}-%{version} - -Summary: Ruby Wrapper for the Google Closure Compiler -Name: rubygem-%{gemname} -Version: 1.1.1 +Name: rubygem-%{gem_name} +Version: 1.1.11 Release: 1%{?dist} +Summary: Ruby Wrapper for the Google Closure Compiler Group: Development/Languages License: ASL 2.0 URL: http://github.com/documentcloud/closure-compiler/ -Source0: http://rubygems.org/gems/%{gemname}-%{version}.gem -# git clone https://github.com/documentcloud/closure-compiler.git && cd closure-compiler && git checkout 1.1.1 -# tar czvf closure-compiler-1.1.1-tests.tgz test/ -Source1: %{gemname}-%{version}-tests.tgz -Requires: ruby(abi) = %{rubyabi} -Requires: ruby(rubygems) -Requires: ruby -# TODO: Add runtime dependency on closure-compiler java package -BuildRequires: ruby(abi) = %{rubyabi} -BuildRequires: ruby(rubygems) +Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem +# git clone https://github.com/documentcloud/closure-compiler.git && cd closure-compiler +# git checkout 1.1.11 && tar czvf closure-compiler-1.1.11-tests.tgz test/ +Source1: %{gem_name}-%{version}-tests.tgz +# Fix test compatibility with Fedoras Closure Compiler. +Patch0: rubygem-closure-compiler-1.1.11-Closure-Compiler-20141215-compatibility.patch +Requires: closure-compiler +BuildRequires: ruby(release) +BuildRequires: rubygems-devel BuildRequires: ruby -# TODO: Replace with dependency on closure-compiler java package -BuildRequires: java >= 1:1.6.0 +BuildRequires: rubygem(test-unit) +BuildRequires: closure-compiler BuildArch: noarch -Provides: rubygem(%{gemname}) = %{version} %description A Ruby Wrapper for the Google Closure Compiler. @@ -41,56 +33,72 @@ Requires: %{name} = %{version}-%{release} BuildArch: noarch %description doc -Documentation for %{name} - +Documentation for %{name}. %prep -%setup -q -c -T -mkdir -p .%{gemdir} -gem install --local --install-dir .%{gemdir} \ - --force %{SOURCE0} +gem unpack %{SOURCE0} -%build +%setup -q -D -T -n %{gem_name}-%{version} -%install -mkdir -p %{buildroot}%{gemdir} -cp -a .%{gemdir}/* \ - %{buildroot}%{gemdir}/ +gem spec %{SOURCE0} -l --ruby > %{gem_name}.gemspec -# TODO: Uncomment when closure-compiller java package is available. +# Remove bundled closure-compiler. +rm lib/*.jar +sed -i 's| "lib/closure-compiler-20140730.jar",||' %{gem_name}.gemspec -#sed -i -e "s|COMPILER_JAR = File.join(COMPILER_ROOT|COMPILER_JAR = File.join('%{_javadir}'|" \ -# %{buildroot}%{geminstdir}/lib/closure-compiler.rb +# Update the loader with proper paths. Hopefully, the disabled constants does +# not make any troubles to our users. +sed -i '/^ COMPILER_VERSION/ s/^/#/' lib/closure-compiler.rb +sed -i '/^ COMPILER_ROOT/ s/^/#/' lib/closure-compiler.rb +sed -i 's|File.join(COMPILER_ROOT, "closure-compiler-#{COMPILER_VERSION}.jar")|File.join("%{_javadir}/%{gem_name}", "closure-compiler.jar")|' lib/closure-compiler.rb + +# Use the closure-compiler wrapper script. +# https://fedoraproject.org/wiki/Packaging:Java#Wrapper_Scripts +# Unfortunately, this breaks the possibility to pick different clousure +# compiler version. Not sure how widely this feature is used. Lets see. +sed -i 's|@java, '"'"'-jar'"'"', "\\"#{@jar}\\""|"closure-compiler"|' lib/closure/compiler.rb + + +%build +gem build %{gem_name}.gemspec + +%gem_install + +%install +mkdir -p %{buildroot}%{gem_dir} +cp -a .%{gem_dir}/* \ + %{buildroot}%{gem_dir}/ -# TODO: COMPILER_JAR and COMPILER_VERSION will be necessary to change as well. %check -rm -rf %{testdir} -mkdir %{testdir} -tar xzvf %{SOURCE1} -C %{testdir} -pushd %{testdir} +pushd .%{gem_instdir} +tar xzvf %{SOURCE1} + +cat %{PATCH0} | patch -p1 -# ruby -rubygems -I%{buildroot}%{geminstdir}/lib -Itest -e "Dir.glob('test/**/*_test.rb').each {|t| require t}" -testrb -I%{buildroot}%{geminstdir}:test test/ +# The .jar was unbundled, so no need to check its permissions. +ruby -Ilib:test -e 'Dir.glob "./test/**/*_test.rb", &method(:require)' - \ + --ignore-name=/test_permissions/ popd -rm -rf %{testdir} %files -%dir %{geminstdir} -%{geminstdir}/COPYING -%{geminstdir}/LICENSE -%exclude %{geminstdir}/closure-compiler.gemspec -%exclude %{geminstdir}/lib/*.jar -%{geminstdir}/lib -%{gemdir}/cache/%{gemname}-%{version}.gem -%{gemdir}/specifications/%{gemname}-%{version}.gemspec +%dir %{gem_instdir} +%license %{gem_instdir}/COPYING +%license %{gem_instdir}/LICENSE +# This is not the original file, so rather drop it. +%exclude %{gem_instdir}/closure-compiler.gemspec +%{gem_libdir} +%exclude %{gem_cache} +%{gem_spec} %files doc -%doc %{geminstdir}/README.textile -%doc %{gemdir}/doc/%{gemname}-%{version} - +%doc %{gem_docdir} +%doc %{gem_instdir}/README.textile %changelog +* Mon Aug 24 2015 Vít Ondruch <vondruch@redhat.com> - 1.1.11-1 +- Update to closure-compiler 1.1.11. + * Tue Jul 26 2011 Vít Ondruch <vondruch@redhat.com> - 1.1.1-1 - Initial package |