gjallarhorn 0.1.0.alpha → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,56 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "yaml"
4
- require "logger"
5
-
6
- # Base adapter interface
7
- module Gjallarhorn
8
- module Adapters
9
- class Base
10
- attr_reader :config, :logger
11
-
12
- def initialize(config)
13
- @config = config
14
- @logger = Logger.new($stdout)
15
- end
16
-
17
- # Core deployment interface
18
- def deploy(image:, environment:, services: [])
19
- raise NotImplementedError, "Subclasses must implement deploy"
20
- end
21
-
22
- def rollback(version:)
23
- raise NotImplementedError, "Subclasses must implement rollback"
24
- end
25
-
26
- def status
27
- raise NotImplementedError, "Subclasses must implement status"
28
- end
29
-
30
- def health_check(service:)
31
- raise NotImplementedError, "Subclasses must implement health_check"
32
- end
33
-
34
- def scale(service:, replicas:)
35
- raise NotImplementedError, "Subclasses must implement scale"
36
- end
37
-
38
- def logs(service:, lines: 100)
39
- raise NotImplementedError, "Subclasses must implement logs"
40
- end
41
-
42
- protected
43
-
44
- def wait_for_health(service, timeout = 300)
45
- start_time = Time.now
46
- loop do
47
- return true if health_check(service: service)
48
-
49
- raise "Health check timeout for #{service}" if Time.now - start_time > timeout
50
-
51
- sleep 5
52
- end
53
- end
54
- end
55
- end
56
- end