From 47076b4ef1266957c1fd2d990102a16307b5f2e6 Mon Sep 17 00:00:00 2001 From: adithyasunil26 Date: Tue, 2 Feb 2021 18:04:55 +0400 Subject: [PATCH] Added install scripts --- mutagen/README.md | 35 +++++++++++++++++++++++++++++++++ mutagen/install.ps1 | 47 +++++++++++++++++++++++++++++++++++++++++++++ mutagen/install.sh | 32 ++++++++++++++++++++++++++++++ mutagen/releases.js | 19 ++++++++++++++++++ 4 files changed, 133 insertions(+) create mode 100644 mutagen/README.md create mode 100644 mutagen/install.ps1 create mode 100644 mutagen/install.sh create mode 100644 mutagen/releases.js diff --git a/mutagen/README.md b/mutagen/README.md new file mode 100644 index 0000000..03f866b --- /dev/null +++ b/mutagen/README.md @@ -0,0 +1,35 @@ +--- +title: Foo Bar +homepage: https://github.com/webinstall/foobar +tagline: | + foobar: An example that doesn't exist. +--- + + + +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 index 0000000..51a66a6 --- /dev/null +++ b/mutagen/install.ps1 @@ -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 index 0000000..b8ff619 --- /dev/null +++ b/mutagen/install.sh @@ -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 index 0000000..a3bc8b4 --- /dev/null +++ b/mutagen/releases.js @@ -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)); + }); +} -- 2.25.1