Skip to content

Commit

Permalink
test and cleanup user metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
Myles Byrne committed Sep 5, 2014
1 parent 3e43b2b commit 1bbe9cc
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 32 deletions.
30 changes: 17 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,19 @@ the system has 2 parts:
> this system is invoked every time a student runs the ruby interpreter at the console
```text
+------------+
| ruby-shim |
+---+---+----+----> STDOUT \
| | |--> typical student experience
| (T)+-------> STDERR /
| |
| +----------------------> /tmp/ruby-runs/stderr.1234
|
+---> create-metadata.sh
/realtime \
+------------+
| ruby-shim |
+---+---+----+----> STDOUT \
| | |--> typical student experience
| (T)+-------> STDERR /
| |
| +----------------------> /tmp/ruby-runs/stderr.1234
|
+---> create-metadata.sh
/realtime \
- git.sh |--> /tmp/ruby-runs/metadata.1234
- machine.sh /
- machine.sh /
```
notes:
Expand Down Expand Up @@ -88,14 +88,18 @@ notes:

*am i missing anyone?*

### testing

the `test` folder has a bunch of scripts that will invoke the individual modules with dummy data. they're technically not "tests" because they don't have any assertions. use these scripts during development.

### project history

**August 20 - August 25**

re-write:
- to address some of the major issues with the first version
- to rename the project
- for me to practice writing shell scripts
- for me to practice writing shell scripts
- for me to practice using git and github

**July 30 - August 20**
Expand Down
26 changes: 7 additions & 19 deletions metadata/realtime/user.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,9 @@
# We could also capture git usernames with something like
# git config --global --get-all github.username
echo "email:" $(git config --global --get user.email)

# Grab pair names
pair_names="$(git config --global user.name)"
# exit unless the github.username field is set in the git conf
git config --global --get github.username > /dev/null || exit

# Store IFS to split string on custom character then restore IFS
oIFS=$IFS; IFS='&'; names=($pair_names); IFS=$oIFS

# Grab pair accounts
pair_github="$(git config --global user.email | sed -e s/^.*\+// -e s/@.*$//)"
github=(${pair_github//./ })


echo "pair:"
echo " user-a:"
echo " name:" "${names[0]}"
echo " github:" "${github[0]}"
echo " user-b:"
echo " name:" "${names[1]}"
echo " github:" "${github[1]}"
echo "github_usernames:"
git config --global --get-all github.username | while read github_username ; do
echo "-" $github_username
done
6 changes: 6 additions & 0 deletions test/.gitconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[user]
email = [email protected]

[github]
username = bob
username = jane
12 changes: 12 additions & 0 deletions test/user-metadata
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh

set -e

# ensure we're in the parent directory of this file
cd $(dirname $0)/..

# There's a .gitconfig file in this folder for this test so we pretend
# this folder is $HOME causing git to read that config
export HOME='./test'

sh metadata/realtime/user.sh

0 comments on commit 1bbe9cc

Please sign in to comment.