Class: Jack::Deploy
- Inherits:
-
Object
show all
- Includes:
- Util
- Defined in:
- lib/jack/deploy.rb
Instance Method Summary
collapse
Methods included from Util
#app_name_convention, #aws_bin, #check_aws_setup, #confirm, #eb, #eb_base_flags, #eb_bin, #ensure_folder_exist, #get_answer, #get_region, #prerequisites, #settings, #sh
Constructor Details
#initialize(options = {}) ⇒ Deploy
5
6
7
8
9
10
|
# File 'lib/jack/deploy.rb', line 5
def initialize(options={})
@options = options
@root = options[:root] || '.'
@env_name = options[:env_name]
@app_name = options[:app] || app_name_convention(@env_name)
end
|
Instance Method Details
#deploy ⇒ Object
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
# File 'lib/jack/deploy.rb', line 28
def deploy
command = "#{eb_bin} deploy#{eb_base_flags} #{@env_name} #{ENV['EB_OPTIONS']}"
sh(command)
end
|
#environment_exists? ⇒ Boolean
22
23
24
25
26
|
# File 'lib/jack/deploy.rb', line 22
def environment_exists?
return true if @options[:noop]
r = eb.describe_environments(application_name: @app_name)
r.environments.collect(&:environment_name).include?(@env_name)
end
|
#run ⇒ Object
12
13
14
15
16
17
18
19
20
|
# File 'lib/jack/deploy.rb', line 12
def run
unless @options[:noop] || environment_exists?
UI.say("ERROR: Environment #{@env_name} does not appear to exist. Are you sure it exists?")
exit 1 unless ENV['TEST']
end
prerequisites
deploy
end
|