Skip to content

Commit

Permalink
Merge branch 'master' of github.com:foundpatterns/torchbear
Browse files Browse the repository at this point in the history
  • Loading branch information
dariusc93 committed Feb 25, 2019
2 parents b8a8117 + 7617c2a commit 7a6f00a
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 33 deletions.
9 changes: 9 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,17 @@ To install Torchbear, run this command using your terminal ([what's a terminal?]
curl https://git.io/fpcV6 -sSfL | bash
```

Linux users need to give the install permissions to write files in `usr/local/bin` by running it as superuser, or run:


```sh
curl https://git.io/fpcV6 -sSfL | sudo bash
```

[The installer](https://github.com/foundpatterns/torchbear/blob/master/install.sh) automatically gets the latest version (which is also available on [Torchbear's GitHub releases page](https://github.com/foundpatterns/torchbear/releases)) and puts it in a convenient file location for you. To do this, it downloads the latest zip file for your operating system and hardware architecture, then it unzips the executable to a place where it will run as a command. You can do that manually or differently, as you like.

On install, the install script itself is installed in the system as `torchup`, subsequent updates or uninstalling can use that command.

#### What is a terminal?

If you haven't heard of a terminal before, here's a [1 min intro to what is a terminal window](https://www.youtube.com/watch?v=zw7Nd67_aFw). This works on Android, Windows, MacOS, and Linux devices very similarly, but you might need one other tool first:
Expand Down
53 changes: 20 additions & 33 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,7 @@ download_and_extract() {

if [ -x "$(command -v curl)" ]; then
curl -L $(get_url) -o temp.zip
case $(get_os) in
Linux | Darwin )
sudo unzip -o temp.zip -d $1
;;
* )
unzip -o temp.zip -d $1
;;
esac
unzip -o temp.zip -d $1
rm temp.zip
else
error "Curl is not installed. Please install curl. If curl is installed, check your path and try again"
Expand All @@ -115,7 +108,7 @@ install_machu_picchu () {
rm $TEMP
cd $DIR/mp-installer-master
case $(get_os) in
Linux | Darwin ) sudo torchbear;;
Linux | Darwin ) torchbear;;
* ) torchbear;;
esac
STATUS=$?
Expand All @@ -130,6 +123,8 @@ install_machu_picchu () {
else
error Machu Picchu install was unsuccesfull
fi

mp refresh
}

install_path() {
Expand Down Expand Up @@ -167,28 +162,26 @@ torchbear_path() {
uninstall_torchup() {
FILE=$(install_path)/torchup
if [ -f $FILE ]; then
sudo rm $FILE
rm $FILE
fi
}

uninstall_torchbear() {
if [ -f "$(torchbear_path)" ]; then
echo Uninstalling Torchbear.
case $(get_os) in
Linux | Darwin)
sudo rm $(torchbear_path)
;;
* )
rm $(torchbear_path)
;;
esac

rm $(torchbear_path)

if [ -f "$(torchbear_path)" ]; then
error Torchbear could not be uninstalled.
else
echo Torchbear is now uninstalled.
fi

sudo rm $(install_path)/speakeasy

if [ -f $(install_path)/speakeasy ]; then
rm $(install_path)/speakeasy
fi

uninstall_torchup
else
Expand All @@ -199,16 +192,10 @@ uninstall_torchbear() {
uninstall_mp() {
if [ -f "$(install_path)/mp" ]; then
echo Uninstalling machu picchu.
case $(get_os) in
Linux | Darwin)
sudo rm $(install_path)/mp
sudo rm -rf $(install_path)/machu-pichu
;;
* )
rm $(install_path)/mp
rm -rf $(install_path)/machu-pichu
;;
esac

rm $(install_path)/mp
rm -rf $(install_path)/machu-pichu

if [ -f "$(install_path)/mp" ]; then
error Machu Picchu could not be uninstalled.
else
Expand All @@ -221,8 +208,8 @@ uninstall_mp() {

install_torchup() {
URL=https://raw.githubusercontent.com/foundpatterns/torchbear/master/install.sh
sudo wget -O $1/torchup $URL
sudo chmod +x $1/torchup
wget -O $1/torchup $URL
chmod +x $1/torchup
echo Torchup has been installed
}

Expand All @@ -245,9 +232,9 @@ install_torchbear() {
download_and_extract $DIR

if [ -f $DIR/speakeasy ]; then
sudo rm $DIR/speakeasy
rm $DIR/speakeasy
fi
sudo ln -Ts $DIR/torchbear $DIR/speakeasy
ln -Ts $DIR/torchbear $DIR/speakeasy

if [ -f "$(torchbear_path)" ]; then
local version=($(echo $($(torchbear_path) -V)))
Expand Down

0 comments on commit 7a6f00a

Please sign in to comment.