Skip to content

Commit

Permalink
Adding helper script
Browse files Browse the repository at this point in the history
  • Loading branch information
ttscoff committed Aug 29, 2022
1 parent 33d8b79 commit 07bd642
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions scripts/fixreadme.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env ruby
src = 'src/README.md'
dest = 'README.md'
current_ver = '2.0.16'
readme = IO.read(src).force_encoding('ASCII-8BIT').encode('UTF-8', :invalid => :replace, :undef => :replace, :replace => '?')

content = readme.match(/(?<=\<!--README-->)(.*?)(?=\<!--END README-->)/m)[0]

content = "# Gather CLI\n\n#{content}"
content.gsub!(/\<!--VER-->(.*?)\<!--END VER-->/, current_ver)
content.gsub!(/<!--GITHUB-->(.*?)<!--END GITHUB-->/m, '\1')
content.gsub!(/<!--JEKYLL(.*?)-->/m, '')

File.open(dest, 'w') { |f| f.puts(content) }

0 comments on commit 07bd642

Please sign in to comment.