Class: Makit::Services::Builder

Inherits:
Object
  • Object
show all
Defined in:
lib/makit/services/builder.rb

Overview

Service class responsible for build operations and make processes Handles the complex build workflow including repository setup and execution

Class Method Summary collapse

Class Method Details

.ensure_gitignoreObject

Ensure .gitignore exists in the current directory



30
31
32
33
34
35
36
37
# File 'lib/makit/services/builder.rb', line 30

def ensure_gitignore
  return if File.exist?(".gitignore")

  Makit::LOGGER.info("added .gitignore file")
  File.open(".gitignore", "w") do |file|
    file.puts Makit::Content::GITIGNORE
  end
end

.make_repository(url, commit, force: false) ⇒ Makit::V1::MakeResult

Build a repository at a specific commit

Parameters:

  • url (String)

    the git repository URL

  • commit (String)

    the commit hash or “latest” for the most recent commit

  • force (Boolean) (defaults to: false)

    whether to force rebuild even if cached result exists

Returns:



18
19
20
21
22
23
24
25
26
27
# File 'lib/makit/services/builder.rb', line 18

def make_repository(url, commit, force: false)
  Validator.validate_url_parameter(url)
  Validator.validate_commit_parameter(commit)

  log_filename = get_log_filename(url, commit)

  return load_existing_result(log_filename) if should_load_existing_result?(log_filename, force, commit)

  execute_make_process(url, commit, log_filename)
end