Class: Docker::Rails::Console

Inherits:
Container show all
Extended by:
Helpers
Defined in:
lib/docker/rails/console.rb

Instance Attribute Summary

Attributes inherited from Container

#id, #removal_instructions

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Helpers

rails_image, rails_server

Methods inherited from Container

#add_removal_instructions, #attach!, #disable!, #exists_in?, #from_a?, #from_klass, #inspekt, #ip, load_from, #logs, #method_missing, #path, #remove!, #removed?, #to_klass, #up?

Methods included from Equality

#==

Constructor Details

#initialize(id) ⇒ Console

Returns a new instance of Console.



7
8
9
# File 'lib/docker/rails/console.rb', line 7

def initialize(id)
  super
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Docker::Container

Class Method Details

.load(id, path) ⇒ Object



23
24
25
# File 'lib/docker/rails/console.rb', line 23

def self.load(id, path)
  run(path)
end

.run(path, postgres, options) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/docker/rails/console.rb', line 11

def self.run(path, postgres, options)
  image   = "#{rails_image(path.name)}"
  options += " -it --name rails-console-#{path.name} " +
             "--rm -e PG_HOST=#{postgres.ip} "         + 
             "--link db:db -v #{path}:/usr/src/app "   +
  command = 'rails console'

  docker_cmd = "docker run #{options} #{image} #{command}"
  Docker::Interactive.warn(docker_cmd)
  docker_cmd
end