summaryrefslogtreecommitdiffstats
path: root/rubygem-closure-compiler.spec
blob: 41cca6fd5104b035591500b4e0390dd75a7133b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# Generated from closure-compiler-1.1.1.gem by gem2rpm -*- rpm-spec -*-
%global gem_name closure-compiler

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: 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
BuildRequires: rubygem(test-unit)
BuildRequires: closure-compiler
BuildArch: noarch

%description
A Ruby Wrapper for the Google Closure Compiler.


%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}

gem spec %{SOURCE0} -l --ruby > %{gem_name}.gemspec

# Remove bundled closure-compiler.
rm lib/*.jar
sed -i 's| "lib/closure-compiler-20140730.jar",||' %{gem_name}.gemspec

# 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}/


%check
pushd .%{gem_instdir}
tar xzvf %{SOURCE1}

cat %{PATCH0} | patch -p1

# 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

%files
%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 %{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