This commit is contained in:
2025-02-03 12:37:19 +03:00
parent 1d6af5204b
commit c8d715126f
13 changed files with 143 additions and 67 deletions

View File

@@ -16,7 +16,7 @@ bash /tmp/install_v.sh --analyzer --herolib
```bash
#~/code/github/freeflowuniverse/herolib/install_v.sh --help
~/code/github/freeflowuniverse/herolib/install_v.sh --help
V & HeroLib Installer Script

View File

@@ -89,5 +89,6 @@ fn hero_upload() ! {
}
fn main() {
//os.execute_or_panic('${os.home_dir()}/code/github/freeflowuniverse/herolib/cli/compile.vsh -p')
hero_upload() or { eprintln(err) exit(1) }
}

View File

@@ -31,7 +31,7 @@ fn do() ! {
mut cmd := Command{
name: 'hero'
description: 'Your HERO toolset.'
version: '2.0.0'
version: '2.0.2'
}
// herocmds.cmd_run_add_flags(mut cmd)

77
install_hero.sh Executable file
View File

@@ -0,0 +1,77 @@
#!/bin/bash -e
set -e
os_name="$(uname -s)"
arch_name="$(uname -m)"
# Select the URL based on the platform
if [[ "$os_name" == "Linux" && "$arch_name" == "x86_64" ]]; then
url="https://f003.backblazeb2.com/file/threefold/linux-i64/hero"
elif [[ "$os_name" == "Darwin" && "$arch_name" == "arm64" ]]; then
url="https://f003.backblazeb2.com/file/threefold/macos-arm64/hero"
# elif [[ "$os_name" == "Darwin" && "$arch_name" == "x86_64" ]]; then
# url="https://f003.backblazeb2.com/file/threefold/macos-i64/hero"
else
echo "Unsupported platform."
exit 1
fi
if [[ "${OSNAME}" == "darwin"* ]]; then
[ -f /usr/local/bin/hero ] && rm /usr/local/bin/hero
fi
if [ -z "$url" ]; then
echo "Could not find url to download."
echo $urls
exit 1
fi
zprofile="${HOME}/.zprofile"
hero_bin_path="${HOME}/hero/bin"
temp_file="$(mktemp)"
# Check if ~/.zprofile exists
if [ -f "$zprofile" ]; then
# Read each line and exclude any that modify the PATH with ~/hero/bin
while IFS= read -r line; do
if [[ ! "$line" =~ $hero_bin_path ]]; then
echo "$line" >> "$temp_file"
fi
done < "$zprofile"
else
touch "$zprofile"
fi
# Add ~/hero/bin to the PATH statement
echo "export PATH=\$PATH:$hero_bin_path" >> "$temp_file"
# Replace the original .zprofile with the modified version
mv "$temp_file" "$zprofile"
# Ensure the temporary file is removed (in case of script interruption before mv)
trap 'rm -f "$temp_file"' EXIT
# Output the selected URL
echo "Download URL for your platform: $url"
# Download the file
curl -o /tmp/downloaded_file -L "$url"
# Check if file size is greater than 10 MB
file_size=$(du -m /tmp/downloaded_file | cut -f1)
if [ "$file_size" -ge 2 ]; then
# Create the target directory if it doesn't exist
mkdir -p ~/hero/bin
if [[ "$OSTYPE" == "darwin"* ]]; then
# Move and rename the file
mv /tmp/downloaded_file ~/hero/bin/hero
chmod +x ~/hero/bin/hero
else
mv /tmp/downloaded_file /usr/local/bin/hero
chmod +x /usr/local/bin/hero
fi
echo "Hero installed properly"
export PATH=$PATH:$hero_bin_path
hero -version
else
echo "Downloaded file is less than 10 MB. Process aborted."
exit 1
fi

View File

@@ -7,9 +7,9 @@ pub struct BuilderFactory {
}
pub fn new() !BuilderFactory {
mut c := base.context()!
mut bf := BuilderFactory{}
return bf
_ := base.context()!
mut bf := BuilderFactory{}
return bf
}
@[params]

View File

@@ -81,25 +81,25 @@ fn cmd_docusaurus_execute(cmd Command) ! {
// build_path: '/tmp/docusaurus_build'
)!
if build{
// Create a new docusaurus site
mut site := docs.build(
url:url
)!
}
if build{
// Create a new docusaurus site
_ := docs.build(
url:url
)!
}
if builddev{
// Create a new docusaurus site
mut site := docs.build_dev(
url:url
)!
}
if builddev{
// Create a new docusaurus site
_ := docs.build_dev(
url:url
)!
}
if dev{
// Create a new docusaurus site
mut site := docs.dev(
url:url
)!
}
if dev{
// Create a new docusaurus site
_ := docs.dev(
url:url
)!
}
}

View File

@@ -18,20 +18,19 @@ pub fn play_core(mut plbook playbook.PlayBook) ! {
session.interactive = p.get_default_false('interactive')
}
if p.exists('coderoot') {
panic('implement')
mut coderoot := p.get_path_create('coderoot')!
mut gs := gittools.get()!
}
if p.exists('coderoot') {
panic('implement')
// mut coderoot := p.get_path_create('coderoot')!
// mut gs := gittools.get()!
}
action.done = true
}
for mut action in plbook.find(filter: 'session.')! {
mut p := action.params
mut session := plbook.session
for mut action in plbook.find(filter: 'session.')! {
// mut p := action.params
// mut session := plbook.session
//!!session.env_set key:'JWT_SHARED_KEY' val:'...'
//!!session.env_set key:'JWT_SHARED_KEY' val:'...'
action.done = true
}

View File

@@ -26,15 +26,15 @@ pub fn play_doctree(mut plbook playbook.PlayBook) ! {
trees[name] = tree
}
for mut action in plbook.find(filter: 'doctree:add')! {
mut p := action.params
url := p.get_default('url', '')!
path := p.get_default('path', '')!
name := p.get('name')!
for mut action in plbook.find(filter: 'doctree:add')! {
mut p := action.params
// url := p.get_default('url', '')!
// path := p.get_default('path', '')!
name := p.get('name')!
mut tree := trees[name] or { return error('tree ${name} not found') }
_ := trees[name] or { return error('tree ${name} not found') }
// tree.scan(
// tree.scan(
// path: path
// git_url: url
// git_reset: reset
@@ -61,9 +61,9 @@ pub fn play_doctree(mut plbook playbook.PlayBook) ! {
}
for mut action in plbook.find(filter: 'doctree:export')! {
panic('implement')
mut p := action.params
name := p.get('name')!
action.done = true
panic('implement')
mut p := action.params
_ := p.get('name')!
action.done = true
}
}

View File

@@ -5,14 +5,15 @@ import freeflowuniverse.herolib.core.playbook
import os
pub fn play_luadns(mut plbook playbook.PlayBook) ! {
mut buildroot := '${os.home_dir()}/hero/var/mdbuild'
mut publishroot := '${os.home_dir()}/hero/www/info'
mut coderoot := ''
// mut install := false
mut reset := false
mut pull := false
// Variables below are not used, commenting them out
// mut buildroot := '${os.home_dir()}/hero/var/mdbuild'
// mut publishroot := '${os.home_dir()}/hero/www/info'
// mut coderoot := ''
// mut install := false
// mut reset := false
// mut pull := false
for mut action in plbook.find(filter: 'luadns.set_domain')! {
for mut action in plbook.find(filter: 'luadns.set_domain')! {
mut p := action.params
url := p.get_default('url', '')!

View File

@@ -50,8 +50,8 @@ fn install_() ! {
expand_dir := '/tmp/golang'
// the downloader is cool, it will check the download succeeds and also check the minimum size
dest := osal.download(
// the downloader is cool, it will check the download succeeds and also check the minimum size
_ := osal.download(
url: url
minsize_kb: 40000
expand_dir: expand_dir

View File

@@ -42,10 +42,8 @@ fn upload_() ! {
}
fn install_() ! {
console.print_header('install rust')
version := '1.83.0'
base.install()!
console.print_header('install rust')
base.install()!
pl := core.platform()!

View File

@@ -29,10 +29,10 @@ fn installed() !bool {
}
fn install() ! {
console.print_header('install garage_s3')
mut installer := get()!
// THIS IS EXAMPLE CODEAND NEEDS TO BE CHANGED
mut url := ''
console.print_header('install garage_s3')
//mut installer := get()!
// THIS IS EXAMPLE CODEAND NEEDS TO BE CHANGED
mut url := ''
if core.is_linux_arm()! {
url = 'https://github.com/garage_s3-dev/garage_s3/releases/download/v${version}/garage_s3_${version}_linux_arm64.tar.gz'
} else if core.is_linux_intel()! {
@@ -75,9 +75,9 @@ fn startupcmd() ![]zinit.ZProcessNewArgs {
}
fn running_() !bool {
mut installer := get()!
// THIS IS EXAMPLE CODEAND NEEDS TO BE CHANGED
// this checks health of garage_s3
_ := get()!
// THIS IS EXAMPLE CODEAND NEEDS TO BE CHANGED
// this checks health of garage_s3
// curl http://localhost:3333/api/v1/s --oauth2-bearer 1234 works
// url:='http://127.0.0.1:${cfg.port}/api/v1'
// mut conn := httpconnection.new(name: 'garage_s3', url: url)!

View File

@@ -159,9 +159,9 @@ pub mut:
}
pub fn (mut site DocSite) error(args ErrorArgs) {
path2 := pathlib.get(args.path)
e := SiteError{
path: args.path
// path2 := pathlib.get(args.path)
e := SiteError{
path: args.path
msg: args.msg
cat: args.cat
}