Sha256: a0d60fbb8fa02f386d27ef24bd40143994d29e620e0f40b7fad0f3dee933554f

Contents?: true

Size: 818 Bytes

Versions: 5

Compression:

Stored size: 818 Bytes

Contents

# frozen_string_literal: true

require "refinements/structs"

module Rubysmith
  module Builders
    # Builds project skeleton with RuboCop code quality support.
    class Rubocop
      using Refinements::Structs

      def self.call(...) = new(...).call

      def initialize configuration, builder: Builder
        @configuration = configuration
        @builder = builder
      end

      def call
        return configuration unless configuration.build_rubocop

        builder.call(configuration.merge(template_path: "%project_name%/bin/rubocop.erb"))
               .render
               .permit 0o755

        builder.call(configuration.merge(template_path: "%project_name%/.rubocop.yml.erb")).render
        configuration
      end

      private

      attr_reader :configuration, :builder
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rubysmith-1.3.0 lib/rubysmith/builders/rubocop.rb
rubysmith-1.2.0 lib/rubysmith/builders/rubocop.rb
rubysmith-1.1.1 lib/rubysmith/builders/rubocop.rb
rubysmith-1.1.0 lib/rubysmith/builders/rubocop.rb
rubysmith-1.0.0 lib/rubysmith/builders/rubocop.rb