Sha256: c64e2e3fd288795eb0e5352076f59707782a04b1d9bd6daa649ca9ef4aa3af82

Contents?: true

Size: 1.31 KB

Versions: 1

Compression:

Stored size: 1.31 KB

Contents

class Recipes::Ci < Rails::AppBuilder
  def create
    if get(:heroku)
      copy_file '../assets/Dockerfile.ci', 'Dockerfile.ci'
      copy_file '../assets/circle.yml', 'circle.yml'

      template '../assets/bin/cibuild.erb', 'bin/cibuild'
      run "chmod a+x bin/cibuild"

      copy_file '../assets/docker-compose.ci.yml', 'docker-compose.ci.yml'

      compose = DockerHelpers.new('docker-compose.ci.yml')

      if selected?(:database, :mysql)
        service = <<-YAML
          image: "mysql:5.6.23"
          environment:
            MYSQL_ALLOW_EMPTY_PASSWORD: 'true'
        YAML
        compose.add_service("mysql", service)
        compose.add_link('test', 'mysql')
        compose.add_env('test', 'MYSQL_HOST', 'mysql')
        compose.add_env('test', 'MYSQL_PORT', '3306')

      elsif selected?(:database, :postgresql)
        service = <<-YAML
          image: "postgres:9.4.5"
          environment:
            POSTGRES_USER: postgres
            POSTGRES_PASSWORD: ''
        YAML
        compose.add_service("postgresql", service)
        compose.add_link('test', 'postgresql')
        compose.add_env('test', 'POSTGRESQL_USER', 'postgres')
        compose.add_env('test', 'POSTGRESQL_HOST', 'postgresql')
        compose.add_env('test', 'POSTGRESQL_PORT', '5432')
      end

      add_readme_header :ci
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
potassium-2.0.0 lib/potassium/recipes/ci.rb