From 78c91a1a78c5b949f7ffef72fec007e7b746e328 Mon Sep 17 00:00:00 2001 From: "NARUSE, Yui" Date: Tue, 1 Dec 2015 15:29:16 +0900 Subject: [PATCH] Remove sqlite support --- lib/perfectqueue/backend/rdb_compat.rb | 10 ++-------- perfectqueue.gemspec | 1 - spec/rdb_compat_backend_spec.rb | 8 +------- 3 files changed, 3 insertions(+), 16 deletions(-) diff --git a/lib/perfectqueue/backend/rdb_compat.rb b/lib/perfectqueue/backend/rdb_compat.rb index 79494c7..66b7a67 100644 --- a/lib/perfectqueue/backend/rdb_compat.rb +++ b/lib/perfectqueue/backend/rdb_compat.rb @@ -37,13 +37,7 @@ def initialize(client, config) #password = config[:password] #user = config[:user] - case url.split('//',2)[0].to_s - when /sqlite/i - @db = Sequel.connect(url, :max_connections=>1) - # sqlite always locks tables on BEGIN - @table_lock = nil - @table_unlock = nil - when /mysql/i + if /\Amysql/i =~ url require 'uri' uri = URI.parse(url) @@ -76,7 +70,7 @@ def initialize(client, config) @db.run("SELECT RELEASE_LOCK('#{@table}')") } else - raise ConfigError, "'sqlite' and 'mysql' are supported" + raise ConfigError, "only 'mysql' is supported" end @last_time = Time.now.to_i diff --git a/perfectqueue.gemspec b/perfectqueue.gemspec index 3c0e89e..6e30dc2 100644 --- a/perfectqueue.gemspec +++ b/perfectqueue.gemspec @@ -21,6 +21,5 @@ Gem::Specification.new do |gem| gem.add_development_dependency "rake", "~> 0.9.2" gem.add_development_dependency "rspec", "~> 3.3.0" gem.add_development_dependency "simplecov", "~> 0.10.0" - gem.add_development_dependency "sqlite3", "~> 1.3.3" gem.add_development_dependency "mysql2", "~> 0.3.20" end diff --git a/spec/rdb_compat_backend_spec.rb b/spec/rdb_compat_backend_spec.rb index b448f14..52d754f 100644 --- a/spec/rdb_compat_backend_spec.rb +++ b/spec/rdb_compat_backend_spec.rb @@ -76,7 +76,7 @@ let (:now){ Time.now.to_i } let (:client){ double('client') } let (:table){ 'test_queues' } - let (:config){ {url: 'sqlite://spec/test.db', table: table} } + let (:config){ {url: 'mysql://root:@localhost/perfectqueue_test', table: table} } let (:db) do d = Backend::RDBCompatBackend.new(client, config) s = d.db @@ -94,13 +94,7 @@ it 'raises error unless table' do expect{Backend::RDBCompatBackend.new(client, {url: ''})}.to raise_error(ConfigError) end - it 'supports sqlite' do - config = {url: 'sqlite://localhost', table: table} - expect(Backend::RDBCompatBackend.new(client, config)).to be_an_instance_of(Backend::RDBCompatBackend) - expect(db.instance_variable_get(:@sql)).to include('max_running') - end it 'supports mysql' do - config = {url: 'mysql://root:@localhost/perfectqueue_test', table: table} expect(Backend::RDBCompatBackend.new(client, config)).to be_an_instance_of(Backend::RDBCompatBackend) expect(db.instance_variable_get(:@sql)).to include('max_running') end