sequel-rails 0.4.0.pre2 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +2 -0
- data/History.md +18 -0
- data/README.md +11 -1
- data/lib/sequel_rails/migrations.rb +12 -14
- data/lib/sequel_rails/railtie.rb +0 -11
- data/lib/sequel_rails/railties/database.rake +11 -20
- data/lib/sequel_rails/railties/legacy_model_config.rb +6 -0
- data/lib/sequel_rails/storage.rb +23 -6
- data/lib/sequel_rails/storage/abstract.rb +5 -0
- data/lib/sequel_rails/storage/postgres.rb +17 -0
- data/lib/sequel_rails/version.rb +1 -1
- data/sequel-rails.gemspec +2 -2
- data/spec/internal/Rakefile +10 -0
- data/spec/lib/sequel_rails/migrations_spec.rb +57 -0
- data/spec/lib/sequel_rails/railtie_spec.rb +8 -22
- data/spec/lib/sequel_rails/storage_spec.rb +33 -2
- metadata +35 -27
data/Gemfile
CHANGED
data/History.md
CHANGED
@@ -1,3 +1,21 @@
|
|
1
|
+
0.4.0 (2013-03-06)
|
2
|
+
==================
|
3
|
+
|
4
|
+
* Ensure we've dropped any opened connection before trying to drop database (Ed Ruder)
|
5
|
+
* Make dependency on railtie looser (`>= 3.2.0`)
|
6
|
+
* Do not add any Sequel plugin by default anymore. Plugins could not be removed
|
7
|
+
so it is safer to let the user add them via an initializer. Furthermore, we
|
8
|
+
were changing the default Sequel behaviour related to 'raise on save'.
|
9
|
+
All the previous plugins/behaviours of sequel-rails can be restored by
|
10
|
+
creating an initializer with:
|
11
|
+
|
12
|
+
```ruby
|
13
|
+
require "sequel_rails/railties/legacy_model_config"
|
14
|
+
```
|
15
|
+
|
16
|
+
Thanks to @dlee, for raising concerns about this behaviour in
|
17
|
+
[#11](https://github.com/TalentBox/sequel-rails/pull/11)
|
18
|
+
|
1
19
|
0.4.0.pre2
|
2
20
|
==========
|
3
21
|
|
data/README.md
CHANGED
@@ -2,6 +2,7 @@ sequel-rails
|
|
2
2
|
============
|
3
3
|
|
4
4
|
[![Build Status](https://travis-ci.org/TalentBox/sequel-rails.png?branch=master)](https://travis-ci.org/TalentBox/sequel-rails)
|
5
|
+
[![Code Climate](https://codeclimate.com/github/TalentBox/sequel-rails.png)](https://codeclimate.com/github/TalentBox/sequel-rails)
|
5
6
|
|
6
7
|
This gem provides the railtie that allows [sequel](http://github.com/jeremyevans/sequel) to hook into [rails3](http://github.com/rails/rails) and thus behave like a rails framework component. Just like activerecord does in rails, [sequel-rails](http://github.com/talentbox/sequel-rails) uses the railtie API to hook into rails. The two are actually hooked into rails almost identically.
|
7
8
|
|
@@ -41,6 +42,14 @@ require "action_mailer/railtie"
|
|
41
42
|
require "sprockets/railtie"
|
42
43
|
```
|
43
44
|
|
45
|
+
Starting with sequel-rails 0.4.0.pre3 we don't change default Sequel behaviour
|
46
|
+
nor include any plugin by default, if you want to get back the previous
|
47
|
+
behaviour, you can create a new initializer (eg: `config/initializers/sequel.rb`) with content:
|
48
|
+
|
49
|
+
```ruby
|
50
|
+
require "sequel_rails/railties/legacy_model_config"
|
51
|
+
```
|
52
|
+
|
44
53
|
After those changes, you should be good to go!
|
45
54
|
|
46
55
|
Available sequel specific rake tasks
|
@@ -114,11 +123,12 @@ Improvements has been made by those awesome contributors:
|
|
114
123
|
* Arron Washington (radicaled)
|
115
124
|
* Thiago Pradi (tchandy)
|
116
125
|
* Sascha Cunz (scunz)
|
126
|
+
* Brian Donovan (eventualbuddha)
|
117
127
|
|
118
128
|
Credits
|
119
129
|
=======
|
120
130
|
|
121
|
-
The [dm-rails](http://github.com/datamapper/dm-rails) team wrote most of the original code, I just sequel-ized it, but since then most of it as been either
|
131
|
+
The [dm-rails](http://github.com/datamapper/dm-rails) team wrote most of the original code, I just sequel-ized it, but since then most of it as been either adapted or rewritten.
|
122
132
|
|
123
133
|
Copyright
|
124
134
|
=========
|
@@ -2,21 +2,19 @@ require 'sequel/extensions/migration'
|
|
2
2
|
|
3
3
|
module SequelRails
|
4
4
|
class Migrations
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
opts[:target] = version.to_i if version
|
14
|
-
::Sequel::Migrator.run(::Sequel::Model.db, "db/migrate", opts)
|
15
|
-
end
|
5
|
+
class << self
|
6
|
+
def migrate(version=nil)
|
7
|
+
opts = {}
|
8
|
+
opts[:target] = version.to_i if version
|
9
|
+
::Sequel::Migrator.run(::Sequel::Model.db, "db/migrate", opts)
|
10
|
+
end
|
11
|
+
alias_method :migrate_up!, :migrate
|
12
|
+
alias_method :migrate_down!, :migrate
|
16
13
|
|
17
|
-
|
18
|
-
|
19
|
-
|
14
|
+
def pending_migrations?
|
15
|
+
return false unless File.exists?("db/migrate")
|
16
|
+
!::Sequel::Migrator.is_current?(::Sequel::Model.db, "db/migrate")
|
17
|
+
end
|
20
18
|
end
|
21
19
|
end
|
22
20
|
end
|
data/lib/sequel_rails/railtie.rb
CHANGED
@@ -16,7 +16,6 @@ require "sequel_rails/migrations"
|
|
16
16
|
require "sequel_rails/railties/log_subscriber"
|
17
17
|
require "sequel_rails/railties/i18n_support"
|
18
18
|
require "sequel_rails/railties/controller_runtime"
|
19
|
-
require "sequel_rails/sequel/plugins/rails_extensions"
|
20
19
|
require "sequel_rails/sequel/database/active_support_notification"
|
21
20
|
|
22
21
|
module SequelRails
|
@@ -59,16 +58,6 @@ module SequelRails
|
|
59
58
|
::SequelRails.setup ::Rails.env
|
60
59
|
end
|
61
60
|
|
62
|
-
# Run setup code after_initialize to make sure all config/initializers
|
63
|
-
# are in effect once we setup the connection. This is especially necessary
|
64
|
-
# for the cascaded adapter wrappers that need to be declared before setup.
|
65
|
-
config.after_initialize do |app|
|
66
|
-
::Sequel::Model.plugin :active_model
|
67
|
-
::Sequel::Model.plugin :validation_helpers
|
68
|
-
::Sequel::Model.plugin :rails_extensions
|
69
|
-
::Sequel::Model.raise_on_save_failure = false
|
70
|
-
end
|
71
|
-
|
72
61
|
# Support overwriting crucial steps in subclasses
|
73
62
|
def configure_sequel(app)
|
74
63
|
app.config.sequel = ::SequelRails::Configuration.for(
|
@@ -54,7 +54,7 @@ namespace :db do
|
|
54
54
|
task :create, [:env] => :environment do |t, args|
|
55
55
|
args.with_defaults(:env => Rails.env)
|
56
56
|
|
57
|
-
unless SequelRails::Storage.
|
57
|
+
unless SequelRails::Storage.create_environment(args.env)
|
58
58
|
abort "Could not create database for #{args.env}."
|
59
59
|
end
|
60
60
|
end
|
@@ -68,11 +68,11 @@ namespace :db do
|
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
71
|
-
desc "
|
71
|
+
desc "Drop the database defined in config/database.yml for the current Rails.env"
|
72
72
|
task :drop, [:env] => :environment do |t, args|
|
73
73
|
args.with_defaults(:env => Rails.env)
|
74
74
|
|
75
|
-
unless SequelRails::Storage.
|
75
|
+
unless SequelRails::Storage.drop_environment(args.env)
|
76
76
|
abort "Could not drop database for #{args.env}."
|
77
77
|
end
|
78
78
|
end
|
@@ -132,29 +132,20 @@ namespace :db do
|
|
132
132
|
task :reset => [ 'db:drop', 'db:setup' ]
|
133
133
|
|
134
134
|
desc 'Forcibly close any open connections to the current env database (PostgreSQL specific)'
|
135
|
-
task :force_close_open_connections => :environment do
|
136
|
-
|
137
|
-
|
138
|
-
# Will only work on Postgres > 8.4
|
139
|
-
pid_column = db_for_current_env.server_version < 90200 ? "procpid" : "pid"
|
140
|
-
db_for_current_env.execute <<-SQL.gsub(/^\s{9}/,'')
|
141
|
-
SELECT COUNT(pg_terminate_backend(#{pid_column}))
|
142
|
-
FROM pg_stat_activity
|
143
|
-
WHERE datname = '#{db_for_current_env.opts[:database]}';
|
144
|
-
SQL
|
145
|
-
rescue => e
|
146
|
-
#Will raise an error as it kills existing process running this command
|
147
|
-
#Seems to be only way to ensure *all* test connections are closed
|
148
|
-
end
|
149
|
-
end
|
135
|
+
task :force_close_open_connections, [:env] => :environment do |t, args|
|
136
|
+
args.with_defaults(:env => Rails.env)
|
137
|
+
SequelRails::Storage.close_connections_environment(argv.env)
|
150
138
|
end
|
151
139
|
|
152
140
|
namespace :test do
|
153
141
|
desc "Prepare test database (ensure all migrations ran, drop and re-create database then load schema). This task can be run in the same invocation as other task (eg: rake db:migrate db:test:prepare)."
|
154
142
|
task :prepare => "db:abort_if_pending_migrations" do
|
155
143
|
previous_env, Rails.env = Rails.env, 'test'
|
156
|
-
|
157
|
-
|
144
|
+
begin
|
145
|
+
Rake::Task['db:drop'].execute
|
146
|
+
rescue Exception => e
|
147
|
+
$stderr.puts "Could not drop test db: #{e.message}"
|
148
|
+
end
|
158
149
|
Rake::Task['db:create'].execute
|
159
150
|
Rake::Task['db:schema:load'].execute
|
160
151
|
Sequel::DATABASES.each do |db|
|
data/lib/sequel_rails/storage.rb
CHANGED
@@ -15,12 +15,22 @@ module SequelRails
|
|
15
15
|
with_local_repositories { |config| drop_environment(config) }
|
16
16
|
end
|
17
17
|
|
18
|
-
def self.create_environment(
|
19
|
-
adapter_for(
|
18
|
+
def self.create_environment(config_or_env)
|
19
|
+
adapter_for(config_or_env).create
|
20
20
|
end
|
21
21
|
|
22
|
-
def self.drop_environment(
|
23
|
-
adapter_for(
|
22
|
+
def self.drop_environment(config_or_env)
|
23
|
+
adapter = adapter_for(config_or_env)
|
24
|
+
adapter.close_connections
|
25
|
+
adapter.drop
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.close_all_connections
|
29
|
+
with_all_repositories { |config| close_connections_environment(config) }
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.close_connections_environment(config_or_env)
|
33
|
+
adapter_for(config_or_env).close_connections
|
24
34
|
end
|
25
35
|
|
26
36
|
def self.adapter_for(config_or_env)
|
@@ -36,7 +46,7 @@ module SequelRails
|
|
36
46
|
|
37
47
|
def self.with_local_repositories
|
38
48
|
::SequelRails.configuration.environments.each_value do |config|
|
39
|
-
next if config['database'].blank?
|
49
|
+
next if config['database'].blank? || config['adapter'].blank?
|
40
50
|
if config['host'].blank? || %w[ 127.0.0.1 localhost ].include?(config['host'])
|
41
51
|
yield config
|
42
52
|
else
|
@@ -45,9 +55,16 @@ module SequelRails
|
|
45
55
|
end
|
46
56
|
end
|
47
57
|
|
58
|
+
def self.with_all_repositories
|
59
|
+
::SequelRails.configuration.environments.each_value do |config|
|
60
|
+
next if config['database'].blank? || config['adapter'].blank?
|
61
|
+
yield config
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
48
65
|
def self.lookup_class(adapter)
|
66
|
+
raise "Adapter not specified in config, please set the :adapter key." unless adapter
|
49
67
|
klass_name = adapter.camelize.to_sym
|
50
|
-
|
51
68
|
unless self.const_defined?(klass_name)
|
52
69
|
raise "Adapter #{adapter} not supported (#{klass_name.inspect})"
|
53
70
|
end
|
@@ -25,6 +25,23 @@ module SequelRails
|
|
25
25
|
ENV["PGPASSWORD"] = nil unless password.blank?
|
26
26
|
res
|
27
27
|
end
|
28
|
+
|
29
|
+
def close_connections
|
30
|
+
begin
|
31
|
+
db = ::Sequel.connect(config)
|
32
|
+
# Will only work on Postgres > 8.4
|
33
|
+
pid_column = db.server_version < 90200 ? "procpid" : "pid"
|
34
|
+
db.execute <<-SQL.gsub(/^\s{12}/,'')
|
35
|
+
SELECT COUNT(pg_terminate_backend(#{pid_column}))
|
36
|
+
FROM pg_stat_activity
|
37
|
+
WHERE datname = '#{database}';
|
38
|
+
SQL
|
39
|
+
rescue => _
|
40
|
+
# Will raise an error as it kills existing process running this
|
41
|
+
# command. Seems to be only way to ensure *all* test connections
|
42
|
+
# are closed
|
43
|
+
end
|
44
|
+
end
|
28
45
|
end
|
29
46
|
end
|
30
47
|
end
|
data/lib/sequel_rails/version.rb
CHANGED
data/sequel-rails.gemspec
CHANGED
@@ -19,8 +19,8 @@ Gem::Specification.new do |s|
|
|
19
19
|
s.extra_rdoc_files = ["LICENSE", "README.md"]
|
20
20
|
s.rdoc_options = ["--charset=UTF-8"]
|
21
21
|
|
22
|
-
s.add_runtime_dependency
|
23
|
-
s.add_runtime_dependency
|
22
|
+
s.add_runtime_dependency "sequel", "~> 3.28"
|
23
|
+
s.add_runtime_dependency "railties", ">= 3.2.0"
|
24
24
|
|
25
25
|
s.add_development_dependency "rake", ">= 0.8.7"
|
26
26
|
s.add_development_dependency "rspec", "~> 2.7.0"
|
@@ -0,0 +1,10 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
Bundler.require :default, :development, :test
|
7
|
+
|
8
|
+
Combustion.path = ""
|
9
|
+
Combustion.initialize! "sequel_rails"
|
10
|
+
Combustion::Application.load_tasks
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "fakefs/spec_helpers"
|
3
|
+
|
4
|
+
describe SequelRails::Migrations do
|
5
|
+
let!(:db) { ::Sequel::Model.db }
|
6
|
+
|
7
|
+
[:migrate_up!, :migrate_down!].each do |migration_method|
|
8
|
+
describe ".#{migration_method}" do
|
9
|
+
let(:result) { mock :result }
|
10
|
+
context "with no version specified" do
|
11
|
+
let(:opts) { {} }
|
12
|
+
it "runs migrations using Sequel::Migrator" do
|
13
|
+
::Sequel::Migrator.should_receive(:run).with(
|
14
|
+
db, "db/migrate", opts
|
15
|
+
).and_return result
|
16
|
+
described_class.send(migration_method).should be result
|
17
|
+
end
|
18
|
+
end
|
19
|
+
context "with version specified" do
|
20
|
+
let(:opts) { {target: 1} }
|
21
|
+
it "runs migrations using Sequel::Migrator" do
|
22
|
+
::Sequel::Migrator.should_receive(:run).with(
|
23
|
+
db, "db/migrate", opts
|
24
|
+
).and_return result
|
25
|
+
described_class.send(migration_method, 1).should be result
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
describe ".pending_migrations?" do
|
32
|
+
include FakeFS::SpecHelpers
|
33
|
+
let(:path) { "db/migrate" }
|
34
|
+
|
35
|
+
it "returns false if no db/migrate directory exists" do
|
36
|
+
described_class.pending_migrations?.should == false
|
37
|
+
end
|
38
|
+
|
39
|
+
context "when db/migrate directory exists" do
|
40
|
+
before { FileUtils.mkdir_p path }
|
41
|
+
|
42
|
+
it "returns true if any pending migration" do
|
43
|
+
::Sequel::Migrator.should_receive(:is_current?).with(
|
44
|
+
db, "db/migrate"
|
45
|
+
).and_return false
|
46
|
+
described_class.pending_migrations?.should == true
|
47
|
+
end
|
48
|
+
|
49
|
+
it "returns false if no pending migration" do
|
50
|
+
::Sequel::Migrator.should_receive(:is_current?).with(
|
51
|
+
db, "db/migrate"
|
52
|
+
).and_return true
|
53
|
+
described_class.pending_migrations?.should == false
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -1,6 +1,8 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
3
|
describe SequelRails::Railtie do
|
4
|
+
let(:app) { Combustion::Application }
|
5
|
+
|
4
6
|
it "registers ::Sequel::Railtie::LogSubscriber to receive :sequel notification" do
|
5
7
|
ActiveSupport::LogSubscriber.log_subscribers.select do |subscriber|
|
6
8
|
subscriber.is_a?(SequelRails::Railties::LogSubscriber)
|
@@ -9,21 +11,21 @@ describe SequelRails::Railtie do
|
|
9
11
|
|
10
12
|
context "configures generator to use Sequel" do
|
11
13
|
it "as orm" do
|
12
|
-
|
14
|
+
app.config.generators.options[:rails][:orm].should == :sequel
|
13
15
|
end
|
14
16
|
|
15
17
|
it "for migrations" do
|
16
|
-
|
18
|
+
app.config.generators.options[:sequel][:migration].should be true
|
17
19
|
end
|
18
20
|
end
|
19
21
|
|
20
22
|
it "configures rails to use fancy pants logging" do
|
21
|
-
|
23
|
+
app.config.rails_fancy_pants_logging.should be true
|
22
24
|
end
|
23
25
|
|
24
26
|
context "configures action dispatch's rescue responses" do
|
25
27
|
let(:rescue_responses) do
|
26
|
-
|
28
|
+
app.config.action_dispatch.rescue_responses
|
27
29
|
end
|
28
30
|
|
29
31
|
it "to handle Sequel::Plugins::RailsExtensions::ModelNotFound with :not_found" do
|
@@ -44,11 +46,11 @@ describe SequelRails::Railtie do
|
|
44
46
|
end
|
45
47
|
|
46
48
|
it "stores it's own config in app.config.sequel" do
|
47
|
-
|
49
|
+
app.config.sequel.should be_instance_of SequelRails::Configuration
|
48
50
|
end
|
49
51
|
|
50
52
|
it "sets Rails.logger as default logger for its configuration" do
|
51
|
-
|
53
|
+
app.config.sequel.logger.should be Rails.logger
|
52
54
|
end
|
53
55
|
|
54
56
|
it "configures Sequel::Model instances for i18n" do
|
@@ -61,22 +63,6 @@ describe SequelRails::Railtie do
|
|
61
63
|
)
|
62
64
|
end
|
63
65
|
|
64
|
-
context "Sequel::Model is configured" do
|
65
|
-
let(:plugins) { Sequel::Model.plugins }
|
66
|
-
it "to use :active_model plugin" do
|
67
|
-
plugins.should include Sequel::Plugins::ActiveModel
|
68
|
-
end
|
69
|
-
it "to use :validation_helpers plugin" do
|
70
|
-
plugins.should include Sequel::Plugins::ValidationHelpers
|
71
|
-
end
|
72
|
-
it "to use :rails_extensions plugin" do
|
73
|
-
plugins.should include Sequel::Plugins::RailsExtensions
|
74
|
-
end
|
75
|
-
it "to not raise on save failure" do
|
76
|
-
Sequel::Model.raise_on_save_failure.should be false
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
66
|
it "configures database in Sequel" do
|
81
67
|
expect do
|
82
68
|
Sequel::Model.db.test_connection
|
@@ -17,6 +17,11 @@ describe SequelRails::Storage do
|
|
17
17
|
"database" => "sequel_rails_test_storage_test",
|
18
18
|
"host" => "127.0.0.1",
|
19
19
|
},
|
20
|
+
"remote" => {
|
21
|
+
"adapter" => "postgres",
|
22
|
+
"host" => "10.0.0.1",
|
23
|
+
"database" => "sequel_rails_test_storage_remote",
|
24
|
+
},
|
20
25
|
"production" => {
|
21
26
|
"host" => "10.0.0.1",
|
22
27
|
"database" => "sequel_rails_test_storage_production",
|
@@ -30,7 +35,7 @@ describe SequelRails::Storage do
|
|
30
35
|
describe ".create_all" do
|
31
36
|
it "creates all databases skipping ones on remote host or with no database name" do
|
32
37
|
adapter = mock :storage_adapter
|
33
|
-
environments.except("production", "bogus").values.each do |env|
|
38
|
+
environments.except("remote", "production", "bogus").values.each do |env|
|
34
39
|
SequelRails::Storage::Postgres.should_receive(:new).
|
35
40
|
with(env).
|
36
41
|
and_return adapter
|
@@ -44,11 +49,12 @@ describe SequelRails::Storage do
|
|
44
49
|
describe ".drop_all" do
|
45
50
|
it "drop all databases skipping ones on remote host or with no database name" do
|
46
51
|
adapter = mock :storage_adapter
|
47
|
-
environments.except("production", "bogus").values.each do |env|
|
52
|
+
environments.except("remote", "production", "bogus").values.each do |env|
|
48
53
|
SequelRails::Storage::Postgres.should_receive(:new).
|
49
54
|
with(env).
|
50
55
|
and_return adapter
|
51
56
|
end
|
57
|
+
adapter.should_receive(:close_connections).twice
|
52
58
|
adapter.should_receive(:drop).twice
|
53
59
|
capture(:stdout) do
|
54
60
|
described_class.drop_all
|
@@ -71,10 +77,35 @@ describe SequelRails::Storage do
|
|
71
77
|
SequelRails::Storage::Postgres.should_receive(:new).
|
72
78
|
with(environments["development"]).
|
73
79
|
and_return adapter
|
80
|
+
adapter.should_receive :close_connections
|
74
81
|
adapter.should_receive :drop
|
75
82
|
described_class.drop_environment "development"
|
76
83
|
end
|
77
84
|
end
|
85
|
+
describe ".close_all_connections" do
|
86
|
+
it "drops opened connections to all databases on config" do
|
87
|
+
adapter = mock :storage_adapter
|
88
|
+
environments.except("production", "bogus").values.each do |env|
|
89
|
+
SequelRails::Storage::Postgres.should_receive(:new).
|
90
|
+
with(env).
|
91
|
+
and_return adapter
|
92
|
+
end
|
93
|
+
adapter.should_receive(:close_connections).exactly(3).times
|
94
|
+
capture(:stdout) do
|
95
|
+
described_class.close_all_connections
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
describe ".close_connections_environment" do
|
100
|
+
it "drops opened connections to database for specified environment" do
|
101
|
+
adapter = mock :storage_adapter
|
102
|
+
SequelRails::Storage::Postgres.should_receive(:new).
|
103
|
+
with(environments["development"]).
|
104
|
+
and_return adapter
|
105
|
+
adapter.should_receive :close_connections
|
106
|
+
described_class.close_connections_environment "development"
|
107
|
+
end
|
108
|
+
end
|
78
109
|
describe ".adapter_for" do
|
79
110
|
context "when passed a hash" do
|
80
111
|
{
|
metadata
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sequel-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
version: 0.4.0
|
4
|
+
prerelease:
|
5
|
+
version: 0.4.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Brasten Sager (brasten)
|
@@ -10,16 +10,9 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-
|
13
|
+
date: 2013-03-06 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
|
-
version_requirements: !ruby/object:Gem::Requirement
|
17
|
-
requirements:
|
18
|
-
- - ~>
|
19
|
-
- !ruby/object:Gem::Version
|
20
|
-
version: '3.28'
|
21
|
-
none: false
|
22
|
-
prerelease: false
|
23
16
|
name: sequel
|
24
17
|
requirement: !ruby/object:Gem::Requirement
|
25
18
|
requirements:
|
@@ -28,30 +21,30 @@ dependencies:
|
|
28
21
|
version: '3.28'
|
29
22
|
none: false
|
30
23
|
type: :runtime
|
31
|
-
- !ruby/object:Gem::Dependency
|
32
24
|
version_requirements: !ruby/object:Gem::Requirement
|
33
25
|
requirements:
|
34
26
|
- - ~>
|
35
27
|
- !ruby/object:Gem::Version
|
36
|
-
version: 3.
|
28
|
+
version: '3.28'
|
37
29
|
none: false
|
38
30
|
prerelease: false
|
31
|
+
- !ruby/object:Gem::Dependency
|
39
32
|
name: railties
|
40
33
|
requirement: !ruby/object:Gem::Requirement
|
41
34
|
requirements:
|
42
|
-
- -
|
35
|
+
- - ! '>='
|
43
36
|
- !ruby/object:Gem::Version
|
44
37
|
version: 3.2.0
|
45
38
|
none: false
|
46
39
|
type: :runtime
|
47
|
-
- !ruby/object:Gem::Dependency
|
48
40
|
version_requirements: !ruby/object:Gem::Requirement
|
49
41
|
requirements:
|
50
42
|
- - ! '>='
|
51
43
|
- !ruby/object:Gem::Version
|
52
|
-
version:
|
44
|
+
version: 3.2.0
|
53
45
|
none: false
|
54
46
|
prerelease: false
|
47
|
+
- !ruby/object:Gem::Dependency
|
55
48
|
name: rake
|
56
49
|
requirement: !ruby/object:Gem::Requirement
|
57
50
|
requirements:
|
@@ -60,14 +53,14 @@ dependencies:
|
|
60
53
|
version: 0.8.7
|
61
54
|
none: false
|
62
55
|
type: :development
|
63
|
-
- !ruby/object:Gem::Dependency
|
64
56
|
version_requirements: !ruby/object:Gem::Requirement
|
65
57
|
requirements:
|
66
|
-
- -
|
58
|
+
- - ! '>='
|
67
59
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
60
|
+
version: 0.8.7
|
69
61
|
none: false
|
70
62
|
prerelease: false
|
63
|
+
- !ruby/object:Gem::Dependency
|
71
64
|
name: rspec
|
72
65
|
requirement: !ruby/object:Gem::Requirement
|
73
66
|
requirements:
|
@@ -76,14 +69,14 @@ dependencies:
|
|
76
69
|
version: 2.7.0
|
77
70
|
none: false
|
78
71
|
type: :development
|
79
|
-
- !ruby/object:Gem::Dependency
|
80
72
|
version_requirements: !ruby/object:Gem::Requirement
|
81
73
|
requirements:
|
82
74
|
- - ~>
|
83
75
|
- !ruby/object:Gem::Version
|
84
|
-
version:
|
76
|
+
version: 2.7.0
|
85
77
|
none: false
|
86
78
|
prerelease: false
|
79
|
+
- !ruby/object:Gem::Dependency
|
87
80
|
name: combustion
|
88
81
|
requirement: !ruby/object:Gem::Requirement
|
89
82
|
requirements:
|
@@ -92,14 +85,14 @@ dependencies:
|
|
92
85
|
version: 0.3.1
|
93
86
|
none: false
|
94
87
|
type: :development
|
95
|
-
- !ruby/object:Gem::Dependency
|
96
88
|
version_requirements: !ruby/object:Gem::Requirement
|
97
89
|
requirements:
|
98
90
|
- - ~>
|
99
91
|
- !ruby/object:Gem::Version
|
100
|
-
version: 0.
|
92
|
+
version: 0.3.1
|
101
93
|
none: false
|
102
94
|
prerelease: false
|
95
|
+
- !ruby/object:Gem::Dependency
|
103
96
|
name: generator_spec
|
104
97
|
requirement: !ruby/object:Gem::Requirement
|
105
98
|
requirements:
|
@@ -108,6 +101,13 @@ dependencies:
|
|
108
101
|
version: 0.8.7
|
109
102
|
none: false
|
110
103
|
type: :development
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
requirements:
|
106
|
+
- - ~>
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: 0.8.7
|
109
|
+
none: false
|
110
|
+
prerelease: false
|
111
111
|
description: Integrate Sequel with Rails 3
|
112
112
|
email:
|
113
113
|
- brasten@gmail.com
|
@@ -144,6 +144,7 @@ files:
|
|
144
144
|
- lib/sequel_rails/railties/controller_runtime.rb
|
145
145
|
- lib/sequel_rails/railties/database.rake
|
146
146
|
- lib/sequel_rails/railties/i18n_support.rb
|
147
|
+
- lib/sequel_rails/railties/legacy_model_config.rb
|
147
148
|
- lib/sequel_rails/railties/log_subscriber.rb
|
148
149
|
- lib/sequel_rails/sequel/database/active_support_notification.rb
|
149
150
|
- lib/sequel_rails/sequel/plugins/rails_extensions.rb
|
@@ -157,12 +158,14 @@ files:
|
|
157
158
|
- lib/sequel_rails/storage/sqlite.rb
|
158
159
|
- lib/sequel_rails/version.rb
|
159
160
|
- sequel-rails.gemspec
|
161
|
+
- spec/internal/Rakefile
|
160
162
|
- spec/internal/app/models/user.rb
|
161
163
|
- spec/internal/config/database.yml
|
162
164
|
- spec/internal/config/routes.rb
|
163
165
|
- spec/internal/db/schema.rb
|
164
166
|
- spec/internal/public/favicon.ico
|
165
167
|
- spec/lib/generators/sequel/migration_spec.rb
|
168
|
+
- spec/lib/sequel_rails/migrations_spec.rb
|
166
169
|
- spec/lib/sequel_rails/railtie_spec.rb
|
167
170
|
- spec/lib/sequel_rails/railties/log_subscriber_spec.rb
|
168
171
|
- spec/lib/sequel_rails/storage_spec.rb
|
@@ -179,30 +182,35 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
179
182
|
requirements:
|
180
183
|
- - ! '>='
|
181
184
|
- !ruby/object:Gem::Version
|
182
|
-
version: '0'
|
183
185
|
segments:
|
184
186
|
- 0
|
185
|
-
hash:
|
187
|
+
hash: 1691704785188510155
|
188
|
+
version: '0'
|
186
189
|
none: false
|
187
190
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
188
191
|
requirements:
|
189
|
-
- - ! '
|
192
|
+
- - ! '>='
|
190
193
|
- !ruby/object:Gem::Version
|
191
|
-
|
194
|
+
segments:
|
195
|
+
- 0
|
196
|
+
hash: 1691704785188510155
|
197
|
+
version: '0'
|
192
198
|
none: false
|
193
199
|
requirements: []
|
194
200
|
rubyforge_project:
|
195
|
-
rubygems_version: 1.8.
|
201
|
+
rubygems_version: 1.8.25
|
196
202
|
signing_key:
|
197
203
|
specification_version: 3
|
198
204
|
summary: Use Sequel with Rails 3
|
199
205
|
test_files:
|
206
|
+
- spec/internal/Rakefile
|
200
207
|
- spec/internal/app/models/user.rb
|
201
208
|
- spec/internal/config/database.yml
|
202
209
|
- spec/internal/config/routes.rb
|
203
210
|
- spec/internal/db/schema.rb
|
204
211
|
- spec/internal/public/favicon.ico
|
205
212
|
- spec/lib/generators/sequel/migration_spec.rb
|
213
|
+
- spec/lib/sequel_rails/migrations_spec.rb
|
206
214
|
- spec/lib/sequel_rails/railtie_spec.rb
|
207
215
|
- spec/lib/sequel_rails/railties/log_subscriber_spec.rb
|
208
216
|
- spec/lib/sequel_rails/storage_spec.rb
|