Skip to content
This repository has been archived by the owner on May 2, 2024. It is now read-only.

Commit

Permalink
fix: fixes for #1, #2 and #4
Browse files Browse the repository at this point in the history
  • Loading branch information
Lilit0x committed Jul 17, 2023
1 parent c2c23c8 commit b928c26
Show file tree
Hide file tree
Showing 12 changed files with 6,836 additions and 283 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div align="center">

# Woke share [![Release](https://github.com/wokebuild/share/actions/workflows/release.yml/badge.svg)](https://github.com/wokebuild/share/actions/workflows/release.yml)[![Lint](https://github.com/wokebuild/share/actions/workflows/lint.yml/badge.svg)](https://github.com/wokebuild/share/actions/workflows/lint.yml)
# share [![Release](https://github.com/wokebuild/share/actions/workflows/release.yml/badge.svg)](https://github.com/wokebuild/share/actions/workflows/release.yml)[![Lint](https://github.com/wokebuild/share/actions/workflows/lint.yml/badge.svg)](https://github.com/wokebuild/share/actions/workflows/lint.yml)

Share anything with teammates across machines via CLI
</div>
Expand Down Expand Up @@ -31,7 +31,9 @@ Or, using curl:
```sh
curl https://wokebuild.github.io | bash
```
Note: This script will install `share` to your directory. To install it somewhere else (e.g.,/usr/local/bin), `cd` there and make sure you can write to that directory, e.g.
Notes:
- For windows users using `Command Prompt` or `Powershell`, use the script without `sudo`.
- This script will install `share` to your directory. To install it somewhere else (e.g.,/usr/local/bin), `cd` there and make sure you can write to that directory, e.g.
```sh
cd /usr/local/bin
curl https://wokebuild.github.io | sudo bash
Expand Down
80 changes: 80 additions & 0 deletions npm/binary.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@

const { Binary } = require("binary-install");
const os = require("os");
const cTable = require("console.table");

const error = msg => {
console.error(msg);
process.exit(1);
};

const { version } = require("./package.json");
const name = "share";

const supportedPlatforms = [
{
TYPE: "Windows_NT",
ARCHITECTURE: "x64",
RUST_TARGET: "x86_64-windows",
BINARY_NAME: "share.exe"
},
{
TYPE: "Linux",
ARCHITECTURE: "x64",
RUST_TARGET: "x86_64-linux",
BINARY_NAME: "share"
},
{
TYPE: "Darwin",
ARCHITECTURE: "x64",
RUST_TARGET: "x86_64-macos",
BINARY_NAME: "share"
},
{
TYPE: "Darwin",
ARCHITECTURE: "arm64",
RUST_TARGET: "x86_64-macos",
BINARY_NAME: "share"
}
];

const getPlatformMetadata = () => {
const type = os.type();
const architecture = os.arch();

for (let supportedPlatform of supportedPlatforms) {
if (
type === supportedPlatform.TYPE &&
architecture === supportedPlatform.ARCHITECTURE
) {
return supportedPlatform;
}
}

error(
`Platform with type "${type}" and architecture "${architecture}" is not supported by ${name}.\nYour system must be one of the following:\n\n${cTable.getTable(
supportedPlatforms
)}`
);
};

const getBinary = () => {
const platformMetadata = getPlatformMetadata();
const url = `https://github.com/wokebuild/share/releases/download/v${version}/wokeshare-v${ version }-${ platformMetadata.RUST_TARGET }.tar.gz`;
return new Binary(platformMetadata.BINARY_NAME, url, version);
};

const run = () => {
const binary = getBinary();
binary.run();
};

const install = () => {
const binary = getBinary();
binary.install();
};

module.exports = {
install,
run
};
24 changes: 0 additions & 24 deletions npm/getBinary.js

This file was deleted.

6 changes: 4 additions & 2 deletions npm/install.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
const getBinary = require('./getBinary');
getBinary().install();
#!/usr/bin/env node

const { install } = require("./binary");
install();
Loading

0 comments on commit b928c26

Please sign in to comment.