Skip to content

Commit

Permalink
Merge 13533a0 into 57098c1
Browse files Browse the repository at this point in the history
  • Loading branch information
dcaddell committed Oct 20, 2020
2 parents 57098c1 + 13533a0 commit 1779520
Show file tree
Hide file tree
Showing 27 changed files with 1,478 additions and 1 deletion.
13 changes: 13 additions & 0 deletions .gitignore
@@ -0,0 +1,13 @@
/.bundle/
/.yardoc
/_yardoc/
/coverage/
/doc/
/gemfiles/*.lock
/pkg/
/spec/reports/
/tmp/
/.idea

# rspec failure tracking
.rspec_status
3 changes: 3 additions & 0 deletions .rspec
@@ -0,0 +1,3 @@
--format progress
--color
--require spec_helper
12 changes: 12 additions & 0 deletions .travis.yml
@@ -0,0 +1,12 @@
---
sudo: false
language: ruby
cache: bundler
rvm:
- 2.6.1
gemfile:
- gemfiles/rails_4.gemfile
- gemfiles/rails_5.gemfile
- gemfiles/rails_6.gemfile
script:
- bundle exec rspec
13 changes: 13 additions & 0 deletions Appraisals
@@ -0,0 +1,13 @@
# frozen_string_literal: true

appraise 'rails-4' do
gem 'rails', '~> 4.2'
end

appraise 'rails-5' do
gem 'rails', '~> 5.2'
end

appraise 'rails-6' do
gem 'rails', '~> 6.0'
end
14 changes: 14 additions & 0 deletions CHANGELOG.md
@@ -0,0 +1,14 @@
# CHANGELOG for `fibered_mysql2`

Inspired by [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

Note: this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.1.0] - Unreleased
### Added
- Added an adapter for Rails 4, 5, and 6.
- Added appraisals for Rails 4, 5, and 6.
- Added TravisCI unit test pipeline.
- Added coverage reports via Coveralls.

[0.1.0]: https://github.com/Invoca/fibered_mysql2/tree/v0.1.0
15 changes: 15 additions & 0 deletions Gemfile
@@ -0,0 +1,15 @@
source "https://rubygems.org"

git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }

# Specify your gem's dependencies in fibered_mysql2.gemspec
gemspec

gem 'appraisal'
gem 'bundler', '~> 1.8'
gem 'coveralls', require: false
gem 'mysql2', '0.4.5'
gem 'pry', '~> 0.13'
gem 'pry-byebug', '~> 3.9'
gem 'rake', '~> 10.0'
gem 'rspec', '~> 3.0'
198 changes: 198 additions & 0 deletions Gemfile.lock
@@ -0,0 +1,198 @@
PATH
remote: .
specs:
fibered_mysql2 (0.1.0.pre.5)
em-synchrony (~> 1.0)
rails (>= 4.2, < 7)

GEM
remote: https://rubygems.org/
specs:
actioncable (6.0.3.4)
actionpack (= 6.0.3.4)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailbox (6.0.3.4)
actionpack (= 6.0.3.4)
activejob (= 6.0.3.4)
activerecord (= 6.0.3.4)
activestorage (= 6.0.3.4)
activesupport (= 6.0.3.4)
mail (>= 2.7.1)
actionmailer (6.0.3.4)
actionpack (= 6.0.3.4)
actionview (= 6.0.3.4)
activejob (= 6.0.3.4)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (6.0.3.4)
actionview (= 6.0.3.4)
activesupport (= 6.0.3.4)
rack (~> 2.0, >= 2.0.8)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (6.0.3.4)
actionpack (= 6.0.3.4)
activerecord (= 6.0.3.4)
activestorage (= 6.0.3.4)
activesupport (= 6.0.3.4)
nokogiri (>= 1.8.5)
actionview (6.0.3.4)
activesupport (= 6.0.3.4)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
activejob (6.0.3.4)
activesupport (= 6.0.3.4)
globalid (>= 0.3.6)
activemodel (6.0.3.4)
activesupport (= 6.0.3.4)
activerecord (6.0.3.4)
activemodel (= 6.0.3.4)
activesupport (= 6.0.3.4)
activestorage (6.0.3.4)
actionpack (= 6.0.3.4)
activejob (= 6.0.3.4)
activerecord (= 6.0.3.4)
marcel (~> 0.3.1)
activesupport (6.0.3.4)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
zeitwerk (~> 2.2, >= 2.2.2)
appraisal (2.3.0)
bundler
rake
thor (>= 0.14.0)
builder (3.2.4)
byebug (11.1.3)
coderay (1.1.3)
concurrent-ruby (1.1.7)
coveralls (0.8.23)
json (>= 1.8, < 3)
simplecov (~> 0.16.1)
term-ansicolor (~> 1.3)
thor (>= 0.19.4, < 2.0)
tins (~> 1.6)
crass (1.0.6)
diff-lcs (1.4.4)
docile (1.3.2)
em-synchrony (1.0.6)
eventmachine (>= 1.0.0.beta.1)
erubi (1.9.0)
eventmachine (1.2.7)
globalid (0.4.2)
activesupport (>= 4.2.0)
i18n (1.8.5)
concurrent-ruby (~> 1.0)
json (2.3.1)
loofah (2.7.0)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
mail (2.7.1)
mini_mime (>= 0.1.1)
marcel (0.3.3)
mimemagic (~> 0.3.2)
method_source (1.0.0)
mimemagic (0.3.5)
mini_mime (1.0.2)
mini_portile2 (2.4.0)
minitest (5.14.2)
mysql2 (0.4.5)
nio4r (2.5.4)
nokogiri (1.10.10)
mini_portile2 (~> 2.4.0)
pry (0.13.1)
coderay (~> 1.1)
method_source (~> 1.0)
pry-byebug (3.9.0)
byebug (~> 11.0)
pry (~> 0.13.0)
rack (2.2.3)
rack-test (1.1.0)
rack (>= 1.0, < 3)
rails (6.0.3.4)
actioncable (= 6.0.3.4)
actionmailbox (= 6.0.3.4)
actionmailer (= 6.0.3.4)
actionpack (= 6.0.3.4)
actiontext (= 6.0.3.4)
actionview (= 6.0.3.4)
activejob (= 6.0.3.4)
activemodel (= 6.0.3.4)
activerecord (= 6.0.3.4)
activestorage (= 6.0.3.4)
activesupport (= 6.0.3.4)
bundler (>= 1.3.0)
railties (= 6.0.3.4)
sprockets-rails (>= 2.0.0)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
rails-html-sanitizer (1.3.0)
loofah (~> 2.3)
railties (6.0.3.4)
actionpack (= 6.0.3.4)
activesupport (= 6.0.3.4)
method_source
rake (>= 0.8.7)
thor (>= 0.20.3, < 2.0)
rake (10.5.0)
rspec (3.9.0)
rspec-core (~> 3.9.0)
rspec-expectations (~> 3.9.0)
rspec-mocks (~> 3.9.0)
rspec-core (3.9.3)
rspec-support (~> 3.9.3)
rspec-expectations (3.9.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.9.0)
rspec-mocks (3.9.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.9.0)
rspec-support (3.9.3)
simplecov (0.16.1)
docile (~> 1.1)
json (>= 1.8, < 3)
simplecov-html (~> 0.10.0)
simplecov-html (0.10.2)
sprockets (4.0.2)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-rails (3.2.2)
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
sync (0.5.0)
term-ansicolor (1.7.1)
tins (~> 1.0)
thor (1.0.1)
thread_safe (0.3.6)
tins (1.25.0)
sync
tzinfo (1.2.7)
thread_safe (~> 0.1)
websocket-driver (0.7.3)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
zeitwerk (2.4.0)

PLATFORMS
ruby

DEPENDENCIES
appraisal
bundler (~> 1.8)
coveralls
fibered_mysql2!
mysql2 (= 0.4.5)
pry (~> 0.13)
pry-byebug (~> 3.9)
rake (~> 10.0)
rspec (~> 3.0)

BUNDLED WITH
1.17.2
44 changes: 43 additions & 1 deletion README.md
@@ -1 +1,43 @@
# fibered_mysql2
[![Coverage Status](https://coveralls.io/repos/github/Invoca/fibered_mysql2/badge.svg?branch=master)](https://coveralls.io/github/Invoca/fibered_mysql2?branch=master)

# FiberedMysql2

FiberedMysql2 adds Fiber support to `ActiveRecord::ConnectionAdapters::EMMysql2Adapter`

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'fibered_mysql2'
```

And then execute:

$ bundle

Or install it yourself as:

$ gem install fibered_mysql2

## Support
Tested with Rails versions 4.2, 5.2, and 6.0.

## Usage

Behaves the same as `ActiveRecord::ConnectionAdapters::EMMysql2Adapter` but with added Fiber safety while leasing/expiring connections.
```ruby
connection = FiberedMysql2::FiberedMysql2Adapter.new(client, logger, options, config)
connection.lease
connection.expire # Rails 5+ only
```

## Development

After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).

## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/invoca/fibered_mysql2.
8 changes: 8 additions & 0 deletions Rakefile
@@ -0,0 +1,8 @@
# frozen_string_literal: true

require "bundler/gem_tasks"
require "rspec/core/rake_task"

RSpec::Core::RakeTask.new(:spec)

task :default => :spec
14 changes: 14 additions & 0 deletions bin/console
@@ -0,0 +1,14 @@
#!/usr/bin/env ruby

require "bundler/setup"
require "fibered_mysql2"

# You can add fixtures and/or initialization code here to make experimenting
# with your gem easier. You can also use a different console, if you like.

# (If you use this, don't forget to add pry to your Gemfile!)
# require "pry"
# Pry.start

require "irb"
IRB.start(__FILE__)
8 changes: 8 additions & 0 deletions bin/setup
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
set -vx

bundle install

# Do any other automated setup that you need to do here
34 changes: 34 additions & 0 deletions fibered_mysql2.gemspec
@@ -0,0 +1,34 @@
# frozen_string_literal: true

lib = File.expand_path("lib", __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "fibered_mysql2/version"

Gem::Specification.new do |spec|
spec.name = "fibered_mysql2"
spec.version = FiberedMysql2::VERSION
spec.authors = ["Invoca Development"]
spec.email = ["development@invoca.com"]

spec.summary = "An adapter for fibered mysql2"
spec.homepage = "https://github.com/Invoca/fibered_mysql2"

# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
# to allow pushing to a single host or delete this section to allow pushing to any host.
spec.metadata = {
"allowed_push_host" => "https://rubygems.org",
"homepage_uri" => spec.homepage
}

# Specify which files should be added to the gem when it is released.
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
spec.files = Dir.chdir(File.expand_path(__dir__)) do
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
end
spec.bindir = "exe"
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]

spec.add_dependency 'em-synchrony', '~> 1.0'
spec.add_dependency 'rails', '>= 4.2', '< 7'
end

0 comments on commit 1779520

Please sign in to comment.