Sha256: 5fdf93d85033bb1e9241c6084777b2a6070b6641f38091d70ba90a70e37ff043

Contents?: true

Size: 744 Bytes

Versions: 1

Compression:

Stored size: 744 Bytes

Contents

# frozen_string_literal: true

require "rake"
require "tocer"
require "refinements/structs"

module Tocer
  module Rake
    # Provides Rake tasks for convenience.
    class Tasks
      include ::Rake::DSL
      using Refinements::Structs

      def self.setup = new.install

      def initialize configuration: CLI::Configuration::Loader.new.call, runner: Runner.new
        @configuration = configuration
        @runner = runner
      end

      def install
        desc "Add/Update Table of Contents (README)"
        task :toc, %i[label includes] do |_task, arguments|
          runner.call(**configuration.merge(**arguments.to_h).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-12.0.0 lib/tocer/rake/tasks.rb