Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

update jumpstart

  • Loading branch information...
commit 920d2447047ac5220df7e87e72a5f95286bfdaf9 1 parent fe34815
@quix authored
Showing with 5 additions and 3 deletions.
  1. +5 −3 devel/jumpstart.rb
View
8 devel/jumpstart.rb
@@ -470,9 +470,10 @@ class << self
end
attribute :sections do
+ require 'enumerator'
begin
- pairs = Hash[*readme_contents.split(%r!^== (\w+).*?$!)[1..-1]].map {
- |section, contents|
+ data = readme_contents.split(%r!^==\s*(.*?)\s*$!)
+ pairs = data[1..-1].enum_slice(2).map { |section, contents|
[section.downcase, contents.strip]
}
Hash[*pairs.flatten]
@@ -906,7 +907,8 @@ def run_doc_code(code, expected, index, instance, &block)
def run_doc_section(file, section, instance, &block)
contents = File.read(file)
- if section_contents = contents[%r!^=+[ \t]#{section}.*?\n(.*?)^=!m, 1]
+ re = %r!^=+[ \t]#{Regexp.quote(section)}.*?\n(.*?)^=!m
+ if section_contents = contents[re, 1]
index = 0
section_contents.scan(%r!^( \S.*?)(?=(^\S|\Z))!m) { |indented, unused|
code_sections = indented.split(%r!^ \#\#\#\# output:\s*$!)
Please sign in to comment.
Something went wrong with that request. Please try again.