Sha256: a864bb4a977a8f088b5999007eadb027c4e914ddf79692070ff6f151a2caa816

Contents?: true

Size: 1.11 KB

Versions: 8

Compression:

Stored size: 1.11 KB

Contents

# frozen_string_literal: true

require "bundler/gem_tasks"
require "rspec/core/rake_task"
require "rubocop/rake_task"
require "yard"
require "pathname"
require "launchy"
require "uri"

ROOT = Pathname.new(__FILE__).join("..")

RSpec::Core::RakeTask.new(:spec)
RuboCop::RakeTask.new(:lint)

YARD::Rake::YardocTask.new(:doc) do |t|
  t.files = Dir[ROOT.join("lib/**/*.rb")]
  t.options = %w[--private]
end

def open_in_browser(path)
  Launchy.open(URI.join("file:///", path.to_s))
end

namespace :doc do
  desc "open doc"
  task open: :doc do
    open_in_browser ROOT.join("doc/frames.html")
  end

  desc "checks doc coverage"
  task coverage: :doc do
    # ideally you've already generated the database to .load it
    # if not, have this task depend on the docs task.
    YARD::Registry.load
    objs = YARD::Registry.select do |o|
      puts "pending #{o}" if /TODO|FIXME|@pending/.match?(o.docstring)
      o.docstring.blank?
    end

    next if objs.empty?
    puts "No documentation found for:"
    objs.each { |x| puts "\t#{x}" }

    raise "100% document coverage required"
  end
end

task default: %i[lint doc:coverage spec]

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
lamian-1.11.0 Rakefile
lamian-1.10.0 Rakefile
lamian-1.9.0 Rakefile
lamian-1.8.0 Rakefile
lamian-1.7.0 Rakefile
lamian-1.6.0 Rakefile
lamian-1.5.0 Rakefile
lamian-1.4.0 Rakefile