Sha256: d095686289304870beeef52666f1f3d35da214341aa0ffba5e0979d4b59690c3

Contents?: true

Size: 571 Bytes

Versions: 17

Compression:

Stored size: 571 Bytes

Contents

#!/usr/bin/env ruby
#
# Usage: ./gist_readme.rb source_file.rb [README.md]
#
# Extracts first comment block from source_file.rb into README.md file
#
#
raise "source_file should be specified" if ARGV.empty?

File.open(File.expand_path(File.join("../", ARGV[1] || "README.md") , __FILE__), "w") do |f|
  first_comment = []
  IO.read(File.expand_path(File.join("../", ARGV[0]), __FILE__)).each_line do |l|
    if l =~ /\s*#/
      first_comment << l.sub(/^\s*#\s/, "").rstrip
    elsif !first_comment.empty?
      break
    end
  end
  f.write(first_comment.join("\n"))
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
dolzenko-0.0.27 lib/dolzenko/gist_readme.rb
dolzenko-0.0.26 lib/dolzenko/gist_readme.rb
dolzenko-0.0.25 lib/dolzenko/gist_readme.rb
dolzenko-0.0.24 lib/dolzenko/gist_readme.rb
dolzenko-0.0.23 lib/dolzenko/gist_readme.rb
dolzenko-0.0.22 lib/dolzenko/gist_readme.rb
dolzenko-0.0.21 lib/dolzenko/gist_readme.rb
dolzenko-0.0.20 lib/dolzenko/gist_readme.rb
dolzenko-0.0.19 lib/dolzenko/gist_readme.rb
dolzenko-0.0.18 lib/dolzenko/gist_readme.rb
dolzenko-0.0.17 lib/dolzenko/gist_readme.rb
dolzenko-0.0.16 lib/dolzenko/gist_readme.rb
dolzenko-0.0.15 lib/dolzenko/gist_readme.rb
dolzenko-0.0.14 lib/dolzenko/gist_readme.rb
dolzenko-0.0.13 lib/dolzenko/gist_readme.rb
dolzenko-0.0.12 lib/dolzenko/gist_readme.rb
dolzenko-0.0.11 lib/dolzenko/gist_readme.rb