Permalink
Browse files

[sd] taking the ruby primer offline. cheers.

  • Loading branch information...
1 parent 7734325 commit ac2ee91ebbe53aa6340c2127f3747a3fa6082b86 @deobald deobald committed May 11, 2012
Showing with 6 additions and 3,791 deletions.
  1. +0 −4 AUTHORS
  2. +0 −13 Gemfile
  3. +0 −4 LICENSE
  4. +6 −118 README.md
  5. +0 −15 Rakefile
  6. +0 −60 bin/rubymonk.rb
  7. +0 −101 docs/Classes and Object Oriented Programming in Ruby/01 - classes.haml
  8. +0 −190 docs/Classes and Object Oriented Programming in Ruby/02 - Building your own class.haml
  9. +0 −263 docs/Collections/01 - arrays-introduction.haml
  10. +0 −226 docs/Collections/02 - arrays-the-basics.haml
  11. +0 −171 docs/Collections/03 - arrays-iteration.haml
  12. +0 −141 docs/Control Structures/01 - Boolean Expressions in Ruby.haml
  13. +0 −114 docs/Control Structures/02 - Conditions using the IF statement.haml
  14. +0 −148 docs/Control Structures/03 - Loops in Ruby.haml
  15. +0 −159 docs/Hashes in Ruby /01 - Introduction to Ruby Hashes.haml
  16. +0 −104 docs/Hashes in Ruby /02 - Iterating over Hashes.haml
  17. +0 −321 docs/More Ruby/01 - Functional Programming in Ruby.haml
  18. +0 −57 docs/Problems/01 - calculator.haml
  19. +0 −46 docs/Problems/02 - String length finder.haml
  20. +0 −61 docs/Problems/03 - Frequency Finder.haml
  21. +0 −40 docs/Problems/04 - sort-string-words.haml
  22. +0 −56 docs/Problems/05 - Select random elements from an array.haml
  23. +0 −127 docs/Problems/06 - hiring_programmers_ruby_boolean_expressions.haml
  24. +0 −119 docs/Ruby Objects/01 - Introduction to Objects.haml
  25. +0 −120 docs/Ruby Objects/02 - More Objects and Methods.haml
  26. +0 −105 docs/Ruby Objects/03 - Syntactic Sugar for Special Methods.haml
  27. +0 −137 docs/String/01 - String-Introduction.haml
  28. +0 −316 docs/String/02 - String Basics.haml
  29. +0 −255 docs/String/03 - String Advanced.haml
  30. +0 −9 docs/chapters.yml
  31. +0 −13 lib/rubymonk_client.rb
  32. +0 −27 lib/rubymonk_client_config.rb
  33. +0 −47 lib/rubymonk_model.rb
  34. +0 −4 spec/fixtures/docs/01-sample_chapter/sample_lesson.haml
  35. +0 −38 spec/ruby_primer/rubymonk_client_config_spec.rb
  36. +0 −19 spec/ruby_primer/rubymonk_client_spec.rb
  37. +0 −40 spec/ruby_primer/rubymonk_model_spec.rb
  38. +0 −3 spec/spec_helper.rb
View
@@ -1,4 +0,0 @@
-Jasim A Basheer <http://github.com/jasim>
-Tejas Dinkar <http://github.com/gja>
-Aakash Dharmadhikari <http://github.com/aakashd>
-Sidu Ponanppa <http://github.com/kaiwren>
View
13 Gemfile
@@ -1,13 +0,0 @@
-source "http://rubygems.org"
-
-gem 'rake'
-gem 'rspec'
-
-gem 'rb-fsevent'
-gem 'rb-inotify'
-
-gem 'fssm', '~> 0.2.7'
-gem 'wrest'
-
-gem 'uuid'
-gem 'i18n'
View
@@ -1,4 +0,0 @@
-The Ruby Primer is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License (http://creativecommons.org/licenses/by-nc-sa/3.0/).
-
-Attribution: To re-distribute content from The Ruby Primer in any form, provide credit to the authors by including
-a hyperlink to http://github.com/c42/ruby_primer.
View
124 README.md
@@ -1,122 +1,10 @@
-# The Ruby Primer
+# Move Over, Ruby Primer!
-© Copyright 2011 [C42 Engineering][]. All Rights Reserved.
+## A new way to teach Ruby is coming!
-## Teach Ruby!
+Hey folks. We know you were having a jolly old time forking The Ruby Primer and fixing our spelling mistakes. And we love you for it. But we've got something much better for you!
-For spelling and grammar changes, <strong>simply fork, edit, commit and send us a pull request!</strong>
+Coming soon: rubymonk.com will let you write your own book. It's going to be great! Stay tuned!
-If you want to add content and need your own private RubyMonk sandbox to test your changes, read on.
-
-The Ruby Primer is an open collaboration initiative that uses the [RubyMonk][] platform to help teach the Ruby Programming Language.
-
-## How to Contribute
-
-- Fork this repository.
-- run `bundle install && bin/rubymonk.rb` to generate the URL to your very own RubyMonk sandbox.
-- Use the generated URL to preview the contents in the sandbox.
-- Make your changes in `docs/`. The sandbox URL will get updated with your changes as you make them.
-- Once you are happy with your changes, send us a pull request with a clear description of changes you've done.
-- Like any other open-source project, your pull request will be reviewed and then merged.
-
-## How does this work?
-
-The [RubyMonk][] platform allows you to create and publish online e-books that contain embeddable, runnable Ruby code and tests.
-
-RubyMonk uses standard Haml markup in combination with our very own DSL to achieve this. When you fork this repository and send us a pull request you are contributing content to The Ruby Primer, an introductory primer to the Ruby language.
-
-The Ruby Primer is a free, open and interactive e-book published on the RubyMonk platform.
-
-## The Magic DSL
-
-All the content is inside `docs/`.
-The lessons are placed inside `docs/<chapter>/<lesson_name>`.
-
-The lessons make use of standard [Haml markup][] for content. It is interspersed with metadata that allows you to define code blocks.
-
-Every lesson starts with a `section`. A section needs a `short_name` and a `title`.
-
-Here is a template:
-
- title - <Title of the lesson>
- .section :a_short_name_of_the_section, "Title of the section"
- %p
- A paragraph. You can use any valid Haml here. Be mindful of the spacing though!
-
- !enchant
-
- short_name :short_name_of_the_exercise
-
- exercise!
-
- starting_code <<-DATA
- # sample starting code.
- # uses Ruby's multiline construct.
- # code that will appear in the block by default.
- DATA
-
- code_wrapper <<-DATA
- # you can use ERB templating here.
- # the user_code is passed as a variable to the templating engine.
- def method_that_gives_result_of_the_users_input
- <%= user_code %>
- end
- DATA
-
- specs <<-DATA
- #
- it "the user should give the string xyz to pass this spec" do
- method_that_gives_result_of_the_users_input.should eq('xyz')
- end
- DATA
-
- !release
-
-The `!enchant` starts a block of exercise. Use `!release` once you are done. Every `!enchant` block mandatorily requires the following attributes:
-
-- `exercise!` or `example!` : An exercise has specs which have to pass for the user to continue. An example can be run, but does not affect the user's progress.
-- `short_name` : short_name is used in the URLs for referring to the section.
-- `starting_code` : Sample code that will appear by default in the code-block.
-- `code_wrapper` : This is the block of code where you create a method to wrap the code
- written by the user. RubyMonk uses ERB templating to render it, the user's code is passed in as the variable `user_code`.
-- `specs` : RSpec block that tests the method in the `code_wrapper`.
-
-To display any specific text in the RubyMonk output window when running a particular exercise,
-add `puts` or a similar command that writes to `stdout` in either the `specs` or the `code_wrapper` block.
-
-An exercise needs to have:
-
-- `starting_code`
-- `code_wrapper`
-- `specs`
-
-An example needs to have:
-
-- `starting_code`
-
-The numbers in the `section` and `enchant` lines are the `id`s of the metadata. You can skip adding a number there if you are creating a new section. But when modifiying existing section/enchant blocks that have an `id`, please leave them as is.
-
-Go ahead and check out the existing lessons to get a hold of the DSL better.
-
-## Scope
-
-The Ruby Primer is targeted at programmers who are learning Ruby for the first time. However people who are completely new to programming have also found it useful. The scope of The Ruby Primer is to cover just enough basics to help one get started with Ruby.
-
-For trivial changes to the content, you can use the GitHub `Edit` option instead of manually forking and sending a pull request.
-
-## Prerequisites
-
-- Ruby - CRuby 1.9.2 and upwards are supported.
-- Bundler (gem)
-
-The Ruby Primer sandbox client has been tested on Linux and Mac OS X. We welcome help in ensuring compatibility with Windows.
-
-## Got any questions? Talk to us!
-
-- Twitter: [@rubymonk](http://twitter.com/#!/rubymonk 'RubyMonk')
-- email: [rubymonk@c42.in](mailto:rubymonk@c42.in)
-- IRC: #rubymonk @ irc.freenode.net
-
-[RubyMonk]: http://rubymonk.com
-[C42 Engineering]: http://c42.in
-[Haml markup]: http://haml-lang.com/docs/yardoc/file.HAML_REFERENCE.html
+Much love,
+-the rubymonk team
View
@@ -1,15 +0,0 @@
-require 'rubygems'
-require 'rake'
-require 'bundler'
-
-Bundler.setup
-
-require 'rspec/core/rake_task'
-
-desc "Run all examples"
-RSpec::Core::RakeTask.new(:spec) do |t|
- t.rspec_opts = %w[--color --format documentation]
- t.verbose = false
-end
-
-task :default => :spec
View
@@ -1,60 +0,0 @@
-#! /usr/bin/env ruby
-
-require "rubygems"
-require "bundler/setup"
-
-$LOAD_PATH << File.dirname(__FILE__) + "/../lib"
-require 'rubymonk_model'
-require 'rubymonk_client'
-require 'rubymonk_client_config'
-
-require 'fssm'
-require 'uuid'
-
-CONFIG = RubymonkClientConfig.new(".rubymonk_open").get
-SANDBOX_URL = CONFIG["sandbox_server"]
-SANDBOX_TOKEN = CONFIG["sandbox_token"]
-
-CLIENT = RubymonkClient.new(SANDBOX_URL+ "/import/create", SANDBOX_TOKEN)
-
-UPDATE_FREQUENCY_SECONDS = 5
-DOCS = File.join(File.dirname(__FILE__), '..', "docs")
-
-puts "\n Thanks for contributing to the Ruby Primer. Please visit the following RubyMonk Sandbox server to see your changes."
-puts "\n\t#{SANDBOX_URL}/?sandbox_token=#{SANDBOX_TOKEN}"
-puts "\n This script will continuously watch your local filesystem for changes in the RubyMonk docs and update the sandbox.\n\n"
-
-def monitor
- FSSM.monitor(DOCS, '**/*', :directories => true) do
- update { timed_republish }
- delete { timed_republish }
- create { timed_republish }
- end
-end
-
-def republish
- content_hash = RubymonkModel.new(DOCS).build_hash.merge({ "sandbox_token" => SANDBOX_TOKEN})
- begin
- response = CLIENT.sync_data(content_hash)
- print Time.now
- if response.ok?
- puts " Success."
- elsif response.bad_request?
- puts " Changes not uploaded. Server returned error:"
- puts response.body
- else
- puts " Changes not uploaded. Server returned an error."
- end
- rescue Errno::ECONNREFUSED
- puts " Could not connect to server."
- end
- puts ""
-end
-
-def timed_republish
- sleep UPDATE_FREQUENCY_SECONDS
- republish
-end
-
-republish
-monitor
@@ -1,101 +0,0 @@
-title - Classes
-
-.section :grouping_objects, "Grouping Objects", 154
- %p
- At this point, one may wonder if all objects are the same. Are the
- groupings we've already covered - numbers, strings, arrays - supported
- by the Ruby language?
- %p
- Ruby does in fact allow one to define groups of objects, or, to use
- object oriented jargon, <em>classes</em> of objects.
- %p
- One may look up the class of any object by simply calling the
- <code>class</code> method on it. Let's try it out with a few of the
- objects we're already familiar with.
-
- !enchant 3024
- example!
- short_name :common_object_classes_example
- starting_code <<-DATA
- puts 1.class
- puts "".class
- puts [].class
- DATA
- code_wrapper <<-DATA
- def user_code
- <%= user_code %>
- end
- user_code
- DATA
- !release
-
- %p
- As you can see, Ruby tells us what we already suspected - that
- <code>1</code> is a <code>Fixnum</code> (a special case of Integer),
- <code>""</code> is a <code>String</code>
- and <code>[]</code> is an <code>Array</code>.
-
-.section :classes_are_people, "Classes are people too", 155
- %p
- An important feature of classes in Ruby is that they too adhere to the
- "everything is an object philosophy." This may be of interest to those
- already familiar with Java, C++ and other similar languages where
- classes are special constructs that cannot be interacted with like
- normal objects.
- %p
- So, in Ruby, classes themselves are simply objects that belong the
- class <code>Class</code>. Here's a simple example that demonstrates
- this fact:
-
- !enchant 3027
- example!
- short_name :class_class_example
- starting_code <<-DATA
- 1.class.class
- DATA
- code_wrapper <<-DATA
- def user_code
- <%= user_code %>
- end
- puts user_code
- DATA
- !release
-
-.section :what_do_classes_do, "What do classes do?", 159
- %p
- The next logical question is, of course, do classes simply act as
- logical groupings, or do they actually do something?
- %p
- In Ruby, like other class-based object oriented languages that you may
- already be familiar with, classes act as the factories that build
- objects. An object built by a certain class is called 'an instance of
- that class.' Typically, calling the <code>new</code> method on a class
- results in an instance being created.
- %p
- Let's build an instance of the most basic kind of object by calling
- the method <code>new</code> on the object <code>Object</code>.
-
- !enchant 3028
- exercise!
- short_name :object_creation
- starting_code ""
- solution "Object.new"
- code_wrapper <<-DATA
- def user_code
- <%= user_code %>
- end
- DATA
- specs <<-DATA
- it "an instance of Object is created" do
- user_code.class.should eq Object
- end
- DATA
- !release
-
- This object - or instance, to be more precise - can't do very much.
- However, instances of more powerful classes like Arrays and Strings
- can do a whole lot more as we'll see in other lessons. You will also
- learn to create your own classes which you can then use to build
- bigger and more powerful programs.
-
-
Oops, something went wrong.

0 comments on commit ac2ee91

Please sign in to comment.