Sha256: df85ecdf6e76e2d0b2ccc90731e43aab40055749d2890459b71e309beedbff9d

Contents?: true

Size: 1.03 KB

Versions: 12

Compression:

Stored size: 1.03 KB

Contents

# frozen_string_literal: true

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

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

        def call
          return unless realm.build_git

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

        private

        attr_reader :realm, :builder

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

        def project_name
          realm.project_name
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
rubysmith-0.9.1 lib/rubysmith/builders/git/commit.rb
rubysmith-0.9.0 lib/rubysmith/builders/git/commit.rb
rubysmith-0.8.0 lib/rubysmith/builders/git/commit.rb
rubysmith-0.7.0 lib/rubysmith/builders/git/commit.rb
rubysmith-0.6.1 lib/rubysmith/builders/git/commit.rb
rubysmith-0.6.0 lib/rubysmith/builders/git/commit.rb
rubysmith-0.5.0 lib/rubysmith/builders/git/commit.rb
rubysmith-0.4.0 lib/rubysmith/builders/git/commit.rb
rubysmith-0.3.0 lib/rubysmith/builders/git/commit.rb
rubysmith-0.2.0 lib/rubysmith/builders/git/commit.rb
rubysmith-0.1.1 lib/rubysmith/builders/git/commit.rb
rubysmith-0.1.0 lib/rubysmith/builders/git/commit.rb