diff --git a/README.rdoc b/README.rdoc index 121228b..93e4bc8 100644 --- a/README.rdoc +++ b/README.rdoc @@ -8,9 +8,9 @@ and do great things in the language. == The Structure -The koans are broken out into areas by file, hashes are covered in about_hashes.rb, -modules are introduced in about_modules.rb, etc. They are presented in order in the -path_to_enlightenment.rb file. +The koans are broken out into areas by file, hashes are covered in about_hashes.rb, +modules are introduced in about_modules.rb, etc. They are presented in +order in the path_to_enlightenment.rb file. Each koan builds up your knowledge of Ruby and builds upon itself. It will stop at the first place you need to correct. @@ -23,8 +23,8 @@ make it work correctly. == Installing Ruby If you do not have Ruby setup, please visit http://ruby-lang.org/en/downloads/ for -operating specific instructions. In order to run this you need ruby and rake -installed. To check the installations simply type: +operating specific instructions. In order to run this you need ruby and +rake installed. To check the installations simply type: *nix platforms from any terminal window: @@ -36,10 +36,10 @@ Windows from the command prompt (cmd.exe) c:\ruby --version c:\rake --version -If you don't have rake installed, just run `gem install rake` +If you don't have rake installed, just run gem install rake Any response for Ruby with a version number greater than 1.8 is fine (should be -around 1.8.6 or more). Any version of rake will do. +around 1.8.6 or more). Any version of rake will do. == Generating the Koans @@ -69,12 +69,13 @@ Windows is the same thing === Red, Green, Refactor -In test-driven development the mantra has always been, red, green, refactor. Write a -failing test and run it (red), make the test pass (green), then refactor it (that is -look at the code and see if you can make it any better). In this case you will need -to run the koan and see it fail (red), make the test pass (green), then take a -moment and reflect upon the test to see what it is teaching you and improve the -code to better communicate its intent (refactor). +In test-driven development the mantra has always been red, green, refactor. +Write a failing test and run it (red), make the test pass (green), +then refactor it (that is look at the code and see if you can make it any better). +In this case you will need to run the koan and see it fail (red), make +the test pass (green), then take a moment and reflect upon the test to +see what it is teaching you and improve the code to better communicate its intent +(refactor). The very first time you run it you will see the following output: @@ -106,7 +107,7 @@ the first solution: path_to_enlightenment.rb:38:in `each_with_index' path_to_enlightenment.rb:38 -We then open up the about_asserts.rb file and look at the first test: +We then open up the about_asserts.rb file and look at the first test: # We shall contemplate truth by testing reality, via asserts. def test_assert_truth @@ -122,6 +123,33 @@ In this case the goal is for you to see that if you pass a value to the +assert+ method, it will either ensure it is +true+ and continue on, or fail if in fact the statement is +false+. +=== Running the Koans automatically + +This section is optional. + +Normally the path to enlightenment looks like this: + + cd ruby_koans + rake + # edit + rake + # edit + rake + # etc + +If you prefer, you can keep the koans running in the background so that after you +make a change in your editor, the koans will immediately run again. This will +hopefully keep your focus on learning Ruby instead of the command line. + +Install the Ruby gem (library) called +watchr+ and then ask it to +"watch" the koans for changes: + + cd ruby_koans + rake + # decide to run rake automatically from now on as you edit + gem install watchr + watchr ./koans/koans.watchr + == Inspiration A special thanks to Mike Clark and Ara Howard for inspiring this