Module: Dapp::Project::Command::Stages::CleanupRepo

Included in:
Dapp::Project
Defined in:
lib/dapp/project/command/stages/cleanup_repo.rb

Overview

CleanupRepo

Instance Method Summary collapse

Instance Method Details

#stages_cleanup_repo(repo) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/dapp/project/command/stages/cleanup_repo.rb', line 9

def stages_cleanup_repo(repo)
  lock_repo(repo) do
    raise Error::Project, code: :stages_cleanup_required_option unless stages_cleanup_option?

    registry = registry(repo)
    repo_dimgs, repo_stages = repo_dimgs_and_cache(registry)
    repo_stages.delete_if { |_, siid| repo_dimgs.values.include?(siid) } # ignoring stages with dimgs ids (v2)

    proper_repo_cache(registry, repo_stages)               if proper_cache_version?
    repo_stages_cleanup(registry, repo_dimgs, repo_stages) if proper_repo_cache?
    proper_repo_git_commit(registry)                       if proper_git_commit?
  end
end