Sha256: 1a36a66933dd99698771bd38f7fcba1692c69118fd3c59f575b3a89c9ab3c028

Contents?: true

Size: 739 Bytes

Versions: 6

Compression:

Stored size: 739 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)
        end
      end

      private

      attr_reader :configuration, :runner
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
tocer-12.2.0 lib/tocer/rake/tasks.rb
tocer-12.1.0 lib/tocer/rake/tasks.rb
tocer-12.0.4 lib/tocer/rake/tasks.rb
tocer-12.0.3 lib/tocer/rake/tasks.rb
tocer-12.0.2 lib/tocer/rake/tasks.rb
tocer-12.0.1 lib/tocer/rake/tasks.rb