Sha256: 019fedaa549ea659d9009ac3cda46bd803ef54e7f850634913353317781c1d83

Contents?: true

Size: 1.07 KB

Versions: 15

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
        include Import[:specification]

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

        def initialize(configuration, builder: Builder, **)
          super(**)
          @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
          "Generated with link:#{specification.homepage_url}[#{specification.label}] " \
          "#{specification.version}."
        end

        def project_name = configuration.project_name
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
rubysmith-6.6.0 lib/rubysmith/builders/git/commit.rb
rubysmith-6.5.0 lib/rubysmith/builders/git/commit.rb
rubysmith-6.4.0 lib/rubysmith/builders/git/commit.rb
rubysmith-6.3.0 lib/rubysmith/builders/git/commit.rb
rubysmith-6.2.1 lib/rubysmith/builders/git/commit.rb
rubysmith-6.2.0 lib/rubysmith/builders/git/commit.rb
rubysmith-6.1.0 lib/rubysmith/builders/git/commit.rb
rubysmith-6.0.0 lib/rubysmith/builders/git/commit.rb
rubysmith-5.9.0 lib/rubysmith/builders/git/commit.rb
rubysmith-5.8.1 lib/rubysmith/builders/git/commit.rb
rubysmith-5.8.0 lib/rubysmith/builders/git/commit.rb
rubysmith-5.7.0 lib/rubysmith/builders/git/commit.rb
rubysmith-5.6.0 lib/rubysmith/builders/git/commit.rb
rubysmith-5.5.0 lib/rubysmith/builders/git/commit.rb
rubysmith-5.4.0 lib/rubysmith/builders/git/commit.rb