Sha256: 0df93b755985fd5be2112d25d76f196f8fa05280f837617e9906ac61585bb059

Contents?: true

Size: 1.8 KB

Versions: 2

Compression:

Stored size: 1.8 KB

Contents

module DockerizeRails
  module DockerCommands
    require 'docker'

    def self.info
      DockerHelpers.ensure_docker_service
      puts
      DockerHelpers.print_version
      puts
    end

    def self.pull
      DockerHelpers.ensure_docker_service
      status = 0
      status += DockerPull.pull_ruby
      status += DockerPull.pull_mysql
      status += DockerPull.pull_postgres
      status
    rescue Docker::Error::NotFoundError => exception
      puts
      puts exception.to_s.red
      puts
      1
    end

    def self.build
      DockerHelpers.ensure_docker_service
      status = 0
      status += DockerBuild.build_rails
      status += DockerBuild.build_postgres
      status += DockerBuild.build_mysql
      status
    rescue Docker::Error::NotFoundError => exception
      puts
      puts exception.to_s.red
      puts
      1
    end

    def self.start
      DockerHelpers.ensure_docker_service
      status = 0
      status += DockerStart.start_mysql
      status += DockerStart.start_postgres
      status += DockerStart.start_rails
      status
    rescue Docker::Error::NotFoundError => exception
      puts
      puts exception.to_s.red
      puts
      1
    end

    def self.stop
      DockerHelpers.ensure_docker_service
      status = 0
      status += DockerStop.stop_rails
      status += DockerStop.stop_mysql
      status += DockerStop.stop_postgres
      status
    rescue Docker::Error::NotFoundError => exception
      puts exception.to_s.strip.red
      1
    end

    def self.delete
      DockerHelpers.ensure_docker_service
      status = 0
      status += DockerDelete.delete_rails
      status += DockerDelete.delete_mysql
      status += DockerDelete.delete_postgres
      status
    rescue Docker::Error::NotFoundError => exception
      puts exception.to_s.strip.red
      1
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dockerize_rails-1.2.2 lib/dockerize_rails/docker_commands.rb
dockerize_rails-1.2.1.beta.6 lib/dockerize_rails/docker_commands.rb