-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace version number hyphens with arbitrary strings (#76)
* Allow replacing hyphens with specific strings
- Loading branch information
Showing
6 changed files
with
108 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
node_modules | ||
coverage | ||
*.log | ||
.vscode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
test/fixtures/my-cool-api-with-hyphenated-version-and-override-underscore.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"name": "my-cool-api", | ||
"version": "1.1.1-pre-release-string.1", | ||
"scripts": { | ||
"start": "node index.js" | ||
}, | ||
"description": "My Cool API", | ||
"main": "index.js", | ||
"author": "[email protected]", | ||
"license": "MIT", | ||
"spec": { | ||
"replaceHyphens": "_" | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
test/fixtures/my-cool-api-with-version-hyphens-replaced-underscores.spec
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
%define name my-cool-api | ||
%define version 1.1.1_pre_release_string.1 | ||
%define release 1 | ||
%define buildroot %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) | ||
|
||
Name: %{name} | ||
Version: %{version} | ||
Release: %{release} | ||
Summary: my-cool-api | ||
|
||
Group: Installation Script | ||
License: MIT | ||
Source: %{name}.tar.gz | ||
BuildRoot: %{buildroot} | ||
Requires: nodejs | ||
BuildRequires: nodejs | ||
AutoReqProv: no | ||
|
||
%description | ||
My Cool API | ||
|
||
%prep | ||
%setup -q -c -n %{name} | ||
|
||
%build | ||
npm prune --production | ||
npm rebuild | ||
|
||
%pre | ||
getent group my-cool-api >/dev/null || groupadd -r my-cool-api | ||
getent passwd my-cool-api >/dev/null || useradd -r -g my-cool-api -G my-cool-api -d / -s /sbin/nologin -c "my-cool-api" my-cool-api | ||
|
||
%install | ||
mkdir -p %{buildroot}/usr/lib/my-cool-api | ||
cp -r ./ %{buildroot}/usr/lib/my-cool-api | ||
mkdir -p %{buildroot}/var/log/my-cool-api | ||
|
||
%post | ||
systemctl enable /usr/lib/my-cool-api/my-cool-api.service | ||
|
||
%clean | ||
rm -rf %{buildroot} | ||
|
||
%files | ||
%defattr(644, my-cool-api, my-cool-api, 755) | ||
/usr/lib/my-cool-api | ||
/var/log/my-cool-api |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters