Class: Cuber::CuberfileParser
- Inherits:
-
Object
- Object
- Cuber::CuberfileParser
show all
- Defined in:
- lib/cuber/cuberfile_parser.rb
Instance Method Summary
collapse
-
#app(name) ⇒ Object
-
#buildpacks(builder) ⇒ Object
-
#cache(enabled) ⇒ Object
-
#cron(name, schedule, cmd) ⇒ Object
-
#dockerconfig(path) ⇒ Object
-
#dockerfile(path) ⇒ Object
-
#env(key, value, secret: false) ⇒ Object
-
#health(url) ⇒ Object
-
#image(name) ⇒ Object
-
#ingress(enabled) ⇒ Object
-
#initialize ⇒ CuberfileParser
constructor
A new instance of CuberfileParser.
-
#kubeconfig(path) ⇒ Object
-
#lb(key, value) ⇒ Object
-
#method_missing(m, *args) ⇒ Object
-
#migrate(cmd, check: nil) ⇒ Object
-
#proc(name, cmd, scale: 1, cpu: nil, ram: nil, term: 60, env: {}) ⇒ Object
-
#release(version) ⇒ Object
-
#repo(url, branch: nil) ⇒ Object
-
#ssl(crt, key) ⇒ Object
Constructor Details
Returns a new instance of CuberfileParser.
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/cuber/cuberfile_parser.rb', line 3
def initialize
@app = nil
@release = nil
@repo = nil
@buildpacks = nil
@dockerfile = nil
@image = nil
@cache = nil
@dockerconfig = nil
@kubeconfig = nil
@migrate = nil
@procs = {}
@cron = {}
@secrets = {}
@env = {}
@health = nil
@lb = {}
@ingress = nil
@ssl = nil
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m, *args) ⇒ Object
24
25
26
|
# File 'lib/cuber/cuberfile_parser.rb', line 24
def method_missing m, *args
abort "Cuberfile: \"#{m}\" is not a command"
end
|
Instance Method Details
#app(name) ⇒ Object
28
29
30
|
# File 'lib/cuber/cuberfile_parser.rb', line 28
def app name
@app = name
end
|
#buildpacks(builder) ⇒ Object
40
41
42
|
# File 'lib/cuber/cuberfile_parser.rb', line 40
def buildpacks builder
@buildpacks = builder
end
|
#cache(enabled) ⇒ Object
52
53
54
|
# File 'lib/cuber/cuberfile_parser.rb', line 52
def cache enabled
@cache = enabled
end
|
#cron(name, schedule, cmd) ⇒ Object
72
73
74
|
# File 'lib/cuber/cuberfile_parser.rb', line 72
def cron name, schedule, cmd
@cron[name] = { schedule: schedule, cmd: cmd }
end
|
#dockerconfig(path) ⇒ Object
56
57
58
|
# File 'lib/cuber/cuberfile_parser.rb', line 56
def dockerconfig path
@dockerconfig = path
end
|
#dockerfile(path) ⇒ Object
44
45
46
|
# File 'lib/cuber/cuberfile_parser.rb', line 44
def dockerfile path
@dockerfile = path
end
|
#env(key, value, secret: false) ⇒ Object
76
77
78
|
# File 'lib/cuber/cuberfile_parser.rb', line 76
def env key, value, secret: false
secret ? (@secrets[key] = value) : (@env[key] = value)
end
|
#health(url) ⇒ Object
80
81
82
|
# File 'lib/cuber/cuberfile_parser.rb', line 80
def health url
@health = url
end
|
#image(name) ⇒ Object
48
49
50
|
# File 'lib/cuber/cuberfile_parser.rb', line 48
def image name
@image = name
end
|
#ingress(enabled) ⇒ Object
88
89
90
|
# File 'lib/cuber/cuberfile_parser.rb', line 88
def ingress enabled
@ingress = enabled
end
|
#kubeconfig(path) ⇒ Object
60
61
62
|
# File 'lib/cuber/cuberfile_parser.rb', line 60
def kubeconfig path
@kubeconfig = path
end
|
#lb(key, value) ⇒ Object
84
85
86
|
# File 'lib/cuber/cuberfile_parser.rb', line 84
def lb key, value
@lb[key] = value
end
|
#migrate(cmd, check: nil) ⇒ Object
64
65
66
|
# File 'lib/cuber/cuberfile_parser.rb', line 64
def migrate cmd, check: nil
@migrate = { cmd: cmd, check: check }
end
|
#proc(name, cmd, scale: 1, cpu: nil, ram: nil, term: 60, env: {}) ⇒ Object
68
69
70
|
# File 'lib/cuber/cuberfile_parser.rb', line 68
def proc name, cmd, scale: 1, cpu: nil, ram: nil, term: 60, env: {}
@procs[name] = { cmd: cmd, scale: scale, cpu: cpu, ram: ram, term: term, env: env }
end
|
#release(version) ⇒ Object
32
33
34
|
# File 'lib/cuber/cuberfile_parser.rb', line 32
def release version
@release = version
end
|
#repo(url, branch: nil) ⇒ Object
36
37
38
|
# File 'lib/cuber/cuberfile_parser.rb', line 36
def repo url, branch: nil
@repo = { url: url, branch: branch }
end
|
#ssl(crt, key) ⇒ Object
92
93
94
|
# File 'lib/cuber/cuberfile_parser.rb', line 92
def ssl crt, key
@ssl = { crt: crt, key: key }
end
|