package init

This commit is contained in:
yaokai13 2020-08-29 10:57:49 +08:00
parent 9f9328f1d9
commit fb9b8f9086
5 changed files with 117 additions and 0 deletions

BIN
JSONSelect-0.4.0.tgz Normal file

Binary file not shown.

13
LICENSE Normal file
View File

@ -0,0 +1,13 @@
Copyright (c) 2011, Lloyd Hilaiel <lloyd@hilaiel.com>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

63
nodejs-jsonselect.spec Normal file
View File

@ -0,0 +1,63 @@
%{?nodejs_find_provides_and_requires}
%global packagename JSONSelect
%global enable_tests 1
Name: nodejs-jsonselect
Version: 0.4.0
Release: 1
Summary: CSS-like selectors for JSON
License: ISC
URL: https://github.com/lloyd/JSONSelect.git
Source0: https://registry.npmjs.org/JSONSelect/-/JSONSelect-%{version}.tgz
Source1: https://raw.githubusercontent.com/lloyd/JSONSelect/master/LICENSE
Patch0000: nodejs-jsonselect_fix-print.patch
BuildArch: noarch
ExclusiveArch: %{nodejs_arches} noarch
BuildRequires: nodejs-packaging
%if 0%{?enable_tests}
BuildRequires: uglify-js
%endif
%description
CSS-like selectors for JSON
%prep
%setup -q -n package
cp -p %{SOURCE1} .
mv src/build src/build.disabled
mkdir src/build
cp src/build.disabled/post-compile.js src/build
rm -rf src/build.disabled src/dist
mkdir src/dist
rm -rf site
%patch0000 -p1
%build
pushd src
make project
%{_bindir}/uglifyjs dist/jsonselect.js > dist/jsonselect.min.js.tmp
%__nodejs build/post-compile.js dist/jsonselect.min.js.tmp > dist/jsonselect.min.js
popd
mv src src.complete
mkdir src
cp src.complete/dist/*.js src/
%install
mkdir -p %{buildroot}%{nodejs_sitelib}/JSONSelect
cp -pr package.json src/ \
%{buildroot}%{nodejs_sitelib}/JSONSelect
%nodejs_symlink_deps
%if 0%{?enable_tests}
%check
%nodejs_symlink_deps --check
%__nodejs src.complete/test/run.js
%endif
%files
%{!?_licensedir:%global license %doc}
%doc *.md
%license LICENSE
%{nodejs_sitelib}/JSONSelect
%changelog
* Thu Aug 20 2020 yaokai <yaokai13@huawei.com> - 0.4.0-1
- Package init

4
nodejs-jsonselect.yaml Normal file
View File

@ -0,0 +1,4 @@
version_control: github
src_repo: lloyd/JSONSelect
tag_pattern: "^"
seperator: "."

View File

@ -0,0 +1,37 @@
diff --git a/src/build/post-compile.js b/src/build/post-compile.js
index 4bcafe8..bfdf083 100644
--- a/src/build/post-compile.js
+++ b/src/build/post-compile.js
@@ -1,7 +1,6 @@
#!/usr/bin/env node
-var print = require("sys").print,
- src = require("fs").readFileSync(process.argv[2], "utf8");
+var src = require("fs").readFileSync(process.argv[2], "utf8");
// Previously done in sed but reimplemented here due to portability issues
-print(src.replace(/^(\s*\*\/)(.+)/m, "$1\n$2;"));
+console.log(src.replace(/^(\s*\*\/)(.+)/m, "$1\n$2;"));
diff --git a/src/test/run.js b/src/test/run.js
index c873c3a..1c2a664 100644
--- a/src/test/run.js
+++ b/src/test/run.js
@@ -6,8 +6,7 @@
const fs = require('fs'),
path = require('path'),
-jsonselect = require('../jsonselect.js'),
- sys = require('sys');
+jsonselect = require('../jsonselect.js')
var pathToTests = path.join(__dirname, "tests");
@@ -46,7 +45,7 @@ function runTests() {
for (var d in tests[l]) {
console.log(" level " + l + " tests against \"" + d + ".json\":");
for (var i = 0; i < tests[l][d].length; i++) {
- sys.print(" " + tests[l][d][i][0] + ": ");
+ console.log(" " + tests[l][d][i][0] + ": ");
try {
runOneSync(d, tests[l][d][i][0], tests[l][d][i][1]);
numPassed++;