Sha256: 55fec4ac7554d7cb4a3649e1618468e4d5fb1fe48d1fb4e0350b3badb220b2b7
Contents?: true
Size: 763 Bytes
Versions: 5
Compression:
Stored size: 763 Bytes
Contents
require "bundler/gem_tasks" require 'rspec/core/rake_task' desc "run specs" RSpec::Core::RakeTask.new task :default => :spec desc "build readme" task :readme do tpl = File.read('README.md.tpl') result = tpl.gsub(/^### ([^~`\n]+?)\n```ruby(.+?)^```/m) do |x| title, code = $1, $2 File.open("tmp.rb", "w:utf-8") do |f| # f.puts "#coding: utf-8" # f.puts "$:.unshift('../lib')" f.puts "require 'zhexdump'" # f.puts "srand 0" f.puts code end puts "[.] #{title} .. " out = `ruby -Ilib tmp.rb` exit unless $?.success? x.sub code, code+"\n # output:\n"+out.split("\n").map{|x| " #{x}"}.join("\n")+"\n" end File.unlink("tmp.rb") File.open('README.md','w'){ |f| f << result } #puts result end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
zhexdump-0.2.0 | Rakefile |
zhexdump-0.1.1 | Rakefile |
zhexdump-0.1.0 | Rakefile |
zhexdump-0.0.2 | Rakefile |
zhexdump-0.0.1 | Rakefile |