Module: Dependabot::Workspace

Extended by:
T::Sig
Defined in:
lib/dependabot/workspace.rb,
lib/dependabot/workspace/git.rb,
lib/dependabot/workspace/base.rb,
lib/dependabot/workspace/change_attempt.rb

Defined Under Namespace

Classes: Base, ChangeAttempt, Git

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.active_workspaceObject

Returns the value of attribute active_workspace.



17
18
19
# File 'lib/dependabot/workspace.rb', line 17

def active_workspace
  @active_workspace
end

Class Method Details

.cleanup!Object



47
48
49
50
51
52
53
54
# File 'lib/dependabot/workspace.rb', line 47

def self.cleanup!
  return unless @active_workspace

  Dependabot.logger.debug("Cleaning up current workspace")

  @active_workspace.reset!
  @active_workspace = nil
end

.setup(repo_contents_path:, directory:) ⇒ Object



26
27
28
29
30
31
32
33
34
35
# File 'lib/dependabot/workspace.rb', line 26

def self.setup(repo_contents_path:, directory:)
  Dependabot.logger.debug("Setting up workspace in #{repo_contents_path}")

  full_path = Pathname.new(File.join(repo_contents_path, directory)).expand_path
  # Handle missing directories by creating an empty one and relying on the
  # file fetcher to raise a DependencyFileNotFound error
  FileUtils.mkdir_p(full_path)

  @active_workspace = Dependabot::Workspace::Git.new(full_path)
end

.store_change(memo:) ⇒ Object



38
39
40
41
42
43
44
# File 'lib/dependabot/workspace.rb', line 38

def self.store_change(memo:)
  return unless @active_workspace

  Dependabot.logger.debug("Storing change to workspace: #{memo}")

  @active_workspace.store_change(memo)
end