%global commit 54ee1ae5928423a0e44ba1861112a746181fbc35 %global shortcommit %(c=%{commit}; echo ${c:0:7}) # disabled due to missing dependencies (that likely won't run in koji anyway) #%%global enable_tests 1 Name: js-jquery-migrate Version: 1.2.1 Release: 6%{?dist} Summary: APIs and features removed from jQuery core BuildArch: noarch License: MIT URL: https://github.com/jquery/jquery-migrate/ Source0: https://github.com/jquery/jquery-migrate/archive/%{commit}/%{name}-%{commit}.tar.gz BuildRequires: web-assets-devel BuildRequires: nodejs-packaging Provides: %{name}-static = %{version}-%{release} BuildRequires: nodejs-grunt >= 0.4.4-3 BuildRequires: npm(grunt-cli) BuildRequires: npm(grunt-contrib-concat) BuildRequires: npm(grunt-contrib-uglify) %if 0%{?enable_tests} BuildRequires: npm(grunt-contrib-qunit) %endif Requires: web-assets-filesystem Requires: js-jquery1 coreutils sed Requires(post): js-jquery1 coreutils sed %description This plugin can be used to detect and restore APIs or features that have been deprecated in jQuery and removed as of version 1.9. The plugin can be included with versions of jQuery as old as 1.6.4 to identify potential upgrade issues via its JQMIGRATE console warnings. However, the plugin is only required for version 1.9.0 or higher to restore deprecated and removed functionality. Additionally, this package automatically maintains a copy of jQuery and jQuery Migrate combined into a single file to permit an easier transition to newer versions of jQuery. %prep %setup -qn jquery-migrate-%{commit} #remove precompiled stuff and bundled libraries rm -rf dist/* libs #fix DOS EOL chars sed -i 's/\r$//' README.md %build %nodejs_symlink_deps --build grunt -v concat uglify %if 0%{?enable_tests} %check grunt qunit %endif %install %global inslibdir %{buildroot}%{_jsdir}/jquery-migrate mkdir -p %{inslibdir} cp -p dist/* %{inslibdir} #touch ghosted jquery+migrate combined files generated in post and on jquery update touch %{inslibdir}/jquery+migrate.js touch %{inslibdir}/jquery+migrate.min.js # We provide a copy of jquery1 and jquery-migrate concatenated, so web application # packages that depend on older versions of jquery can include this file instead # of just jQuery as a transistional mechanism. # It is built at install-time to prevent strictly versioned dependencies on # js-jquery1 and allow system administrators to update/patch jQuery more easily # outside the package collection. %post cat %{_jsdir}/jquery/1/jquery.js > %{_jsdir}/jquery-migrate/jquery+migrate.js echo >> %{_jsdir}/jquery-migrate/jquery+migrate.js cat %{_jsdir}/jquery-migrate/jquery-migrate.js >> %{_jsdir}/jquery-migrate/jquery+migrate.js sed '$ d' %{_jsdir}/jquery/1/jquery.min.js > %{_jsdir}/jquery-migrate/jquery+migrate.min.js cat %{_jsdir}/jquery-migrate/jquery-migrate.min.js >> %{_jsdir}/jquery-migrate/jquery+migrate.min.js %triggerin -- js-jquery1 cat %{_jsdir}/jquery/1/jquery.js > %{_jsdir}/jquery-migrate/jquery+migrate.js echo >> %{_jsdir}/jquery-migrate/jquery+migrate.js cat %{_jsdir}/jquery-migrate/jquery-migrate.js >> %{_jsdir}/jquery-migrate/jquery+migrate.js sed '$ d' %{_jsdir}/jquery/1/jquery.min.js > %{_jsdir}/jquery-migrate/jquery+migrate.min.js cat %{_jsdir}/jquery-migrate/jquery-migrate.min.js >> %{_jsdir}/jquery-migrate/jquery+migrate.min.js %verifyscript badfile() { echo "The file /usr/share/javascript/$1 does not match the" >&2 echo "installed versions of js-jquery1 and js-jquery-migrate. Please reinstall" >&2 echo "these packages to resolve this issue." >&2 } VERDIR=$(mktemp -d) cat %{_jsdir}/jquery/1/jquery.js > $VERDIR/jquery+migrate.js echo >> $VERDIR/jquery+migrate.js cat %{_jsdir}/jquery-migrate/jquery-migrate.js >> $VERDIR/jquery+migrate.js sed '$ d' %{_jsdir}/jquery/1/jquery.min.js > $VERDIR/jquery+migrate.min.js cat %{_jsdir}/jquery-migrate/jquery-migrate.min.js >> $VERDIR/jquery+migrate.min.js cmp -s %{_jsdir}/jquery-migrate/jquery+migrate.js $VERDIR/jquery+migrate.js || badfile jquery+migrate.js cmp -s %{_jsdir}/jquery-migrate/jquery+migrate.min.js $VERDIR/jquery+migrate.min.js || badfile jquery+migrate.min.js rm -rf $VERDIR %files %dir %{_jsdir}/jquery-migrate %{_jsdir}/jquery-migrate/jquery-migrate.js %{_jsdir}/jquery-migrate/jquery-migrate.min.js %ghost %{_jsdir}/jquery-migrate/jquery+migrate.js %ghost %{_jsdir}/jquery-migrate/jquery+migrate.min.js %doc AUTHORS.txt CONTRIBUTING.md README.md %if 0%{?fedora} >= 22 %license LICENSE-MIT %else %doc LICENSE-MIT %endif %changelog * Sat May 16 2015 T.C. Hollingsworth - 1.2.1-6 - use %%license where available - remove bundled qunit - add %%verifyscript for files generated post-install * Thu Feb 19 2015 T.C. Hollingsworth - 1.2.1-5 - document the postinstall scriptlets - indicate the missing dependencies for tests * Mon Dec 29 2014 T.C. Hollingsworth - 1.2.1-4 - correct duplicate in files list - use correct end-of-line encoding in README.md file * Tue Oct 21 2014 T.C. Hollingsworth - 1.2.1-3 - typo and whitespace fixes * Tue Jun 03 2014 T.C. Hollingsworth - 1.2.1-2 - follow the github SourceURL guidelines * Fri May 30 2014 T.C. Hollingsworth - 1.2.1 - initial package