Skip to content

Instantly share code, notes, and snippets.

@jm
Created April 19, 2012 14:40
Show Gist options
  • Save jm/2421372 to your computer and use it in GitHub Desktop.
Save jm/2421372 to your computer and use it in GitHub Desktop.
Thinking on teaching code/Rails
##############
# Lesson file
##############
title "Getting started with Rails"
description "A quick tutorial to run you through a basic Rails application"
steps %w {
install.rb
app.rb
setup.rb
generate.rb
launch.rb
edit.rb
}
###########
# Step file
###########
title "Generate a controller"
instructions "To generate a controller in Rails, you need to... etc." # or these could be loaded from a file optionally
# These requirements outline what will be required to get the "Next" button to light up
# Could be files or something else. Haven't figured all this out yet.
requirement do
tip "Run rails g controller pages index"
require_file "app/controllers/pages_controller.rb"
require_file "app/views/pages/index.html.erb"
end
##########################
# Step file requiring code
##########################
title "Strftime"
instructions "Strftime is a great tool..."
# These requirements outline what will be required to get the "Next" button to light up
# Could be files or something else. Haven't figured all this out yet.
requirement do
tip "Get the current time with Time.now and assign it to a variable named time"
irb do
code "time = Time.now" # ideally we'd be able to monitor local state for things but would have to figure that out
end
end
requirement do
tip "Print out the time variable like this: 03/12/2012 03:22:13"
irb do
code "puts time.strftime('%D %T')"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment