Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions chili-recipe.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,18 @@ Ingredients:
- 2 cloves garlic, chopped
- One 8-ounce can tomato sauce
- 2 tablespoons chili powder
- 1 teaspoon ground cumin
- 1 teaspoon ground oregano
- 1 teaspoon salt
- 1/4 teaspoon cayenne pepper
- 1/4 cup corn flour
- One 15-ounce can kidney beans, drained and rinsed
- One 15-ounce can pinto beans, drained and rinsed
- One teaspoon pepper

Directions:
1. Brown the ground beef in a large bot and drain off the excess fat.
2. Add the tomato sauce, chili powder, cumin, oregano, salt, and cayenne.
2. Add the tomato sauce, chili powder, oregano, salt, and cayenne.
3. Stir, then cover and simmer over low heat for one hour.
4. Mix the corn flour and 1/2 cup water in a small bowl. Add to chili.
5. Add the beans and simmer for 10 more minutes.
6. Add pepper to the finished meal
1 change: 1 addition & 0 deletions persian-roulet.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
I have no clue how to make it, I just really like when my grandparents make it
90 changes: 90 additions & 0 deletions sarah_changes.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# Make sure that exactly one argument was given
if [ $# -ne 1 ]; then
if [ $# -gt 1 ]; then
echo "$0: Got more arguments than expected. Expected exactly 1."
else
echo "$0: Did not receive enough arguments. Expected exactly 1."
fi

echo "Usage: bash $0 <GitHub url>"
exit
fi

# Save remote url
remote_url="$1"

clean_up() {
temp_dir_name="$1"
orig_dir_name="$2"

cd "$orig_dir_name"
rm -rf "$temp_dir_name"
exit
}

# Create a temporary directory to collaborate in
temp_dir_name="recipes-$$"
orig_dir_name=`pwd`
repo_name="recipes"

mkdir "$temp_dir_name"
if [ $? -ne 0 ]; then
echo ""
echo "ERROR: Failed to create temporary directory. Try using cd to" \
"switch to an empty directory, then try again."
exit
fi

# Switch to the temporary directory and clone the remote repository
cd "$temp_dir_name"
git clone "$remote_url" "$repo_name"
if [ $? -ne 0 ]; then
echo ""
echo "ERROR: Could not connect to remote repo \"$remote_url\"." \
" Double-check the url you entered."
clean_up "$temp_dir_name" "$orig_dir_name"
fi
cd "$repo_name"

# Make sure the repository is in the expected state
if [ ! -f chili-recipe.txt ]; then
echo ""
echo "ERROR: Specified remote repository does not contain" \
"chili-recipe.txt. Please check the state of your fork on GitHub. " \
"Right now, your fork should have the same commit history as Larry's" \
"repository."
clean_up "$temp_dir_name" "$orig_dir_name"
elif [ `grep "cumin" chili-recipe.txt | wc -l` -eq 0 ]; then
echo ""
echo "WARNING: chili-recipe.txt in the remote repository does not contain" \
"\"cumin\". Please check the state of your fork on GitHub. If you've" \
"already run this code successfully, you should see the same commit history" \
"as Larry's repository, followed by a commit by Sarah removing cumin. Otherwise," \
"your fork should have the same commit history as Larry's repository."
clean_up "$temp_dir_name" "$orig_dir_name"
elif [ `grep "cumin" chili-recipe.txt | wc -l` -ne 2 ]; then
echo ""
echo "ERROR: chili-recipe.txt in the remote repository should contain" \
"exactly two occurrences of \"cumin\", but it does not. Please check" \
"the state of your fork on GitHub. Right now, your fork should have" \
"the same commit history as Larry's repository."
clean_up "$temp_dir_name" "$orig_dir_name"
fi

# Configure only this directory to make Sarah the committer
git config user.name "Sarah Spikes"
git config user.email "sarah+github@udacity.com"

# Remove cumin from the chili recipe
sed '/ground cumin/d' chili-recipe.txt > chili-recipe-$$.txt
mv chili-recipe-$$.txt chili-recipe.txt
sed 's/, cumin//' chili-recipe.txt > chili-recipe-$$.txt
mv chili-recipe-$$.txt chili-recipe.txt

# Commit and push changes
git add chili-recipe.txt
git commit -m "Remove cumin from chili"
git push origin master

# Cleanup
clean_up "$temp_dir_name" "$orig_dir_name"