Class: Dependabot::Workspace::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/dependabot/workspace/base.rb

Direct Known Subclasses

Git

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ Base

Returns a new instance of Base.



9
10
11
12
# File 'lib/dependabot/workspace/base.rb', line 9

def initialize(path)
  @path = path
  @change_attempts = []
end

Instance Attribute Details

#change_attemptsObject (readonly)

Returns the value of attribute change_attempts.



7
8
9
# File 'lib/dependabot/workspace/base.rb', line 7

def change_attempts
  @change_attempts
end

#pathObject (readonly)

Returns the value of attribute path.



7
8
9
# File 'lib/dependabot/workspace/base.rb', line 7

def path
  @path
end

Instance Method Details

#change(memo = nil) ⇒ Object



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

def change(memo = nil)
  Dir.chdir(path) { yield(path) }
rescue StandardError => e
  capture_failed_change_attempt(memo, e)
  clean # clean up any failed changes
  raise e
end

#changed?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/dependabot/workspace/base.rb', line 14

def changed?
  changes.any?
end

#changesObject



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

def changes
  change_attempts.select(&:success?)
end

#failed_change_attemptsObject



22
23
24
# File 'lib/dependabot/workspace/base.rb', line 22

def failed_change_attempts
  change_attempts.select(&:error?)
end

#reset!Object



40
# File 'lib/dependabot/workspace/base.rb', line 40

def reset!; end

#store_change(memo = nil) ⇒ Object



34
# File 'lib/dependabot/workspace/base.rb', line 34

def store_change(memo = nil); end

#to_patchObject



36
37
38
# File 'lib/dependabot/workspace/base.rb', line 36

def to_patch
  ""
end