rife2 / bld

Pure java build tool for developers who don't like dealing with build tools
https://rife2.com/bld
Apache License 2.0
238 stars 13 forks source link

installation guide could also show curl-to-invoke way #22

Closed paul-hammant closed 8 months ago

paul-hammant commented 8 months ago

E.g.

## To create a project interactively with no prior installation of bld ...
curl -L https://github.com/rife2/bld/releases/download/1.8.0/bld-1.8.0.jar -o ./deleteme.jar && java -jar ./deleteme.jar create && rm ./deleteme.jar

Maybe that spits out: run './bld updates' to update bld itself in case you bootstrapped an older version by accident

ethauvin commented 8 months ago

@paul-hammant How about turning it into an install-type script that can be fetched/executed?

Something like:

#!/bin/sh

version=$(curl -Ls -o /dev/null -w "%{url_effective}" https://github.com/rife2/bld/releases/latest)
version=${version##*/}

curl -L https://github.com/rife2/bld/releases/download/$version/bld-$version.jar -o ./deleteme.jar

java -jar ./deleteme.jar create

rm -f ./deleteme.jar
paul-hammant commented 8 months ago

Oneliners are the high bar, dude :)

If y'all moved site hosting off GitHub-Pages onto netlify you can program 302 style redirects - https://docs.netlify.com/routing/redirects - cos curl can follow those but not html-meta or JS redirects unfortunately. It's a shame that curl doesn't make its own redirect mime-type that'd become a defacto standard.

.. that'd allow you to get back to the oneliner. And Netlify has a free provision too :)

ethauvin commented 8 months ago

@paul-hammant You're overthinking it. ;-)

The oneliner for executing the script would be so simple:

curl -s https://raw.githubusercontent.com/rife2/bld/scripts/create.sh | bash
paul-hammant commented 8 months ago

Yeah, you're right

ethauvin commented 8 months ago

@gbevin Thoughts?

gbevin commented 8 months ago

Any additional way to install it works for me

gbevin commented 8 months ago

I would host this on the main website though: curl -s https://rife2.com/bld/create.sh | bash

ethauvin commented 8 months ago

I would host this on the main website though: curl -s https://rife2.com/bld/create.sh | bash

I'll add it to this repo, and you can put it on the website.

BTW, you may have to change the mine-type for shell scripts to text/plain.

gbevin commented 8 months ago

I'm rewriting the script :-)

gbevin commented 8 months ago

Well not rewriting, making some improvements

ethauvin commented 8 months ago

Well not rewriting, making some improvements

If you're adding a bunch of ifs, etc. make sure they are sh compatible, not bash. Use shellcheck.

gbevin commented 8 months ago

https://github.com/rife2/bld/commit/7e44493866c95ffbce43bee4ae0a38c848e28b2e

ethauvin commented 8 months ago

Looks good, if you don't mind the echo noise pollution. :->

gbevin commented 8 months ago

I think it's important that people know what is happening, just throwing them into the create prompt feels very jarring

gbevin commented 8 months ago

curl -Ls https://rife2.com/bld/create.sh | bash curl -Ls https://rife2.com/bld/upgrade.sh | bash

I made NGINX do a redirect to the raw GitHub file so that we can still easily tweak it.

This brings out that stdin issue though, because when I run the scripts locally I get the interactive prompt, when I pipe to bash, I don't.

ethauvin commented 8 months ago

I think it's important that people know what is happening, just throwing them into the create prompt feels very jarring

Yeah, it's fine. I didn't add the jar to the temp dir, because I thought that if people canceled the creation, they would still have the jar in the current directory. But in retrospect that would be confusing.

One issue that might arise, is that if they cancel, the temp jar will not be deleted. That might cause problem am issue with curl the next time around. It'd be best to use a redirection:

curl -L -s "https://github.com/rife2/bld/releases/download/$version/bld-$version.jar" > "$filepath"

gbevin commented 8 months ago

Good point, fixed

gbevin commented 8 months ago

This does it

/bin/bash -c "$(curl -Ls https://rife2.com/bld/create.sh)" /bin/bash -c "$(curl -Ls https://rife2.com/bld/upgrade.sh)"

gbevin commented 8 months ago

Or even better:

/bin/bash -c "$(curl -fsSL https://rife2.com/bld/create.sh)" /bin/bash -c "$(curl -fsSL https://rife2.com/bld/upgrade.sh)"

gbevin commented 8 months ago

I think we can add that to the wiki now, agreed?

ethauvin commented 8 months ago

Or even better:

/bin/bash -c "$(curl -fsSL https://rife2.com/bld/create.sh)" /bin/bash -c "$(curl -fsSL https://rife2.com/bld/upgrade.sh)"

Not for me:

❯ bash -c "$(curl -fsSL https://rife2.com/bld/create.sh)"
mktemp: too few X's in template ‘bld-1.8.0.jar’
Downloading bld v1.8.0...

bash: line 10: : No such file or directory
Welcome to bld v1.8.0.
Error: Unable to access jarfile 
gbevin commented 8 months ago

Oh man exs have always been a pain! ;-)

gbevin commented 8 months ago

Try now

ethauvin commented 8 months ago

Oh man exs have always been a pain! ;-)

Not quite sure your ex-girlfriend would agree, since she's now your wife. ;-)

gbevin commented 8 months ago

Ah, no, she's my wife AND my girlfriend :-)

ethauvin commented 8 months ago

Try now

Yup, I guess we found the same StackExchange answer.

gbevin commented 8 months ago

Actually I read the mktemp man page on Linux and macOS and tried it out on both machines :-)

ethauvin commented 8 months ago

Ah, no, she's my wife AND my girlfriend :-)

Sure, try introducing her as your girlfriend, see how well that goes. :-D

gbevin commented 8 months ago

Oh I wrote AND, not OR :-D

ethauvin commented 8 months ago

Oh I wrote AND, not OR :-D

It'll be cute the first time…

ethauvin commented 8 months ago

Or even better:

/bin/bash -c "$(curl -fsSL https://rife2.com/bld/create.sh)" /bin/bash -c "$(curl -fsSL https://rife2.com/bld/upgrade.sh)"

Let's not include /bin/ in the documentation as bash could be in /usr/bin/, /usr/local/bin/, etc.

gbevin commented 8 months ago

Good point

gbevin commented 8 months ago

Added