diff --git a/difflib-0.2.4-fix-test-keywords.patch b/difflib-0.2.4-fix-test-keywords.patch new file mode 100644 index 0000000..112941d --- /dev/null +++ b/difflib-0.2.4-fix-test-keywords.patch @@ -0,0 +1,13 @@ +diff --git a/test/global.coffee b/test/global.coffee +index a5bb19c..07954f5 100644 +--- a/test/global.coffee ++++ b/test/global.coffee +@@ -28,7 +28,7 @@ test '.getCloseMatches', -> + getCloseMatches('appel', ['ape', 'apple', 'peach', 'puppy']) + .should.eql ['apple', 'ape'] + +- KEYWORDS = require('coffee-script').RESERVED ++ KEYWORDS = ['case', 'default', 'function', 'var', 'void', 'with', 'const', 'let', 'enum', 'export', 'import', 'native', 'implements', 'interface', 'package', 'private', 'protected', 'public', 'static', 'true', 'false', 'null', 'this', 'new', 'delete', 'typeof', 'in', 'instanceof', 'return', 'throw', 'break', 'continue', 'debugger', 'yield', 'if', 'else', 'switch', 'for', 'while', 'do', 'try', 'catch', 'finally', 'class', 'extends', 'super', 'undefined', 'then', 'unless', 'until', 'loop', 'of', 'by', 'when', 'arguments', 'eval', 'yield*'] + getCloseMatches('wheel', KEYWORDS).should.eql ['when', 'while'] + getCloseMatches('accost', KEYWORDS).should.eql ['const'] + diff --git a/difflib-0.2.4.tgz b/difflib-0.2.4.tgz new file mode 100644 index 0000000..aec9b7d Binary files /dev/null and b/difflib-0.2.4.tgz differ diff --git a/nodejs-difflib.spec b/nodejs-difflib.spec new file mode 100644 index 0000000..b061b98 --- /dev/null +++ b/nodejs-difflib.spec @@ -0,0 +1,56 @@ +%{?nodejs_find_provides_and_requires} +%global packagename difflib +%global enable_tests 1 +Name: nodejs-difflib +Version: 0.2.4 +Release: 1 +Summary: Text diff library ported from Python's difflib module +License: Python +URL: https://github.com/qiao/difflib.js.git +Source0: https://registry.npmjs.org/%{packagename}/-/%{packagename}-%{version}.tgz +Patch0: difflib-0.2.4-fix-test-keywords.patch +BuildArch: noarch +%if 0%{?fedora} >= 19 +ExclusiveArch: %{nodejs_arches} noarch +%else +ExclusiveArch: %{ix86} x86_64 %{arm} noarch +%endif +BuildRequires: nodejs-packaging +%if 0%{?enable_tests} +BuildRequires: coffee-script mocha npm(heap) npm(should) +%endif +%description +Text diff library ported from Python's difflib module + +%prep +%setup -q -n package +%patch0 -p1 +rm lib/difflib.js +%nodejs_fixdep heap '^0.2.0' + +%build +%{_bindir}/coffee -c -b -o lib/ src/difflib.coffee + +%install +mkdir -p %{buildroot}%{nodejs_sitelib}/%{packagename} +cp -pr package.json *.js lib/ \ + %{buildroot}%{nodejs_sitelib}/%{packagename} +%nodejs_symlink_deps +%if 0%{?enable_tests} + +%check +%nodejs_symlink_deps --check +%{__nodejs} -e 'require("./")' +%{_bindir}/coffee -c -b test/*.coffee +%{_bindir}/mocha --require should -R spec --ui qunit +%endif + +%files +%{!?_licensedir:%global license %doc} +%doc *.md +%license README.md +%{nodejs_sitelib}/%{packagename} + +%changelog +* Tue Aug 18 2020 Anan Fu - 0.2.4-1 +- package init diff --git a/nodejs-difflib.spec.old b/nodejs-difflib.spec.old new file mode 100644 index 0000000..5bc67b7 --- /dev/null +++ b/nodejs-difflib.spec.old @@ -0,0 +1,97 @@ +%{?nodejs_find_provides_and_requires} + +%global packagename difflib +%global enable_tests 1 + +Name: nodejs-difflib +Version: 0.2.4 +Release: 8%{?dist} +Summary: Text diff library ported from Python's difflib module + +License: Python +# License text is at the bottom of README.md +URL: https://github.com/qiao/difflib.js.git +Source0: https://registry.npmjs.org/%{packagename}/-/%{packagename}-%{version}.tgz + +Patch0: difflib-0.2.4-fix-test-keywords.patch +# coffee-script no longer exports a "RESERVED" array of reserved keywords, so +# for now we'll manually copy that list of words into the test. So much work +# for such a silly little test, but it holds true to the original intent. + +BuildArch: noarch +%if 0%{?fedora} >= 19 +ExclusiveArch: %{nodejs_arches} noarch +%else +ExclusiveArch: %{ix86} x86_64 %{arm} noarch +%endif + +BuildRequires: nodejs-packaging +%if 0%{?enable_tests} +BuildRequires: coffee-script +BuildRequires: mocha +BuildRequires: npm(heap) +BuildRequires: npm(should) +%endif + +%description +Text diff library ported from Python's difflib module + + +%prep +%setup -q -n package +%patch0 -p1 + +# remove pre-compiled version +rm lib/difflib.js + +%nodejs_fixdep heap '^0.2.0' + +%build +%{_bindir}/coffee -c -b -o lib/ src/difflib.coffee + +%install +mkdir -p %{buildroot}%{nodejs_sitelib}/%{packagename} +cp -pr package.json *.js lib/ \ + %{buildroot}%{nodejs_sitelib}/%{packagename} + +%nodejs_symlink_deps + +%if 0%{?enable_tests} +%check +%nodejs_symlink_deps --check +%{__nodejs} -e 'require("./")' +%{_bindir}/coffee -c -b test/*.coffee +%{_bindir}/mocha --require should -R spec --ui qunit +%endif + + +%files +%{!?_licensedir:%global license %doc} +%doc *.md +%license README.md +# license is at the bottom of README.md, so include it in both docs and license +%{nodejs_sitelib}/%{packagename} + + + +%changelog +* Fri Feb 01 2019 Fedora Release Engineering - 0.2.4-8 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Fri Jul 13 2018 Fedora Release Engineering - 0.2.4-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + +* Thu Feb 08 2018 Fedora Release Engineering - 0.2.4-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Wed Jul 26 2017 Fedora Release Engineering - 0.2.4-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Fri Feb 10 2017 Fedora Release Engineering - 0.2.4-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild + +* Thu Feb 04 2016 Fedora Release Engineering - 0.2.4-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + +* Wed Dec 16 2015 Jared Smith - 0.2.4-2 +- Initial packaging diff --git a/nodejs-difflib.yaml b/nodejs-difflib.yaml new file mode 100644 index 0000000..eacdad0 --- /dev/null +++ b/nodejs-difflib.yaml @@ -0,0 +1,4 @@ +version_control: github +src_repo: qiao/difflib.js.git +tag_prefix: "^" +seperator: "."