package init

This commit is contained in:
wangchong1995924 2020-08-20 19:42:22 +08:00
parent 428a6d4bfe
commit 3ba3ab1fe0
7 changed files with 206 additions and 0 deletions

84
dl-tests.sh Normal file
View File

@ -0,0 +1,84 @@
#!/bin/bash
tag=$(sed -n 's/^Version:\s\(.*\)$/\1/p' ./*.spec | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
url=$(sed -n 's/^URL:\s\(.*\)$/\1/p' ./*.spec | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
pkgdir=$(basename $url | sed -s 's/\.git$//')
echo "tag: $tag"
echo "URL: $url"
echo "pkgdir: $pkgdir"
set -e
tmp=$(mktemp -d)
trap cleanup EXIT
cleanup() {
echo Cleaning up...
set +e
[ -z "$tmp" -o ! -d "$tmp" ] || rm -rf "$tmp"
}
unset CDPATH
pwd=$(pwd)
pushd "$tmp"
git clone $url
cd $pkgdir
echo Finding git tag
gittag=$(git show-ref --tags | cut -d' ' -f2 | grep "${tag}$" || git show-ref --tags | cut -d' ' -f2 | sort -Vr | head -n1)
if [ -z $gittag ]; then
gittag=tags/$tag
fi
echo "Git Tag: $gittag"
if [ -d "test" ]; then
git archive --prefix='test/' --format=tar ${gittag}:test/ \
| bzip2 > "$pwd"/tests-${tag}.tar.bz2
elif [ -d "tests" ]; then
git archive --prefix='tests/' --format=tar ${gittag}:tests/ \
| bzip2 > "$pwd"/tests-${tag}.tar.bz2
elif [ -d "spec" ]; then
git archive --prefix='spec/' --format=tar ${gittag}:spec/ \
| bzip2 > "$pwd"/tests-${tag}.tar.bz2
else
echo "No test directory found for tag ${gittag}"
fi
if [ -d "support" ]; then
git archive --prefix='support/' --format=tar ${gittag}:support/ \
| bzip2 > "$pwd"/support-${tag}.tar.bz2
fi
if [ -d "fixture" ]; then
git archive --prefix='fixture/' --format=tar ${gittag}:fixture/ \
| bzip2 > "$pwd"/fixture-${tag}.tar.bz2
fi
if [ -d "examples" ]; then
git archive --prefix='examples/' --format=tar ${gittag}:examples/ \
| bzip2 > "$pwd"/examples-${tag}.tar.bz2
elif [ -d "example" ]; then
git archive --prefix='example/' --format=tar ${gittag}:example/ \
| bzip2 > "$pwd"/examples-${tag}.tar.bz2
fi
if [ -d "tasks" ]; then
git archive --prefix='tasks/' --format=tar ${gittag}:tasks/ \
| bzip2 > "$pwd"/tasks-${tag}.tar.bz2
fi
if [ -d "docs" ]; then
git archive --prefix='docs/' --format=tar ${gittag}:docs/ \
| bzip2 > "$pwd"/docs-${tag}.tar.bz2
elif [ -d "doc" ]; then
git archive --prefix='doc/' --format=tar ${gittag}:doc/ \
| bzip2 > "$pwd"/docs-${tag}.tar.bz2
fi
if [ -d "src" ]; then
git archive --prefix='src/' --format=tar ${gittag}:src/ \
| bzip2 > "$pwd"/src-${tag}.tar.bz2
fi
if [ -d "tools" ]; then
git archive --prefix='tools/' --format=tar ${gittag}:tools/ \
| bzip2 > "$pwd"/tools-${tag}.tar.bz2
fi
if [ -d "scripts" ]; then
git archive --prefix='scripts/' --format=tar ${gittag}:scripts/ \
| bzip2 > "$pwd"/scripts-${tag}.tar.bz2
fi
popd

70
nodejs-prelude-ls.spec Normal file
View File

@ -0,0 +1,70 @@
%{?nodejs_find_provides_and_requires}
%global packagename prelude-ls
%global bootstrap 1
%global enable_tests 0
Name: nodejs-prelude-ls
Version: 1.1.2
Release: 1
Summary: The prelude.ls library is a functionally oriented utility
License: MIT
URL: https://github.com/gkz/prelude-ls.git
Source0: https://registry.npmjs.org/prelude-ls/-/prelude-ls-%{version}.tgz
Source1: tests-%{version}.tar.bz2
Source2: src-%{version}.tar.bz2
Source10: dl-tests.sh
Source11: https://raw.githubusercontent.com/gkz/prelude-ls/%{version}/package.json.ls
BuildArch: noarch
ExclusiveArch: %{nodejs_arches} noarch
BuildRequires: nodejs-packaging
%if 0%{?enable_tests}
BuildRequires: mocha npm(sinon)
%endif
%if !0%{?bootstrap}
BuildRequires: npm(LiveScript)
%endif
%description
prelude.ls is a functionally oriented utility library. It is powerful and
flexible. Almost all of its functions are curried. It is written in, and is
the recommended base library for, LiveScript.
%prep
%setup -q -n package
%setup -q -T -D -a 1 -n package
%setup -q -T -D -a 2 -n package
cp -p %{SOURCE11} .
%build
%if !0%{?bootstrap}
%{_bindir}/echo -e "\e[102m -=#=- Building from source -=#=- \e[0m"
rm -rf ./lib/
mkdir ./lib/
%{_bindir}/lsc --compile package.json.ls
%{_bindir}/lsc --output lib --bare --compile src/*.ls
rm -rf ./node_modules/
%endif
%install
mkdir -p %{buildroot}%{nodejs_sitelib}/%{packagename}
cp -pr package.json lib/ \
%{buildroot}%{nodejs_sitelib}/%{packagename}
%nodejs_symlink_deps
%check
%nodejs_symlink_deps --check
%{__nodejs} -e 'require("./")'
%if 0%{?enable_tests}
%{_bindir}/lsc -o test/ test/*.ls
%{_bindir}/mocha -R spec --ui tdd
%else
%{_bindir}/echo -e "\e[101m -=#=- Tests disabled -=#=- \e[0m"
%endif
%files
%{!?_licensedir:%global license %doc}
%doc *.md
%license LICENSE
%{nodejs_sitelib}/%{packagename}
%changelog
* Thu Aug 20 2020 wangchong <wangchong56@huawei.com> - 1.1.2-1
- package init

4
nodejs-prelude-ls.yaml Normal file
View File

@ -0,0 +1,4 @@
version-control: github
src_repo: gkz/prelude-ls
tag_prefix: ^
seperator: .

48
package.json.ls Normal file
View File

@ -0,0 +1,48 @@
name: 'prelude-ls'
version: '1.1.2'
author: 'George Zahariev <z@georgezahariev.com>'
description: "prelude.ls is a functionally oriented utility library. It is powerful and flexible. Almost all of its functions are curried. It is written in, and is the recommended base library for, LiveScript."
keywords:
'prelude'
'livescript'
'utility'
'ls'
'coffeescript'
'javascript'
'library'
'functional'
'array'
'list'
'object'
'string'
main: 'lib/'
files:
'lib/'
'README.md'
'LICENSE'
homepage: 'http://preludels.com'
bugs: 'https://github.com/gkz/prelude-ls/issues'
licenses:
* type: 'MIT'
url: 'https://raw.github.com/gkz/prelude-ls/master/LICENSE'
...
engines:
node: '>= 0.8.0'
repository:
type: 'git'
url: 'git://github.com/gkz/prelude-ls.git'
scripts:
test: "make test"
dev-dependencies:
livescript: '~1.4.0'
'uglify-js': '~2.4.12'
mocha: '~2.2.4'
istanbul: '~0.2.4'
browserify: '~3.24.13'
sinon: '~1.10.2'

BIN
prelude-ls-1.1.2.tgz Normal file

Binary file not shown.

BIN
src-1.1.2.tar.bz2 Normal file

Binary file not shown.

BIN
tests-1.1.2.tar.bz2 Normal file

Binary file not shown.