Added install scripts
authoradithyasunil26 <adithyasunil26@gmail.com>
Tue, 2 Feb 2021 14:04:55 +0000 (18:04 +0400)
committerAJ ONeal <aj@therootcompany.com>
Wed, 3 Mar 2021 07:24:14 +0000 (07:24 +0000)
mutagen/README.md [new file with mode: 0644]
mutagen/install.ps1 [new file with mode: 0644]
mutagen/install.sh [new file with mode: 0644]
mutagen/releases.js [new file with mode: 0644]

diff --git a/mutagen/README.md b/mutagen/README.md
new file mode 100644 (file)
index 0000000..03f866b
--- /dev/null
@@ -0,0 +1,35 @@
+---
+title: Foo Bar
+homepage: https://github.com/webinstall/foobar
+tagline: |
+  foobar: An example that doesn't exist.
+---
+
+<!--
+    Note: Delete this comment section.
+
+    Need an example that has an **alias**? See `bat`.
+    Need a Windows example using **msvc**? See `bat`.
+-->
+
+To update or switch versions, run `webi example@stable` (or `@v2`, `@beta`,
+etc).
+
+## Cheat Sheet
+
+> `foo` doesn't exist and this text should have been replaced. It doesn't do
+> anything, but what it does is useful because it is; everybody knows it.
+
+To run foo:
+
+```bash
+foo
+```
+
+### Add Baz Highlighting
+
+To run foo with both bar and baz highlighting turned on:
+
+```bash
+foo --bar=baz
+```
diff --git a/mutagen/install.ps1 b/mutagen/install.ps1
new file mode 100644 (file)
index 0000000..51a66a6
--- /dev/null
@@ -0,0 +1,47 @@
+#!/usr/bin/env pwsh
+
+##################
+# Install mutagen #
+##################
+
+$pkg_cmd_name = "mutagen"
+
+$pkg_dst_cmd = "$Env:USERPROFILE\.local\bin\mutagen.exe"
+$pkg_dst = "$pkg_dst_cmd"
+
+$pkg_src_cmd = "$Env:USERPROFILE\.local\opt\mutagen-v$Env:WEBI_VERSION\bin\mutagen.exe"
+$pkg_src_bin = "$Env:USERPROFILE\.local\opt\mutagen-v$Env:WEBI_VERSION\bin"
+$pkg_src_dir = "$Env:USERPROFILE\.local\opt\mutagen-v$Env:WEBI_VERSION"
+$pkg_src = "$pkg_src_cmd"
+
+$pkg_download = "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE"
+
+IF (!(Test-Path -Path "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE"))
+{
+    echo "Downloading mutagen from $Env:WEBI_PKG_URL to $pkg_download"
+    & curl.exe -A "$Env:WEBI_UA" -fsSL "$Env:WEBI_PKG_URL" -o "$pkg_download.part"
+    & move "$pkg_download.part" "$pkg_download"
+}
+
+IF (!(Test-Path -Path "$pkg_src_cmd"))
+{
+    echo "Installing mutagen"
+
+    pushd .local\tmp
+
+        Remove-Item -Path ".\mutagen-v*" -Recurse -ErrorAction Ignore
+        Remove-Item -Path ".\mutagen.exe" -Recurse -ErrorAction Ignore
+
+        echo "Unpacking $pkg_download"
+        & tar xf "$pkg_download"
+
+        echo "Install Location: $pkg_src_cmd"
+        New-Item "$pkg_src_bin" -ItemType Directory -Force
+        Move-Item -Path ".\mutagen-*\mutagen.exe" -Destination "$pkg_src_bin"
+
+    popd
+}
+
+echo "Copying into '$pkg_dst_cmd' from '$pkg_src_cmd'"
+Remove-Item -Path "$pkg_dst_cmd" -Recurse -ErrorAction Ignore
+Copy-Item -Path "$pkg_src" -Destination "$pkg_dst" -Recurse
diff --git a/mutagen/install.sh b/mutagen/install.sh
new file mode 100644 (file)
index 0000000..b8ff619
--- /dev/null
@@ -0,0 +1,32 @@
+#!/bin/bash
+
+function __init_mutagen() {
+    set -e
+    set -u
+
+    ##################
+    # Install mutagen #
+    ##################
+
+    pkg_cmd_name="mutagen"
+
+    pkg_dst_cmd="$HOME/.local/bin/mutagen"
+    pkg_dst="$pkg_dst_cmd"
+
+    pkg_src_cmd="$HOME/.local/opt/mutagen-v$WEBI_VERSION/bin/mutagen"
+    pkg_src_dir="$HOME/.local/opt/mutagen-v$WEBI_VERSION"
+    pkg_src="$pkg_src_cmd"
+
+    pkg_install() {
+        mkdir -p "$(dirname $pkg_src_cmd)"
+
+        mv ./mutagen "$pkg_src_cmd"
+    }
+
+    pkg_get_current_version() {
+        echo $(mutagen --version 2>/dev/null | head -n 1 | cut -d ' ' -f 2)
+    }
+
+}
+
+__init_mutagen
diff --git a/mutagen/releases.js b/mutagen/releases.js
new file mode 100644 (file)
index 0000000..a3bc8b4
--- /dev/null
@@ -0,0 +1,19 @@
+'use strict';
+
+var github = require('../_common/github.js');
+var owner = 'mutagen-io';
+var repo = 'mutagen';
+
+module.exports = function (request) {
+  return github(request, owner, repo).then(function (all) {
+    return all;
+  });
+};
+
+if (module === require.main) {
+  module.exports(require('@root/request')).then(function (all) {
+    all = require('../_webi/normalize.js')(all);
+    all.releases = all.releases.slice(0, 5);
+    console.info(JSON.stringify(all, null, 2));
+  });
+}