Sha256: 6cac53e732e0da2aff0f248cca1cc711a45603e825e28f9b40f331d744c1e8fe

Contents?: true

Size: 1.37 KB

Versions: 4

Compression:

Stored size: 1.37 KB

Contents

require 'bundler/gem_tasks'
require 'rake/testtask'

Rake::TestTask.new(:test) do |t|
  t.libs << 'test'
  t.libs << 'lib'
  t.test_files = FileList['test/**/*_test.rb']
end

namespace :build do

  desc 'Build README.md file from README.template.md'
  task :readme do
    Rake::Task['build:usages'].invoke
    require_relative 'lib/markdown_helper'
    markdown_helper = MarkdownHelper.new
    markdown_helper.include('readme_files/highlight_ruby_template.md', 'readme_files/highlighted_ruby.md')
    # Do the resolve before the include, so that the included text is not also resolved.
    # Thie protects example code from being also resolved, thus damaging the example code.
    # Temp file must be in the same directory as its source (it becomes the source).
    temp_file_path = 'readme_files/temp_resolved.md'
    markdown_helper.resolve('readme_files/README.template.md', temp_file_path)
    markdown_helper.include(temp_file_path, 'README.md')
    File.delete(temp_file_path)
  end

  desc 'Build usage for executables'
  task :usages do
    %w/
        include
        resolve
    /.each do |executable_name|
      usage_text = `ruby bin/#{executable_name} --help`
      usage_file_path = "bin/usage/#{executable_name}.txt"
      File.open(usage_file_path, 'w') do |file|
        file.puts(usage_text)
      end
    end
  end

end

task :default => :test

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
markdown_helper-1.5.0 Rakefile
markdown_helper-1.0.0 Rakefile
markdown_helper-0.2.4 Rakefile
markdown_helper-0.2.3 Rakefile