summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Weidenbaum2015-09-05 08:38:28 -0700
committerAndy Weidenbaum2015-09-05 08:38:28 -0700
commita3df1fd9f0c866884135e1f651f5163b1b12275b (patch)
tree4e9712dea5cd37ac94dd88e509a07d4c3c58fc80
downloadaur-a3df1fd9f0c866884135e1f651f5163b1b12275b.tar.gz
Initial import
-rw-r--r--.SRCINFO25
-rw-r--r--PKGBUILD57
-rw-r--r--swagger-editor.install55
-rw-r--r--swagger-editor.service13
4 files changed, 150 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 00000000000..6c7f2fd28e9
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,25 @@
+pkgbase = swagger-editor-git
+ pkgdesc = Swagger Editor
+ pkgver = 20150904
+ pkgrel = 1
+ url = https://github.com/swagger-api/swagger-editor
+ install = swagger-editor.install
+ arch = i686
+ arch = x86_64
+ license = Apache
+ makedepends = git
+ makedepends = nodejs-bower
+ makedepends = nodejs-grunt-cli
+ makedepends = npm
+ depends = darkhttpd
+ depends = nodejs
+ provides = swagger-editor
+ conflicts = swagger-editor
+ options = !strip
+ source = git+https://github.com/swagger-api/swagger-editor
+ source = swagger-editor.service
+ sha256sums = SKIP
+ sha256sums = 8988d97fe76124e0563c80842e0b7841b8fe3c24ca0c66c55af22b12746c5a34
+
+pkgname = swagger-editor-git
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 00000000000..cec64cd0b44
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,57 @@
+# Maintainer: Andy Weidenbaum <archbaum@gmail.com>
+
+pkgname=swagger-editor-git
+pkgver=20150904
+pkgrel=1
+pkgdesc="Swagger Editor"
+arch=('i686' 'x86_64')
+depends=('darkhttpd' 'nodejs')
+makedepends=('git' 'nodejs-bower' 'nodejs-grunt-cli' 'npm')
+url="https://github.com/swagger-api/swagger-editor"
+license=('Apache')
+source=(git+https://github.com/swagger-api/swagger-editor
+ swagger-editor.service)
+sha256sums=('SKIP'
+ '8988d97fe76124e0563c80842e0b7841b8fe3c24ca0c66c55af22b12746c5a34')
+provides=('swagger-editor')
+conflicts=('swagger-editor')
+options=('!strip')
+install=swagger-editor.install
+
+pkgver() {
+ cd ${pkgname%%-git}
+ git log -1 --format="%cd" --date=short | sed "s|-||g"
+}
+
+build() {
+ cd ${pkgname%%-git}
+
+ msg2 'Fetching NPM dependencies...'
+ npm install --python=python2
+
+ msg2 'Fetching Web assets...'
+ bower install --allow-root --config.interactive=false
+
+ msg2 'Compiling Web assets...'
+ grunt build
+}
+
+package() {
+ cd ${pkgname%%-git}
+
+ msg2 'Installing docs...'
+ install -Dm 644 README.md "$pkgdir/usr/share/doc/swagger-editor/README.md"
+
+ msg2 'Installing...'
+ install -dm 755 "$pkgdir/usr/share/swagger-editor"
+ find . -mindepth 1 -maxdepth 1 -exec \
+ cp -dpr --no-preserve=ownership '{}' "$pkgdir/usr/share/swagger-editor" \;
+
+ msg2 'Installing swagger-editor.service...'
+ install -Dm 644 "$srcdir/swagger-editor.service" \
+ "$pkgdir/usr/lib/systemd/system/swagger-editor.service"
+
+ msg2 'Cleaning up pkgdir...'
+ find "$pkgdir" -type d -name .git -exec rm -r '{}' +
+ find "$pkgdir" -type f -name .gitignore -exec rm -r '{}' +
+}
diff --git a/swagger-editor.install b/swagger-editor.install
new file mode 100644
index 00000000000..5e79c1acc06
--- /dev/null
+++ b/swagger-editor.install
@@ -0,0 +1,55 @@
+post_install() {
+ _mkuser
+ chown -R swaggereditor:swaggereditor /usr/share/swagger-editor
+ printf "%b\n" "$swaggereditor"
+}
+
+post_upgrade() {
+ post_install
+}
+
+post_remove() {
+ _rmuser
+ rm -rf /usr/share/swagger-editor
+}
+
+_mkuser() {
+ getent passwd swaggereditor &>/dev/null || {
+ echo -n "Creating swaggereditor user... "
+ grep -E "^swaggereditor:" /etc/group >/dev/null || groupadd swaggereditor
+ useradd -M -g swaggereditor -s /usr/bin/nologin swaggereditor
+ echo "done"
+ }
+}
+
+_rmuser() {
+ echo -n "Removing swaggereditor user... "
+ userdel -rf swaggereditor 2>/dev/null
+ echo "done"
+}
+
+read -d '' swaggereditor <<'EOF'
+#####################################################################
+#####################################################################
+## ##
+## Swagger Editor ##
+## ______________ ##
+## ##
+## Swagger Editor lets you edit Swagger API specifications in ##
+## YAML inside your browser and to preview documentations in ##
+## real time. Valid Swagger JSON descriptions can then be ##
+## generated and used with the full Swagger tooling (code ##
+## generation, documentation, etc). ##
+## ##
+## Run the main application: ##
+## ##
+## # systemctl start swagger-editor ##
+## ##
+## Then open a browser and go to: ##
+## ##
+## http://127.0.0.1:9898 ##
+## ##
+## ##
+#####################################################################
+#####################################################################
+EOF
diff --git a/swagger-editor.service b/swagger-editor.service
new file mode 100644
index 00000000000..7dc390f0608
--- /dev/null
+++ b/swagger-editor.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=Swagger Editor
+
+[Service]
+User=swaggereditor
+Group=swaggereditor
+WorkingDirectory=/usr/share/swagger-editor
+ExecStart=/usr/bin/darkhttpd /usr/share/swagger-editor/dist --port 9898
+StandardOutput=journal
+StandardError=journal
+
+[Install]
+WantedBy=multi-user.target