Class: Rubysmith::Builders::Git::Commit

Inherits:
Object
  • Object
show all
Defined in:
lib/rubysmith/builders/git/commit.rb

Overview

Builds project skeleton initial Git commit message.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(configuration, builder: Builder) ⇒ Commit

Returns a new instance of Commit.



12
13
14
15
16
# File 'lib/rubysmith/builders/git/commit.rb', line 12

def initialize(configuration, builder: Builder, **)
  super(**)
  @configuration = configuration
  @builder = builder
end

Class Method Details

.callObject



10
# File 'lib/rubysmith/builders/git/commit.rb', line 10

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

Instance Method Details

#callObject



18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/rubysmith/builders/git/commit.rb', line 18

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