Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
manlon committed Mar 28, 2017
2 parents 27057c6 + 220c3ff commit 64db783
Show file tree
Hide file tree
Showing 72 changed files with 4,087 additions and 1,507 deletions.
5 changes: 3 additions & 2 deletions .rspec
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
--format documentation
--colour
--fail-fast
--format documentation
--order rand
--warnings
31 changes: 31 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
inherit_from: .rubocop_todo.yml

AllCops:
DisplayCopNames: true
Exclude:
- 'pkg/**/*'
- 'tmp/**/*'
- 'vendor/**/*'

Lint/EndAlignment:
AlignWith: variable

Style/CaseIndentation:
IndentWhenRelativeTo: end

Style/IndentHash:
EnforcedStyle: consistent

Style/TrailingComma:
EnforcedStyleForMultiline: consistent_comma

Style/TrivialAccessors:
AllowPredicates: true

# TODO: remove when we end support for < 1.9.3

Style/HashSyntax:
EnforcedStyle: hash_rockets

Style/Lambda:
Enabled: false
75 changes: 75 additions & 0 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2015-09-06 13:16:09 -0400 using RuboCop version 0.34.0.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 2
Metrics/AbcSize:
Max: 85

# Offense count: 1
Metrics/BlockNesting:
Max: 5

# Offense count: 1
Metrics/ClassLength:
Max: 125

# Offense count: 2
Metrics/CyclomaticComplexity:
Max: 30

# Offense count: 290
# Configuration parameters: AllowURI, URISchemes.
Metrics/LineLength:
Max: 232

# Offense count: 5
# Configuration parameters: CountComments.
Metrics/MethodLength:
Max: 60

# Offense count: 1
Metrics/PerceivedComplexity:
Max: 26

# Offense count: 40
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles, ProceduralMethods, FunctionalMethods, IgnoredMethods.
Style/BlockDelimiters:
Enabled: false

# Offense count: 12
Style/Documentation:
Exclude:
- 'benchmark/active_record.rb'
- 'benchmark/allocations.rb'
- 'benchmark/query_with_mysql_casting.rb'
- 'lib/mysql2.rb'
- 'lib/mysql2/client.rb'
- 'lib/mysql2/em.rb'
- 'lib/mysql2/error.rb'
- 'lib/mysql2/field.rb'
- 'lib/mysql2/result.rb'
- 'lib/mysql2/statement.rb'
- 'lib/mysql2/version.rb'

# Offense count: 9
# Configuration parameters: AllowedVariables.
Style/GlobalVars:
Exclude:
- 'ext/mysql2/extconf.rb'

# Offense count: 14
# Cop supports --auto-correct.
Style/NumericLiterals:
MinDigits: 20

# Offense count: 680
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/StringLiterals:
Enabled: false
134 changes: 88 additions & 46 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,60 +1,102 @@
sudo: required
dist: trusty
language: ruby
bundler_args: --without benchmarks
script:
- bundle exec rake spec
bundler_args: --without benchmarks development
# Pin Rubygems to a working version. Sometimes it breaks upstream. Update now and then.
before_install:
- gem --version
- |
bash -c " # Install MySQL 5.7 if DB=mysql57
if [[ x$DB =~ mysql57 ]]; then
sudo bash .travis_mysql57.sh
fi
"
- |
bash -c " # Install MariaDB if DB=mariadb
if [[ x$DB =~ xmariadb ]]; then
sudo bash .travis_mariadb.sh '$DB'
fi
"
- |
bash -c " # Install MySQL is OS=darwin
if [[ x$OSTYPE =~ ^xdarwin ]]; then
brew install mysql
mysql.server start
fi
"
- |
bash -c " # Configure SSL support
if [[ ! x$OSTYPE =~ ^xdarwin ]]; then
sudo bash .travis_ssl.sh
sudo service mysql restart
fi
"
- mysqld --version
- mysql -u root -e "CREATE DATABASE IF NOT EXISTS test"
- mysql -u root -e "CREATE USER '$USER'@'localhost'" || true
os:
- linux
- gem update --system 2.6.7
- gem update bundler
- gem --version
- bash .travis_setup.sh
addons:
hosts:
- mysql2gem.example.com
apt:
packages:
- mysql-server-5.6
- mysql-client-core-5.6
- mysql-client-5.6
rvm:
- 1.8.7
- 1.9.3
- 2.0.0
- 2.1
- 2.4
- 2.3
- 2.2
- ree
- 2.1
- 2.0.0
- 1.9.3
- ruby-head
matrix:
allow_failures:
- env: DB=mysql57
- rvm: rbx-2
- os: osx
include:
- rvm: 1.8.7
dist: precise
env: SPEC_OPTS="--order rand:11"
addons:
hosts:
- mysql2gem.example.com
apt:
packages:
- mysql-server-5.5
- mysql-client-core-5.5
- mysql-client-5.5
- rvm: ree
dist: precise
env: SPEC_OPTS="--order rand:11"
addons:
hosts:
- mysql2gem.example.com
apt:
packages:
- mysql-server-5.5
- mysql-client-core-5.5
- mysql-client-5.5
- rvm: 2.0.0
env: DB=mariadb55
addons:
mariadb: 5.5
hosts:
- mysql2gem.example.com
- rvm: 2.0.0
env: DB=mariadb10.0
addons:
mariadb: 10.0
hosts:
- mysql2gem.example.com
- rvm: 2.0.0
env: DB=mariadb10
env: DB=mariadb10.1
addons:
mariadb: 10.1
hosts:
- mysql2gem.example.com
- rvm: 2.0.0
env: DB=mysql55
dist: precise
addons:
hosts:
- mysql2gem.example.com
apt:
packages:
- mysql-server-5.5
- mysql-client-core-5.5
- mysql-client-5.5
- rvm: 2.0.0
env: DB=mysql57
- rvm: rbx-2
env: RBXOPT=-Xgc.honor_start=true
addons:
hosts:
- mysql2gem.example.com
- rvm: 2.0.0
env: DB=mysql80
addons:
hosts:
- mysql2gem.example.com
- rvm: 2.0.0
env: DB=mysql56
os: osx
addons:
hosts:
- mysql2gem.example.com
fast_finish: true
allow_failures:
- rvm: ruby-head
- rvm: 2.0.0
env: DB=mysql56
os: osx
15 changes: 0 additions & 15 deletions .travis_mariadb.sh

This file was deleted.

24 changes: 11 additions & 13 deletions .travis_mysql57.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
#!/bin/sh
#!/usr/bin/env bash

service mysql stop
set -eux

apt-get purge '^mysql*' 'libmysql*'
apt-get autoclean
apt-get purge -qq '^mysql*' '^libmysql*'
rm -fr /etc/mysql
rm -fr /var/lib/mysql
apt-key adv --keyserver pgp.mit.edu --recv-keys 5072E1F5
add-apt-repository 'deb http://repo.mysql.com/apt/ubuntu/ trusty mysql-5.7'
apt-get update -qq
apt-get install -qq mysql-server libmysqlclient-dev

rm -rf /var/lib/mysql
rm -rf /var/log/mysql

apt-get install python-software-properties
apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0x8C718D3B5072E1F5
add-apt-repository 'deb http://repo.mysql.com/apt/ubuntu/ precise mysql-5.7-dmr'

apt-get update
apt-get -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confold -y install mysql-server libmysqlclient-dev
# https://www.percona.com/blog/2016/03/16/change-user-password-in-mysql-5-7-with-plugin-auth_socket/
mysql -u root -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY ''"
14 changes: 14 additions & 0 deletions .travis_mysql80.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env bash

set -eux

apt-get purge -qq '^mysql*' '^libmysql*'
rm -fr /etc/mysql
rm -fr /var/lib/mysql
apt-key adv --keyserver pgp.mit.edu --recv-keys 5072E1F5
add-apt-repository 'deb http://repo.mysql.com/apt/ubuntu/ trusty mysql-8.0'
apt-get update -qq
apt-get install -qq mysql-server libmysqlclient-dev

# https://www.percona.com/blog/2016/03/16/change-user-password-in-mysql-5-7-with-plugin-auth_socket/
mysql -u root -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY ''"
36 changes: 36 additions & 0 deletions .travis_setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/usr/bin/env bash

set -eux

# Install MySQL 5.7 if DB=mysql57
if [[ -n ${DB-} && x$DB =~ ^xmysql57 ]]; then
sudo bash .travis_mysql57.sh
fi

# Install MySQL 8.0 if DB=mysql80
if [[ -n ${DB-} && x$DB =~ ^xmysql80 ]]; then
sudo bash .travis_mysql80.sh
fi

# Install MySQL if OS=darwin
if [[ x$OSTYPE =~ ^xdarwin ]]; then
brew update
brew install "$DB"
$(brew --prefix "$DB")/bin/mysql.server start
fi

# TODO: get SSL working on OS X in Travis
if ! [[ x$OSTYPE =~ ^xdarwin ]]; then
sudo bash .travis_ssl.sh
sudo service mysql restart
fi

# Print the MySQL version and create the test DB
if [[ x$OSTYPE =~ ^xdarwin ]]; then
$(brew --prefix "$DB")/bin/mysqld --version
$(brew --prefix "$DB")/bin/mysql -u root -e 'CREATE DATABASE IF NOT EXISTS test'
else
mysqld --version
# IF NOT EXISTS is mariadb-10+ only - https://mariadb.com/kb/en/mariadb/comment-syntax/
mysql -u root -e 'CREATE DATABASE /*M!50701 IF NOT EXISTS */ test'
fi
Loading

0 comments on commit 64db783

Please sign in to comment.