Class: Dependabot::Workspace::Base
- Inherits:
-
Object
- Object
- Dependabot::Workspace::Base
- Defined in:
- lib/dependabot/workspace/base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#change_attempts ⇒ Object
readonly
Returns the value of attribute change_attempts.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #change(memo = nil) ⇒ Object
- #changed? ⇒ Boolean
- #changes ⇒ Object
- #failed_change_attempts ⇒ Object
-
#initialize(path) ⇒ Base
constructor
A new instance of Base.
- #reset! ⇒ Object
- #store_change(memo = nil) ⇒ Object
- #to_patch ⇒ Object
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_attempts ⇒ Object (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 |
#path ⇒ Object (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
14 15 16 |
# File 'lib/dependabot/workspace/base.rb', line 14 def changed? changes.any? end |
#changes ⇒ Object
18 19 20 |
# File 'lib/dependabot/workspace/base.rb', line 18 def changes change_attempts.select(&:success?) end |
#failed_change_attempts ⇒ Object
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_patch ⇒ Object
36 37 38 |
# File 'lib/dependabot/workspace/base.rb', line 36 def to_patch "" end |