I have done the project 0.1 release and send
David the pull request (https://github.com/humphd/filer/pull/5)
today. Project 0.1 release was to add
the du command to filer project. Following project instruction, I did not have
much difficulties to finish it.
First of all, I got the code and had my github
ready by forking filer to my github account and coloning it to my local
computer.
Then I installed the node.js in order to have npm
package installer in my computer.
Next, following the instruction to install the
grunt both locally in project (filer) folder and globally in my computer. At
this step, I had the trouble to install grunt locally with the errors during
the installation. After discuss with the classmate, I found out that I need use
Linux command line instead of Windows command line to run the command “npm
install”. Then I used git bash to run this command, and it turned out that
installation was successful eventually.
Following, I run “grunt test” to test the code. I
met the problems as well here. After asking David, it was resolved by updating to
the latest code. The problem I met was just solved and updated quite recently,
and I had not updated my code yet.
At this point, I had all the required
environment ready. Then I started to write the code. I reviewed the code for
cat command and ls command because du command has the similarity with these two
commands. Both du and cat commands have two parameters – data and callback. And
both du and ls commands need to return deep content of a directory tree, and
have the file size, file path and file content. Having the reference to these
two blocks of code, I built du command without much difficulties. There were 5
files that needed to be modified and/or added. They were:
- MODIFY: /README.md
- MODIFY: /test/index.js
- MODIFY: /src/shell/shell.js
- MODIFY: /dist/filer.js
- ADD: /test/spec/shell/du.spec.js
At last, it passed the test with no error.