Blob Blame History Raw
%{?scl:%scl_package rubygem-%{gem_name}}
%{!?scl:%global pkg_name %{name}}

# Generated from uglifier-1.2.6.gem by gem2rpm -*- rpm-spec -*-
%global gem_name uglifier

# Fallback to rh-nodejs4 rh-nodejs4-scldevel is probably not available in
# the buildroot.
%{?scl:%{!?scl_nodejs:%global scl_nodejs rh-nodejs4}}
%{?scl:%{!?scl_prefix_nodejs:%global scl_prefix_nodejs %{scl_nodejs}-}}

Summary: Ruby wrapper for UglifyJS JavaScript compressor
Name: %{?scl_prefix}rubygem-%{gem_name}
Version: 3.0.2
Release: 1%{?dist}
Group: Development/Languages
# lib/source-map.js is BSD.
# lib/uglify.js is BSD.
License: MIT and BSD
URL: http://github.com/lautis/uglifier
Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem
# Unbundling es5.js and split.js files,
# since they are needed only by JScript engine, which is not supported on Fedora
# https://github.com/lautis/uglifier/issues/99
Patch1: rubygem-uglifier-3.0.0-unbundle-js-files-for-jscript.patch

Requires: %{?scl_prefix_ruby}ruby(release)
Requires: %{?scl_prefix_ruby}ruby(rubygems)
Requires: %{?scl_prefix}rubygem(execjs) >= 0.3.0
BuildRequires: %{?scl_prefix_ruby}ruby(release)
BuildRequires: %{?scl_prefix_ruby}rubygems-devel
BuildRequires: %{?scl_prefix_ruby}ruby
BuildRequires: %{?scl_prefix}rubygem(execjs) >= 0.3.0
BuildRequires: %{?scl_prefix}rubygem(rspec)
# Do not regenerate uglify.js because it's not shiped as a package on SCL.
#BuildRequires: uglify-js = 2.7.0
# uglify-js does not provide single file uglify-js.js yet => let's
# generate and bundle it here.
Provides: bundled(uglify-js) = 2.7.0
# There is not included dist/source-map.js yet.
# https://bugzilla.redhat.com/show_bug.cgi?id=1358915
Provides: bundled(nodejs-source-map) = 0.5.3

BuildArch: noarch
Provides: %{?scl_prefix}rubygem(%{gem_name}) = %{version}

# Explicitly require runtime subpackage, as long as older scl-utils do not generate it
%{?scl:Requires: %{?scl_prefix}runtime}

BuildRequires: %{?scl_prefix_nodejs}nodejs

%description
Uglifier minifies JavaScript files by wrapping UglifyJS to be accessible in
Ruby.

%package doc
Summary: Documentation for %{pkg_name}
Group: Documentation
Requires: %{?scl_prefix}%{pkg_name} = %{version}-%{release}
BuildArch: noarch

%description doc
Documentation for %{pkg_name}.

%prep
%{?scl:scl enable %{scl} - << \EOF}
set -e
gem unpack %{SOURCE0}

%setup -q -D -T -n  %{gem_name}-%{version}

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

%patch1 -p1
sed -i -E '/files/ s|"lib/es5.js"(.freeze)?, ||' %{gem_name}.gemspec
sed -i -E '/files/ s|"lib/split.js"(.freeze)?, ||' %{gem_name}.gemspec
%{?scl:EOF}

%build
%{?scl:scl enable %{scl} - << \EOF}
set -e
gem build %{gem_name}.gemspec
%gem_install
%{?scl:EOF}

%install
mkdir -p %{buildroot}%{gem_dir}
cp -a .%{gem_dir}/* \
        %{buildroot}%{gem_dir}/

%check
pushd .%{gem_instdir}
# Disable rubygem-sourcemap because it is not part of fedora yet.
sed -i "/require 'sourcemap'/ s/^/#/"  spec/spec_helper.rb
sed -i '/SourceMap::Map/ i \    pending' spec/source_map_spec.rb

%{?scl:scl enable %{scl} %{scl_nodejs} - << \EOF}
rspec spec
%{?scl:EOF}
popd

%files
# There is no %%license macro on RHEL6.
# https://bugzilla.redhat.com/show_bug.cgi?id=1386246
%{!?_licensedir:%global license %%doc}

%dir %{gem_instdir}
%exclude %{gem_instdir}/.*
%license %{gem_instdir}/LICENSE.txt
%{gem_libdir}
%exclude %{gem_cache}
%{gem_spec}

%files doc
%doc %{gem_docdir}
%doc %{gem_instdir}/CHANGELOG.md
%doc %{gem_instdir}/CONTRIBUTING.md
%{gem_instdir}/Gemfile
%{gem_instdir}/Rakefile
%doc %{gem_instdir}/README.md
%{gem_instdir}/gemfiles
%{gem_instdir}/spec
%{gem_instdir}/%{gem_name}.gemspec

%changelog
* Mon Dec 05 2016 Jun Aruga <jaruga@redhat.com> - 3.0.2-1
- Update to Uglifier 3.0.2.

* Wed Feb 24 2016 Pavel Valena <pvalena@redhat.com> - 2.4.0-5
- Rebuilt for rh-ror42

* Mon Jan 26 2015 Josef Stribny <jstribny@redhat.com> - 2.4.0-1
- Update to 2.4.0

* Mon Feb 17 2014 Josef Stribny <jstribny@redhat.com> - 2.2.1-4
- Depend on scldevel(v8) virtual provide

* Thu Jan 23 2014 Vít Ondruch <vondruch@redhat.com> - 2.2.1-3
- Fix rubygems dependency.

* Tue Nov 26 2013 Josef Stribny <jstribny@redhat.com> - 2.2.1-2
- Use v8 scl macro

* Mon Oct 21 2013 Josef Stribny <jstribny@redhat.com> - 2.2.1-1
- Update to uglifier 2.2.1

* Wed Jun 12 2013 Josef Stribny <jstribny@redhat.com> - 1.2.6-3
- Rebuild for https://fedoraproject.org/wiki/Features/Ruby_2.0.0

* Thu Jul 26 2012 Bohuslav Kabrda <bkabrda@redhat.com> - 1.2.6-2
- Imported from Fedora again.

* Mon Jul 16 2012 Bohuslav Kabrda <bkabrda@redhat.com> - 1.2.6-1
- Initial package