Rakefile in spreewald-2.4.2 vs Rakefile in spreewald-2.5.0
- old
+ new
@@ -42,14 +42,19 @@
require_relative './support/step_manager'
else
require 'support/step_manager'
end
- readme = File.read('README.md')
- start_of_steps_section = readme =~ /^## Steps/
- length_of_steps_section = (readme[(start_of_steps_section+1)..-1] =~ /^##[^#]/) || readme.size - start_of_steps_section
- readme[start_of_steps_section, length_of_steps_section] = "## Steps\n\n" + StepManager.new('lib/spreewald').to_markdown
- File.open(readme_path, 'w') { |f| f.write(readme) }
+ readme = File.read(readme_path)
+ File.open(readme_path, 'w') do |file|
+ start_of_steps_section = readme =~ /^## Steps/
+ length_of_steps_section = readme[(start_of_steps_section+1)..-1] =~ /^##[^#]/
+ length_of_steps_section ||= readme.size - start_of_steps_section
+ step_documentation = StepManager.new('lib/spreewald').to_markdown
+ readme[start_of_steps_section, length_of_steps_section] = "## Steps\n\n#{step_documentation}"
+
+ file.write(readme)
+ end
system "git diff #{readme_path}"
puts '', '> Done (diff applied).'
end