Compare commits

..

7 Commits
0.27 ... 0.28

Author SHA1 Message Date
190eca6f6e check for mahor version for updates 2021-04-15 00:57:15 +02:00
805bed7db1 design 2021-04-08 21:05:34 +02:00
6c59aa25db lfs 2021-04-08 21:05:30 +02:00
ff648f0017 don't make autorestic return 1 on call 2021-01-24 10:27:37 +01:00
c79b45308b Create config.yml 2021-01-10 11:27:41 +01:00
43eabdb204 Update issue templates 2021-01-10 11:25:48 +01:00
0ead9e0da1 remove version from package 2020-12-19 17:32:13 +01:00
10 changed files with 68 additions and 18 deletions

1
.gitattributes vendored Normal file
View File

@@ -0,0 +1 @@
*.afdesign filter=lfs diff=lfs merge=lfs -text

21
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View File

@@ -0,0 +1,21 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
---
**Describe the bug**
<!-- A clear and concise description of what the bug is. -->
**Expected behavior**
<!-- A clear and concise description of what you expected to happen. -->
**Environment**
- OS: [e.g. iOS]
- Version: [e.g. 22]
**Additional context**
<!-- Add any other context about the problem here. -->

4
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View File

@@ -0,0 +1,4 @@
contact_links:
- name: Questions & Help
url: https://github.com/cupcakearmy/autorestic/discussions
about: Please ask and answer questions here.

View File

@@ -0,0 +1,14 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
<!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->
**Describe the solution you'd like**
<!-- A clear and concise description of what you want to happen. -->

BIN
.github/logo.afdesign (Stored with Git LFS) vendored Normal file

Binary file not shown.

View File

@@ -19,4 +19,4 @@ curl -s https://api.github.com/repos/cupcakearmy/autorestic/releases/latest \
chmod +x ${OUT_FILE} chmod +x ${OUT_FILE}
autorestic install autorestic install
autorestic autorestic --help

View File

@@ -1,11 +1,10 @@
{ {
"private": true, "private": true,
"version": "0.27",
"scripts": { "scripts": {
"build": "tsc", "build": "tsc",
"dev": "tsc -w", "dev": "tsc -w",
"move": "mv bin/index-linux bin/autorestic_linux_x64 && mv bin/index-macos bin/autorestic_macos_x64", "move": "mv bin/index-linux bin/autorestic_linux_x64 && mv bin/index-macos bin/autorestic_macos_x64",
"bin": "yarn run build && pkg dist/src/index.js --targets latest-macos-x64,latest-linux-x64 --out-path bin && yarn run move", "bin": "yarn run build && pkg dist/index.js --targets latest-macos-x64,latest-linux-x64 --out-path bin && yarn run move",
"docs:build": "codedoc install && codedoc build", "docs:build": "codedoc install && codedoc build",
"docs:dev": "codedoc serve" "docs:dev": "codedoc serve"
}, },
@@ -18,12 +17,14 @@
"typescript": "^3.9" "typescript": "^3.9"
}, },
"dependencies": { "dependencies": {
"@types/semver": "^7.3.4",
"axios": "^0.19", "axios": "^0.19",
"clitastic": "^0.1.2", "clitastic": "^0.1.2",
"colors": "^1", "colors": "^1",
"commander": "^6.2", "commander": "^6.2",
"cron-parser": "2.x.x", "cron-parser": "2.x.x",
"js-yaml": "3.x.x", "js-yaml": "3.x.x",
"semver": "^7.3.5",
"uhrwerk": "1.x.x" "uhrwerk": "1.x.x"
} }
} }

View File

@@ -2,6 +2,7 @@ import { chmodSync } from 'fs'
import axios from 'axios' import axios from 'axios'
import { Writer } from 'clitastic' import { Writer } from 'clitastic'
import semver from 'semver'
import { INSTALL_DIR, VERSION } from '..' import { INSTALL_DIR, VERSION } from '..'
import { checkIfResticIsAvailable, downloadFile, exec } from '../utils' import { checkIfResticIsAvailable, downloadFile, exec } from '../utils'
@@ -18,19 +19,25 @@ export async function upgrade() {
responseType: 'json', responseType: 'json',
}) })
if (json.tag_name != VERSION) { const latest = semver.coerce(json.tag_name)
const platformMap: { [key: string]: string } = { const current = semver.coerce(VERSION)
darwin: 'macos', if (!latest || !current) throw new Error('Could not parse versions numbers.')
if (semver.gt(latest, current) && semver.major(latest) === semver.major(current)) {
// Update to compatible
if (json.tag_name != VERSION) {
const platformMap: { [key: string]: string } = {
darwin: 'macos',
}
const name = `autorestic_${platformMap[process.platform] || process.platform}_${process.arch}`
const dl = json.assets.find((asset: any) => asset.name === name)
const to = INSTALL_DIR + '/autorestic'
w.replaceLn('Downloading binary... 🌎')
await downloadFile(dl.browser_download_url, to)
chmodSync(to, 0o755)
} }
const name = `autorestic_${platformMap[process.platform] || process.platform}_${process.arch}`
const dl = json.assets.find((asset: any) => asset.name === name)
const to = INSTALL_DIR + '/autorestic'
w.replaceLn('Downloading binary... 🌎')
await downloadFile(dl.browser_download_url, to)
chmodSync(to, 0o755)
} }
w.done('All up to date! 🚀') w.done('All up to date! 🚀')

View File

@@ -5,7 +5,6 @@ import { setCIMode } from 'clitastic'
import { unlock, readLock, writeLock, lock } from './lock' import { unlock, readLock, writeLock, lock } from './lock'
import { Config } from './types' import { Config } from './types'
import { init } from './config' import { init } from './config'
import { version } from '../package.json'
import info from './handlers/info' import info from './handlers/info'
import check from './handlers/check' import check from './handlers/check'
@@ -18,7 +17,7 @@ import install from './handlers/install'
import { uninstall } from './handlers/uninstall' import { uninstall } from './handlers/uninstall'
import { upgrade } from './handlers/upgrade' import { upgrade } from './handlers/upgrade'
export const VERSION = version export const VERSION = '0.28'
export const INSTALL_DIR = '/usr/local/bin' export const INSTALL_DIR = '/usr/local/bin'
let requireConfig: boolean = true let requireConfig: boolean = true

View File

@@ -9,5 +9,5 @@
"alwaysStrict": true, "alwaysStrict": true,
"strictNullChecks": true "strictNullChecks": true
}, },
"include": ["./src", "./package.json"] "include": ["./src"]
} }