Class: DeisInteractive::Rails::Console
- Inherits:
-
Base
- Object
- Base
- DeisInteractive::Rails::Console
show all
- Defined in:
- lib/deis-interactive/rails/console.rb
Instance Attribute Summary
Attributes inherited from Base
#app, #process
Instance Method Summary
collapse
Methods inherited from Base
#deis_remote, #git_remote_response, #inferred_app, #pod_ids, #processes_pattern
Constructor Details
#initialize(app) ⇒ Console
Returns a new instance of Console.
7
8
9
|
# File 'lib/deis-interactive/rails/console.rb', line 7
def initialize(app)
super(app, ENV['DEIS_CONSOLE_PROCESS'] || "web")
end
|
Instance Method Details
#bash ⇒ Object
26
27
28
|
# File 'lib/deis-interactive/rails/console.rb', line 26
def bash
". /app/.profile.d/ruby.sh && PATH=/app/.heroku/node/bin:$PATH /app/bin/rails c"
end
|
11
12
13
14
|
# File 'lib/deis-interactive/rails/console.rb', line 11
def perform
puts "Run rails console attaching to #{pod_id}"
exec "kubectl exec -it --namespace #{app} #{pod_id} -- bash -c #{Shellwords.escape(bash)}"
end
|
#pod_id ⇒ Object
16
17
18
19
20
21
22
23
24
|
# File 'lib/deis-interactive/rails/console.rb', line 16
def pod_id
@pod_id ||= (
sample_pod_id = pod_ids.sample
if (sample_pod_id.nil?)
raise "Error. No pod of #{process} is found. kubectl won't be able to attach to run a console session"
end
sample_pod_id
)
end
|