Sha256: 17d80c67e9e0c1c3bba0b83fbea3c86fed00ee1674e49ed864d159912f87d4ea

Contents?: true

Size: 1.02 KB

Versions: 9

Compression:

Stored size: 1.02 KB

Contents

# frozen_string_literal: true

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

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

        def call
          return configuration 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
                 )

          configuration
        end

        private

        attr_reader :configuration, :builder

        def body
          <<~CONTENT
            Generated with [Rubysmith](https://www.alchemists.io/projects/rubysmith)
            1.1.1.
          CONTENT
        end

        def project_name = configuration.project_name
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
rubysmith-3.2.0 lib/rubysmith/builders/git/commit.rb
rubysmith-3.1.0 lib/rubysmith/builders/git/commit.rb
rubysmith-3.0.1 lib/rubysmith/builders/git/commit.rb
rubysmith-3.0.0 lib/rubysmith/builders/git/commit.rb
rubysmith-2.0.2 lib/rubysmith/builders/git/commit.rb
rubysmith-2.0.1 lib/rubysmith/builders/git/commit.rb
rubysmith-2.0.0 lib/rubysmith/builders/git/commit.rb
rubysmith-1.3.0 lib/rubysmith/builders/git/commit.rb
rubysmith-1.2.0 lib/rubysmith/builders/git/commit.rb