Sha256: 7525b3fb6d735b79937950a218fab8726cd4beffa565b5ae8c809bcc6da6707e

Contents?: true

Size: 873 Bytes

Versions: 39

Compression:

Stored size: 873 Bytes

Contents

# frozen_string_literal: true

require "refinements/structs"

module Gemsmith
  module Builders
    module Git
      # Builds project skeleton Git ignore.
      class Ignore
        using Refinements::Structs

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

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

        def call
          return configuration unless configuration.build_git

          builder.call(configuration.merge(template_path: "%project_name%/.gitignore.erb"))
                 .touch
                 .prepend("*.gem\n")
                 .insert_before("tmp\n", "Gemfile.lock\n")
                 .insert_before("tmp\n", "pkg\n")

          configuration
        end

        private

        attr_reader :configuration, :builder
      end
    end
  end
end

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
gemsmith-19.0.0 lib/gemsmith/builders/git/ignore.rb
gemsmith-18.9.0 lib/gemsmith/builders/git/ignore.rb
gemsmith-18.8.0 lib/gemsmith/builders/git/ignore.rb
gemsmith-18.7.0 lib/gemsmith/builders/git/ignore.rb
gemsmith-18.6.0 lib/gemsmith/builders/git/ignore.rb
gemsmith-18.5.0 lib/gemsmith/builders/git/ignore.rb
gemsmith-18.4.0 lib/gemsmith/builders/git/ignore.rb
gemsmith-18.3.0 lib/gemsmith/builders/git/ignore.rb
gemsmith-18.2.0 lib/gemsmith/builders/git/ignore.rb
gemsmith-18.1.1 lib/gemsmith/builders/git/ignore.rb
gemsmith-18.1.0 lib/gemsmith/builders/git/ignore.rb
gemsmith-18.0.2 lib/gemsmith/builders/git/ignore.rb
gemsmith-18.0.1 lib/gemsmith/builders/git/ignore.rb
gemsmith-18.0.0 lib/gemsmith/builders/git/ignore.rb
gemsmith-17.0.1 lib/gemsmith/builders/git/ignore.rb
gemsmith-17.0.0 lib/gemsmith/builders/git/ignore.rb
gemsmith-16.2.0 lib/gemsmith/builders/git/ignore.rb
gemsmith-16.1.0 lib/gemsmith/builders/git/ignore.rb
gemsmith-16.0.0 lib/gemsmith/builders/git/ignore.rb