Class: Pgai::CloneManager
- Inherits:
-
Object
- Object
- Pgai::CloneManager
- Defined in:
- lib/pgai/clone_manager.rb
Instance Method Summary collapse
- #cleanup ⇒ Object
- #connect ⇒ Object
-
#initialize(env) ⇒ CloneManager
constructor
A new instance of CloneManager.
- #prepare ⇒ Object
- #reset ⇒ Object
Constructor Details
#initialize(env) ⇒ CloneManager
Returns a new instance of CloneManager.
5 6 7 8 |
# File 'lib/pgai/clone_manager.rb', line 5 def initialize(env) @env = env @logger = Pgai::Commander.instance.logger end |
Instance Method Details
#cleanup ⇒ Object
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/pgai/clone_manager.rb', line 25 def cleanup return unless clone_already_created? Resources::Local::Clone.delete(clone_id) Resources::Remote::Clone.find(clone_id).tap do |resource| resource.delete resource.refresh logger.info resource. end end |
#connect ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/pgai/clone_manager.rb', line 10 def connect prepare do |cached_clone| PsqlManager.new( cached_clone, logger: logger ).run end end |
#prepare ⇒ Object
19 20 21 22 23 |
# File 'lib/pgai/clone_manager.rb', line 19 def prepare find_or_create_clone.with_port_forward do |cached_clone| yield cached_clone end end |