Sha256: 9dedc7dd98d8864832d6dcd9e50c95df7b3ee0ddd51d6cc7f40ecabd0f5018a0

Contents?: true

Size: 786 Bytes

Versions: 1

Compression:

Stored size: 786 Bytes

Contents

module Evrone
  module CI
    class Router
      class ScriptBuilder

        Databases = Struct.new(:app) do

          def call(env)
            psql = []
            psql << %{sudo -u postgres psql -q -h localhost -c "create role ci with login superuser password 'ci'" || true}
            psql << %{sudo -u postgres psql -q -h localhost -c "create database ci" || true}

            mysql = []

            mysql << %w{echo "CREATE USER 'ci'@'localhost';" | mysql -u root }
            mysql << %w{echo "GRANT ALL PRIVILEGES ON *.* TO 'ci'@'localhost';" | mysql -u root }

            env.init.tap do |i|
              psql.each {|c| i << c }
              mysql.each {|c| i << c }
            end

            app.call(env)
          end

        end
      end
    end
  end
end


Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
evrone-ci-router-0.2.0.pre13 lib/evrone/ci/router/script_builder/databases.rb