Sha256: f6367d684b611a47696592bafe64759844780bd0cda5d4689fcf8ec70252e915

Contents?: true

Size: 770 Bytes

Versions: 1

Compression:

Stored size: 770 Bytes

Contents

# frozen_string_literal: true

require "rake"

module Tocer
  module Rake
    class Tasks
      include ::Rake::DSL

      def self.setup
        new.install
      end

      def initialize configuration: Tocer::Configuration.default, runner: Runner
        @configuration = configuration
        @runner = runner
      end

      def install
        desc "Add/Update Table of Contents (README)"
        task :toc, %i[label includes] do |_task, arguments|
          inputs = {label: arguments[:label], includes: arguments[:includes]}.compact
          updated_configuration = configuration.merge inputs
          runner.new(configuration: updated_configuration.to_h).call
        end
      end

      private

      attr_reader :configuration, :runner
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tocer-9.0.0 lib/tocer/rake/tasks.rb