Module: Dependabot::Workspace

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.



11
12
13
# File 'lib/dependabot/workspace.rb', line 11

def active_workspace
  @active_workspace
end

Class Method Details

.cleanup!Object



33
34
35
36
37
38
39
40
# File 'lib/dependabot/workspace.rb', line 33

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



14
15
16
17
18
19
20
21
22
23
# File 'lib/dependabot/workspace.rb', line 14

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



25
26
27
28
29
30
31
# File 'lib/dependabot/workspace.rb', line 25

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

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

  @active_workspace.store_change(memo)
end