Skip to content

Commit

Permalink
add a few more methods and the notes for the first lab
Browse files Browse the repository at this point in the history
Signed-off-by: Justin Pflueger <[email protected]>
  • Loading branch information
Justin Pflueger committed Oct 17, 2023
1 parent b0cdbd3 commit 5dcb826
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 4 deletions.
15 changes: 13 additions & 2 deletions labs/01-new-app/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
# Lab 1 - New App
### Lab1 - My First Spin App

TODO
- Choose one of the following languages to complete this lab: Rust, Javascript, Typescript, Go, Python.
- [ ] Use help functionality
- [ ] Discover which templates are installed
- [ ] Used template for preferred language to create a new app called lab1
- [ ] The base path should be “/”
- [ ] The path for this component should be /api/…
- [ ] Rename the component from lab1 to api
- [ ] Modify the code to return “This is Lab 1”
- [ ] Add a response header “lab” set to “1”
- [ ] Run spin build
- [ ] Run spin up and navigate to the provided URL to see it’s working locally
- [ ] Run “check lab1” at the command line to validate your work
24 changes: 22 additions & 2 deletions labs/labs-cli.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/zsh
#!/usr/bin/env bash

#TODO: would it make more sense to do this in something like JS or Python?

Expand All @@ -24,9 +24,15 @@ labs() {
show)
__labs_show
;;
setup)
__labs_setup
;;
check)
__labs_check
;;
solve)
__labs_solve
;;
-h|--help)
__labs_usage
;;
Expand All @@ -44,9 +50,11 @@ __labs_usage() {
echo " -h, --help Show help"
echo ""
echo "Commands:"
echo " show Shows the current in-progress lab"
echo " list List available labs"
echo " show Shows the current in-progress lab"
echo " setup Sets up the current in-progress lab"
echo " check Checks the current in-progress lab"
echo " solve Solves the current in-progress lab"
}

__labs_show() {
Expand All @@ -67,12 +75,24 @@ __labs_list() {
echo "-------------------------------------------------------------------------------------------------------"
}

__labs_setup() {
local lab="$(__labs_current)"
__lab_get "$lab"
lab-${lab_number}-setup
}

__labs_check() {
local lab="$(__labs_current)"
__lab_get "$lab"
lab-${lab_number}-check
}

__labs_solve() {
local lab="$(__labs_current)"
__lab_get "$lab"
lab-${lab_number}-solve
}

__labs_current() {
for lab in $(ls -d $__LABS_DIR/*/); do
if [ ! -f $lab/.completed ]; then
Expand Down

0 comments on commit 5dcb826

Please sign in to comment.