Skip to content

Commit

Permalink
update to generate binary
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthewNielsen27 committed Dec 21, 2018
1 parent d319bb4 commit ea04b36
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 70 deletions.
10 changes: 6 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
.PHONY: all exec test strap straps docs

all: exec straps docs test
all: exec straps binary docs test

exec:
@chmod u+x *.sh
@chmod u+x build/*.sh

test:
@shellcheck ./strapped.sh
@shellcheck ./strapped
@shellcheck ./straps/**/**/*.sh
@shellcheck ./build/*.sh

Expand All @@ -18,4 +17,7 @@ strap:
@./build/compiler.sh ${yml}

straps:
@./build/straps.sh
@./build/straps.sh

binary:
@./build/binary.sh
2 changes: 1 addition & 1 deletion _static/_stay/index.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
curl -s -L https://raw.githubusercontent.com/azohra/strapped.sh/0.1.0/strapped.sh --output /usr/local/bin/strapped
curl -s -L https://raw.githubusercontent.com/azohra/strapped.sh/0.1.1/strapped --output /usr/local/bin/strapped
chmod u+x /usr/local/bin/strapped
echo "🔫 #StayStrapped"
9 changes: 6 additions & 3 deletions build/binary.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
cat src/helpers.sh > aaa.sh
cat src/cli.sh >> aaa.sh
cat src/main.sh >> aaa.sh
#!/bin/bash

# Copy components and put them into final file
cat src/helpers.sh > strapped
cat src/cli.sh >> strapped
cat src/main.sh >> strapped
121 changes: 59 additions & 62 deletions strapped.sh → strapped
Original file line number Diff line number Diff line change
Expand Up @@ -43,67 +43,6 @@ run_command() {
fi
}

function usage {
echo -e "\\nUsage: strapped [flags]\\n"
echo "flags:"
echo " -u, --upgrade upgrade strapped to the latest version"
echo " -v, --version print the current strapped version"
echo " -a, --auto do not prompt for confirmation"
echo " -y, --yml file/url path to a valid strapped yml config"
echo " -l, --lint exits after reading config file"
echo " -s, --straps string run a subset of your config. Comma seperated."
echo " -h, --help prints this message"
exit 1
}

function upgrade {
rm /usr/local/bin/strapped
curl -s https://stay.strapped.sh | sh
pretty_print ":announce:" "Strapped::Upgraded Successfully!"
exit 0
}

while [ $# -gt 0 ] ; do
case "$1" in
-d|--debug)
STRAPPED_DEBUG="true"
;;
-u|--upgrade)
upgrade
;;
-y|--yml)
yml_location="$2"
shift # extra value
;;
-l|--lint)
# init_parser
ysh "${2}" > /dev/null
exit $?
;;
-r|--repo)
base_repo="$2"
shift # extra value
;;
-s|--straps)
custom_straps="$2"
shift # extra value
;;
-a|--auto)
auto_approve="true"
;;
-v|--version)
echo 'v0.1.0' && exit 0
;;
-h|--help)
usage
;;
-*)
"Unknown option: '$1'"
;;
esac
shift
done

parse_config() {
# Check for YML
if [[ "${yml_location}" =~ ${url_regex} ]]; then config=$(curl -s "${yml_location}" | ysh ); else config=$(ysh -f "${yml_location}"); fi
Expand Down Expand Up @@ -164,8 +103,66 @@ stay_strapped () {
strapped_"${strap}" "${strap_config}"
done
}
function usage {
echo -e "\\nUsage: strapped [flags]\\n"
echo "flags:"
echo " -u, --upgrade upgrade strapped to the latest version"
echo " -v, --version print the current strapped version"
echo " -a, --auto do not prompt for confirmation"
echo " -y, --yml file/url path to a valid strapped yml config"
echo " -l, --lint exits after reading config file"
echo " -s, --straps string run a subset of your config. Comma seperated."
echo " -h, --help prints this message"
exit 1
}

function upgrade {
rm /usr/local/bin/strapped
curl -s https://stay.strapped.sh | sh
pretty_print ":announce:" "Strapped::Upgraded Successfully!"
exit 0
}

# init_parser
while [ $# -gt 0 ] ; do
case "$1" in
-d|--debug)
STRAPPED_DEBUG="true"
;;
-u|--upgrade)
upgrade
;;
-y|--yml)
yml_location="$2"
shift # extra value
;;
-l|--lint)
# init_parser
ysh "${2}" > /dev/null
exit $?
;;
-r|--repo)
base_repo="$2"
shift # extra value
;;
-s|--straps)
custom_straps="$2"
shift # extra value
;;
-a|--auto)
auto_approve="true"
;;
-v|--version)
echo 'v0.1.0' && exit 0
;;
-h|--help)
usage
;;
-*)
"Unknown option: '$1'"
;;
esac
shift
done
parse_config
parse_strapped_repo
create_strap_array
Expand Down

0 comments on commit ea04b36

Please sign in to comment.