From 6f9d9b427ea8d90347fdb71438aee0239b303c83 Mon Sep 17 00:00:00 2001
From: Andy Kleinhesselink
Date: Mon, 28 Aug 2017 12:57:54 -0700
Subject: [PATCH 1/5] Fixing minor typos in the text of the online lesson.
Episode 04: changed dash in file name to underscore to match file names in
code. Episode 09: changed mispelling of conforms.
---
episodes/04-dependencies.md | 4 ++--
episodes/09-conclusion.md | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/episodes/04-dependencies.md b/episodes/04-dependencies.md
index cef351fc..8e8974c9 100644
--- a/episodes/04-dependencies.md
+++ b/episodes/04-dependencies.md
@@ -216,10 +216,10 @@ downstream steps.
> {: .solution}
{: .challenge}
-We still have to add the `zipf-test.py` script as dependency to
+We still have to add the `zipf_test.py` script as dependency to
`results.txt`. Given the answer to the challenge above, we cannot use
`$^` in the rule.
-We can however move `zipf-test.py` to be the
+We can however move `zipf_test.py` to be the
first dependency and then use `$<` to refer to it.
In order to refer to the `.dat` files, we can just use `*.dat` for now (we will
cover a better solution later on).
diff --git a/episodes/09-conclusion.md b/episodes/09-conclusion.md
index a79d082b..af7371e1 100644
--- a/episodes/09-conclusion.md
+++ b/episodes/09-conclusion.md
@@ -36,7 +36,7 @@ papers.
> target]({{ page.root }}/reference/#phony-target) called `all` as first target,
> that will build what the Makefile has been written to build (e.g. in
> our case, the `.png` files and the `results.txt` file). As others
-> may assume your Makefile confirms to convention and supports an
+> may assume your Makefile conforms to convention and supports an
> `all` target, add an `all` target to your Makefile (Hint: this rule
> has the `results.txt` file and the `.png` files as dependencies, but
> no actions). With that in place, instead of running `make
From 974cefbef4a5b472716c9b9e65b773faf74d938d Mon Sep 17 00:00:00 2001
From: Andy Kleinhesselink
Date: Tue, 29 Aug 2017 11:14:10 -0700
Subject: [PATCH 2/5] Change to text of the archiving exercise in chapter 09.
Adding more rationale for the creation of an archive and how it will be used.
This will help students with this final exercise by giving them context. In
addition this commit changes the Makefile solution for this exercise. Here
are the changes, 1) copy files using rsync which moves books into a books
directory in the archive folder, 2) rm the archive folder once the
archive.tar.gz file is created. This avoids leaving two copies of your files
in one directory which seems like it could lead to confusion.
---
code/09-conclusion-challenge-2/Makefile | 5 +++--
episodes/09-conclusion.md | 27 ++++++++++++++++++-------
2 files changed, 23 insertions(+), 9 deletions(-)
diff --git a/code/09-conclusion-challenge-2/Makefile b/code/09-conclusion-challenge-2/Makefile
index a8511119..32b9e1a7 100644
--- a/code/09-conclusion-challenge-2/Makefile
+++ b/code/09-conclusion-challenge-2/Makefile
@@ -13,12 +13,13 @@ all : $(ZIPF_ARCHIVE)
$(ZIPF_ARCHIVE) : $(ZIPF_DIR)
tar -czf $@ $<
+ rm -rf $(ZIPF_DIR)
$(ZIPF_DIR): Makefile config.mk $(RESULTS_FILE) \
- $(DAT_FILES) $(PNG_FILES) \
+ $(DAT_FILES) $(PNG_FILES) $(TXT_FILES) \
$(COUNT_SRC) $(PLOT_SRC) $(ZIPF_SRC)
mkdir -p $@
- cp $^ $@
+ rsync -Rr $^ $@/
touch $@
## results.txt : Generate Zipf summary table.
diff --git a/episodes/09-conclusion.md b/episodes/09-conclusion.md
index af7371e1..e8c685f2 100644
--- a/episodes/09-conclusion.md
+++ b/episodes/09-conclusion.md
@@ -57,12 +57,25 @@ The following figure shows the dependencies involved in building the `all` targe
> ## Creating an Archive
>
-> Add new rules, update existing rules, and add new macros to:
+> Often it is useful to create an archive file of your project that includes all data, code,
+> and results. An archive file can packages many files into a single file that can easily be shared
+> with collaborators or downloaded as a single file. We can add steps to create the archive
+> file inside the Makefile itself so it's easy to update our archive file as the project changes.
+>
+>
+> Edit the Makefile to create an archive file of your project. Add new rules, update existing
+> rules, and add new macros to:
>
-> * Define the name of a directory, `zipf_analysis`, to hold all our
-> code, data, plots and the Zipf summary table.
+> * Create a new directory called `zipf_analysis` in the project directory.
> * Copy all our code, data, plots and the Zipf summary table to this
-> directory.
+> directory. The rsync command can be used to copy files and their
+> parent directories into the new `zipf_analysis` directory:
+>
+> ~~~
+> $ rsync -Rr [files to copy] zipf_analysis/
+> ~~~
+> {: .bash}
+>
> * Create an archive, `zipf_analysis.tar.gz`, of this directory. The
> bash command `tar` can be used, as follows:
>
@@ -70,10 +83,10 @@ The following figure shows the dependencies involved in building the `all` targe
> $ tar -czf zipf_analysis.tar.gz zipf_analysis
> ~~~
> {: .bash}
->
+>
+> * Remove the `zipf_analysis` directory once the `zipf_analysis.tar.gz` file has been created.
> * Update `all` to create `zipf_analysis.tar.gz`.
-> * Remove `zipf_analysis` and `zipf_analysis.tar.gz` when `make
-> clean` is called.
+> * Remove `zipf_analysis.tar.gz` when `make clean` is called.
> * Print the values of any additional variables you have defined when
> `make variables` is called.
>
From 4288e07f6d4cb915068915a0d9c7e89013130ee4 Mon Sep 17 00:00:00 2001
From: Andy Kleinhesselink
Date: Wed, 30 Aug 2017 11:05:15 -0700
Subject: [PATCH 3/5] Edit 09-challenge-2 and fix solution Makefile
Add text to motivate challenge 2 in episode 09. This helps explain the
purpose of making an archive file.
Add text to give more detailed instructions on how to solve the
challenge. There are a lot of steps in this challenge!
Fix the `books` directory not being copied into the archive file
correctly in the solution.
Issue: #105
Pull request review: #106
---
code/09-conclusion-challenge-2/Makefile | 15 ++++++++-------
episodes/09-conclusion.md | 18 ++++++++++--------
2 files changed, 18 insertions(+), 15 deletions(-)
diff --git a/code/09-conclusion-challenge-2/Makefile b/code/09-conclusion-challenge-2/Makefile
index 32b9e1a7..20a15d00 100644
--- a/code/09-conclusion-challenge-2/Makefile
+++ b/code/09-conclusion-challenge-2/Makefile
@@ -1,8 +1,9 @@
include config.mk
-TXT_FILES=$(wildcard books/*.txt)
-DAT_FILES=$(patsubst books/%.txt, %.dat, $(TXT_FILES))
-PNG_FILES=$(patsubst books/%.txt, %.png, $(TXT_FILES))
+TXT_DIR=books
+TXT_FILES=$(wildcard $(TXT_DIR)/*.txt)
+DAT_FILES=$(patsubst $(TXT_DIR)/%.txt, %.dat, $(TXT_FILES))
+PNG_FILES=$(patsubst $(TXT_DIR)/%.txt, %.png, $(TXT_FILES))
RESULTS_FILE=results.txt
ZIPF_DIR=zipf_analysis
ZIPF_ARCHIVE=$(ZIPF_DIR).tar.gz
@@ -13,13 +14,12 @@ all : $(ZIPF_ARCHIVE)
$(ZIPF_ARCHIVE) : $(ZIPF_DIR)
tar -czf $@ $<
- rm -rf $(ZIPF_DIR)
$(ZIPF_DIR): Makefile config.mk $(RESULTS_FILE) \
- $(DAT_FILES) $(PNG_FILES) $(TXT_FILES) \
+ $(DAT_FILES) $(PNG_FILES) $(TXT_DIR) \
$(COUNT_SRC) $(PLOT_SRC) $(ZIPF_SRC)
mkdir -p $@
- rsync -Rr $^ $@/
+ cp -r $^ $@
touch $@
## results.txt : Generate Zipf summary table.
@@ -30,7 +30,7 @@ $(RESULTS_FILE) : $(DAT_FILES) $(ZIPF_SRC)
.PHONY : dats
dats : $(DAT_FILES)
-%.dat : books/%.txt $(COUNT_SRC)
+%.dat : $(TXT_DIR)/%.txt $(COUNT_SRC)
$(COUNT_EXE) $< $@
## pngs : Plot word counts.
@@ -52,6 +52,7 @@ clean :
## variables : Print variables.
.PHONY : variables
variables:
+ @echo TXT_DIR: $(TXT_DIR)
@echo TXT_FILES: $(TXT_FILES)
@echo DAT_FILES: $(DAT_FILES)
@echo PNG_FILES: $(PNG_FILES)
diff --git a/episodes/09-conclusion.md b/episodes/09-conclusion.md
index 1ab3e9f3..5b29e221 100644
--- a/episodes/09-conclusion.md
+++ b/episodes/09-conclusion.md
@@ -26,7 +26,7 @@ papers.
> ## Creating PNGs
>
-> Add new rules, update existing rules, and add new macros to:
+> Add new rules, update existing rules and add new variables to:
>
> * Create `.png` files from `.dat` files using `plotcount.py`.
> * Remove all auto-generated files (`.dat`, `.png`,
@@ -63,19 +63,21 @@ The following figure shows the dependencies involved in building the `all` targe
> file inside the Makefile itself so it's easy to update our archive file as the project changes.
>
>
-> Edit the Makefile to create an archive file of your project. Add new rules, update existing
-> rules, and add new macros to:
+> Edit the Makefile to create an archive file of your project. Add new rules update existing
+> rules, and add new variables to:
>
> * Create a new directory called `zipf_analysis` in the project directory.
> * Copy all our code, data, plots and the Zipf summary table to this
-> directory. The rsync command can be used to copy files and their
-> parent directories into the new `zipf_analysis` directory:
+> directory. The `cp -r` command can be used to copy files and directories
+> into the new `zipf_analysis` directory:
>
> ~~~
-> $ rsync -Rr [files to copy] zipf_analysis/
+> $ cp -r [files and directories to copy] zipf_analysis/
> ~~~
> {: .bash}
>
+> * Hint: create a new variable for the `books` directory so that it can be
+> copied to the new `zipf_analysis` directory
> * Create an archive, `zipf_analysis.tar.gz`, of this directory. The
> bash command `tar` can be used, as follows:
>
@@ -84,7 +86,6 @@ The following figure shows the dependencies involved in building the `all` targe
> ~~~
> {: .bash}
>
-> * Remove the `zipf_analysis` directory once the `zipf_analysis.tar.gz` file has been created.
> * Update `all` to create `zipf_analysis.tar.gz`.
> * Remove `zipf_analysis.tar.gz` when `make clean` is called.
> * Print the values of any additional variables you have defined when
@@ -99,7 +100,8 @@ The following figure shows the dependencies involved in building the `all` targe
> ## Archiving the Makefile
>
-> Why does the Makefile rule for the archive directory add the Makefile to our archive of code, data, plots and Zipf summary table?
+> Why does the Makefile rule for the archive directory add the Makefile to our archive of code,
+> data, plots and Zipf summary table?
>
> > ## Solution
> > Our code files (`wordcount.py`, `plotcount.py`, `zipf_test.py`) implement
From c04f1be4a529630d20bfbe7d62034f413059a5e2 Mon Sep 17 00:00:00 2001
From: Andy Kleinhesselink
Date: Wed, 30 Aug 2017 11:38:56 -0700
Subject: [PATCH 4/5] Edit text for episode-09-challenge2
Minor edits to improve wording and fix typo.
Issue: #105
---
episodes/09-conclusion.md | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/episodes/09-conclusion.md b/episodes/09-conclusion.md
index 5b29e221..2dc70bd9 100644
--- a/episodes/09-conclusion.md
+++ b/episodes/09-conclusion.md
@@ -58,13 +58,13 @@ The following figure shows the dependencies involved in building the `all` targe
> ## Creating an Archive
>
> Often it is useful to create an archive file of your project that includes all data, code,
-> and results. An archive file can packages many files into a single file that can easily be shared
-> with collaborators or downloaded as a single file. We can add steps to create the archive
-> file inside the Makefile itself so it's easy to update our archive file as the project changes.
+> and results. An archive file can packages many files into a single file that can easily be
+> downloaded and shared with collaborators. We can add steps to create the archive file inside
+> the Makefile itself so it's easy to update our archive file as the project changes.
>
>
-> Edit the Makefile to create an archive file of your project. Add new rules update existing
-> rules, and add new variables to:
+> Edit the Makefile to create an archive file of your project. Add new rules, update existing
+> rules and add new variables to:
>
> * Create a new directory called `zipf_analysis` in the project directory.
> * Copy all our code, data, plots and the Zipf summary table to this
From 7cd53a50ddf4402603e723250385317d7bc3b650 Mon Sep 17 00:00:00 2001
From: Andy Kleinhesselink
Date: Wed, 30 Aug 2017 11:45:07 -0700
Subject: [PATCH 5/5] Fixing typo in episode-09-challenge2 #105
---
episodes/09-conclusion.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/episodes/09-conclusion.md b/episodes/09-conclusion.md
index 2dc70bd9..9a059fec 100644
--- a/episodes/09-conclusion.md
+++ b/episodes/09-conclusion.md
@@ -57,8 +57,8 @@ The following figure shows the dependencies involved in building the `all` targe
> ## Creating an Archive
>
-> Often it is useful to create an archive file of your project that includes all data, code,
-> and results. An archive file can packages many files into a single file that can easily be
+> Often it is useful to create an archive file of your project that includes all data, code
+> and results. An archive file can package many files into a single file that can easily be
> downloaded and shared with collaborators. We can add steps to create the archive file inside
> the Makefile itself so it's easy to update our archive file as the project changes.
>