Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add information about compatibility, allow testing on Sqlite/MySQL/Po…

…stgreSQL
  • Loading branch information...
commit ae7c1346baf59154632b7a5d8b7e0ecf61f95055 1 parent acfd52b
@JonathanTron JonathanTron authored
View
6 .travis.yml
@@ -3,9 +3,13 @@ rvm:
- 1.9.2
- 1.9.3
- ruby-head
- - rbx-18mode
- rbx-19mode
+ - rbx-18mode
only:
- master
+env:
+ - DB=sqlite
+ - DB=mysql
+ - DB=postgres
notifications:
disabled: true
View
13 Gemfile
@@ -1,3 +1,16 @@
source 'https://rubygems.org'
gemspec
+
+platform :ruby_18 do
+ gem "sequel", "3.28.0"
+end
+
+case ENV["DB"]
+when "mysql"
+ gem "mysql2"
+when "postgres"
+ gem "pg"
+else
+ gem "sqlite3"
+end
View
9 README.md
@@ -1,5 +1,14 @@
# DelayedJob Sequel Backend
+## Compatibility
+
+This gem works on Ruby (MRI/CRuby) 1.8.x, 1.9.x and Rubinius (1.8 and 1.9 mode).
+
+But beware, if you're running it on Ruby (MRI/CRuby) 1.8.x or Rubinius in 1.8 mode you need
+to use a version of Sequel <= 3.28.0.
+
+It's strongly recommended to use a Ruby 1.9.x version.
+
## Installation
Add the gem to your Gemfile:
View
1  delayed_job_sequel.gemspec
@@ -21,5 +21,4 @@ Gem::Specification.new do |s|
s.add_development_dependency "rspec", "~> 2.0"
s.add_development_dependency "rake", "~> 0.8"
- s.add_development_dependency "sqlite3"
end
View
24 spec/spec_helper.rb
@@ -5,10 +5,30 @@
require "bundler/setup"
require "rspec"
require "logger"
-require "sqlite3"
require "sequel"
-DB = Sequel.sqlite
+DB = case ENV["DB"]
+when "mysql"
+ begin
+ Sequel.connect :adapter => "mysql2", :database => "delayed_jobs", :test => true
+ rescue Sequel::DatabaseConnectionError
+ system "mysql -e 'CREATE DATABASE IF NOT EXISTS `delayed_jobs` DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci'"
+ retry
+ end
+when "postgres"
+ begin
+ Sequel.connect :adapter => "postgres", :database => "delayed_jobs", :test => true
+ rescue Sequel::DatabaseConnectionError
+ system "createdb --encoding=UTF8 delayed_jobs"
+ retry
+ end
+else
+ Sequel.sqlite
+end
+
+DB.drop_table :delayed_jobs rescue Sequel::DatabaseError
+DB.drop_table :stories rescue Sequel::DatabaseError
+
DB.create_table :delayed_jobs do
primary_key :id
Integer :priority, :default => 0
Please sign in to comment.
Something went wrong with that request. Please try again.