Sha256: 0fc0586cbacbe4f98f0a462f552a65f61105ed8133f82e52f64fc8ceb7e725f2

Contents?: true

Size: 786 Bytes

Versions: 14

Compression:

Stored size: 786 Bytes

Contents

# frozen_string_literal: true

require "rake"
require "tocer"

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

14 entries across 14 versions & 1 rubygems

Version Path
tocer-11.1.0 lib/tocer/rake/tasks.rb
tocer-11.0.0 lib/tocer/rake/tasks.rb
tocer-10.5.0 lib/tocer/rake/tasks.rb
tocer-10.4.1 lib/tocer/rake/tasks.rb
tocer-10.4.0 lib/tocer/rake/tasks.rb
tocer-10.3.0 lib/tocer/rake/tasks.rb
tocer-10.2.0 lib/tocer/rake/tasks.rb
tocer-10.1.1 lib/tocer/rake/tasks.rb
tocer-10.1.0 lib/tocer/rake/tasks.rb
tocer-10.0.1 lib/tocer/rake/tasks.rb
tocer-10.0.0 lib/tocer/rake/tasks.rb
tocer-9.1.2 lib/tocer/rake/tasks.rb
tocer-9.1.1 lib/tocer/rake/tasks.rb
tocer-9.1.0 lib/tocer/rake/tasks.rb