module DockerizeRails::DockerCommands::DockerPull

Public Class Methods

pull_mysql() click to toggle source
# File lib/dockerize_rails/docker_commands/docker_pull.rb, line 14
def self.pull_mysql
  if DRConfig.linked_database? && DRConfig.databases[DRConfig.application_env] == 'mysql'
    pull_docker_image('mysql', DRConfig.mysql_version)
  end
  0
rescue Docker::Error::NotFoundError => exception
  puts
  puts exception.to_s.red
  puts
  1
end
pull_postgres() click to toggle source
# File lib/dockerize_rails/docker_commands/docker_pull.rb, line 26
def self.pull_postgres
  if DRConfig.linked_database? && DRConfig.databases[DRConfig.application_env] == 'postgresql'
    pull_docker_image('postgres', DRConfig.postgres_version)
  end
  0
rescue Docker::Error::NotFoundError => exception
  puts
  puts exception.to_s.red
  puts
  1
end
pull_ruby() click to toggle source
# File lib/dockerize_rails/docker_commands/docker_pull.rb, line 4
def self.pull_ruby
  pull_docker_image('ruby', DRConfig.ruby_version)
  0
rescue Docker::Error::NotFoundError => exception
  puts
  puts exception.to_s.red
  puts
  1
end

Private Class Methods

pull_docker_image(image_name, tag) click to toggle source
# File lib/dockerize_rails/docker_commands/docker_pull.rb, line 38
def self.pull_docker_image(image_name, tag)
  Docker::Image.create('fromImage' => "#{image_name}:#{tag}")
  puts "Base image '#{image_name}:#{tag}' ready".green
  0
rescue Docker::Error::NotFoundError => exception
  puts
  puts exception.to_s.red
  puts
  1
end