Sha256: b697fccfb1c7f7174030144c4fa123c597f6737a23780765695059f9dd6817e0

Contents?: true

Size: 1.07 KB

Versions: 2

Compression:

Stored size: 1.07 KB

Contents

# frozen_string_literal: true

module Rubysmith
  module Builders
    module Git
      # Builds project skeleton initial Git commit message.
      class Commit
        def self.call(configuration, builder: Builder) = new(configuration, builder: builder).call

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

        def call
          return unless configuration.build_git

          builder.call(configuration)
                 .run("git add .", chdir: project_name)
                 .run(
                   %(git commit --all --message "Added project skeleton" --message "#{body}"),
                   chdir: project_name
                 )
        end

        private

        attr_reader :configuration, :builder

        def body
          <<~CONTENT
            Generated with [#{Identity::LABEL}]("https://www.alchemists.io/projects/rubysmith")
            #{Identity::VERSION}.
          CONTENT
        end

        def project_name = configuration.project_name
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rubysmith-0.11.0 lib/rubysmith/builders/git/commit.rb
rubysmith-0.10.0 lib/rubysmith/builders/git/commit.rb