sequel-rails 0.9.17 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +14 -58
- data/Gemfile +4 -13
- data/History.md +11 -3
- data/README.md +6 -4
- data/Rakefile +1 -1
- data/ci/rails-4.0.gemfile +3 -11
- data/ci/rails-4.1.gemfile +3 -11
- data/ci/rails-4.2.gemfile +3 -11
- data/ci/rails-5.0.gemfile +3 -3
- data/ci/rails-5.1.gemfile +28 -0
- data/lib/generators/sequel.rb +7 -7
- data/lib/generators/sequel/migration/migration_generator.rb +1 -1
- data/lib/generators/sequel/model/model_generator.rb +2 -1
- data/lib/generators/sequel/session_migration/session_migration_generator.rb +1 -1
- data/lib/sequel_rails/configuration.rb +4 -4
- data/lib/sequel_rails/db_config.rb +2 -2
- data/lib/sequel_rails/railtie.rb +4 -4
- data/lib/sequel_rails/railties/database.rake +2 -2
- data/lib/sequel_rails/sequel/plugins/rails_extensions.rb +1 -1
- data/lib/sequel_rails/storage.rb +2 -4
- data/lib/sequel_rails/storage/abstract.rb +17 -5
- data/lib/sequel_rails/storage/jdbc.rb +2 -2
- data/lib/sequel_rails/storage/postgres.rb +1 -1
- data/lib/sequel_rails/version.rb +1 -1
- data/rubocop-todo.yml +4 -1
- data/sequel-rails.gemspec +12 -20
- data/spec/helpers/io.rb +1 -5
- data/spec/spec_helper.rb +4 -2
- metadata +22 -22
- data/ci/rails-3.2.gemfile +0 -42
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e86a6f0412e0e4ba310a49df1c54a707f7a95ded
|
4
|
+
data.tar.gz: bd6ed554e0ccbff298b4c5cbf6fe813149e39039
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ab0f6cda2bc41a90f5e806063c4990c1c49c2de012b7342dda416a00f6287ecb8a77ad3a7d341e21770144145ce08a61984fb7ddc8984c3abd387f19808ad6d
|
7
|
+
data.tar.gz: 1ce064ffe25f21bfc0aabc66101ff3707a82c6cc8e03e595bad652622a0d632708894011b10d3a955b48bc42ee1b5224c2c3d597357aa1e51c28b3e97b80e71a
|
data/.travis.yml
CHANGED
@@ -2,83 +2,39 @@ language: ruby
|
|
2
2
|
cache: bundler
|
3
3
|
sudo: false
|
4
4
|
rvm:
|
5
|
-
-
|
6
|
-
-
|
7
|
-
-
|
8
|
-
- 2.0.0
|
9
|
-
- 2.1.10
|
10
|
-
- 2.2.6
|
11
|
-
- 2.3.3
|
12
|
-
- 2.4.0
|
13
|
-
- jruby-18mode
|
14
|
-
- jruby-19mode
|
5
|
+
- 2.2.7
|
6
|
+
- 2.3.4
|
7
|
+
- 2.4.2
|
15
8
|
- jruby-9.0.5.0
|
16
|
-
- jruby-9.1.
|
9
|
+
- jruby-9.1.13.0
|
17
10
|
before_script:
|
18
11
|
- mysql -e 'create database sequel_rails_test;'
|
19
12
|
- mysql -e 'create database sequel_rails_test_mysql2;'
|
20
|
-
-
|
13
|
+
- mysql -e 'create database sequel_rails_test_storage_dev;'
|
14
|
+
- psql -c 'create database sequel_rails_test_storage_dev;' -U postgres
|
15
|
+
- psql -c 'create database sequel_rails_test;' -U postgres
|
21
16
|
env:
|
22
17
|
- SEQUEL='~> 3.0'
|
23
18
|
- SEQUEL='~> 4.0'
|
19
|
+
- SEQUEL='~> 5.0'
|
24
20
|
gemfile:
|
25
|
-
- ci/rails-3.2.gemfile
|
26
21
|
- ci/rails-4.0.gemfile
|
27
22
|
- ci/rails-4.1.gemfile
|
28
23
|
- ci/rails-4.2.gemfile
|
29
24
|
- ci/rails-5.0.gemfile
|
25
|
+
- ci/rails-5.1.gemfile
|
30
26
|
matrix:
|
31
27
|
allow_failures:
|
32
|
-
- rvm:
|
28
|
+
- rvm: jruby-9.0.5.0
|
29
|
+
gemfile: ci/rails-4.2.gemfile
|
33
30
|
- rvm: jruby-9.0.5.0
|
34
31
|
gemfile: ci/rails-5.0.gemfile
|
35
|
-
-
|
36
|
-
gemfile: ci/rails-5.0.gemfile
|
32
|
+
- gemfile: ci/rails-5.1.gemfile
|
37
33
|
exclude:
|
38
|
-
- rvm: 2.2
|
39
|
-
gemfile: ci/rails-3.2.gemfile
|
40
|
-
- rvm: 2.3.3
|
41
|
-
gemfile: ci/rails-3.2.gemfile
|
42
|
-
- rvm: 2.4.0
|
43
|
-
gemfile: ci/rails-3.2.gemfile
|
44
|
-
- rvm: jruby-9.0.5.0
|
45
|
-
gemfile: ci/rails-3.2.gemfile
|
46
|
-
- rvm: jruby-9.1.8.0
|
47
|
-
gemfile: ci/rails-3.2.gemfile
|
48
|
-
- rvm: ree
|
49
|
-
gemfile: ci/rails-4.0.gemfile
|
50
|
-
- rvm: 1.8.7
|
34
|
+
- rvm: 2.4.2
|
51
35
|
gemfile: ci/rails-4.0.gemfile
|
52
|
-
- rvm:
|
53
|
-
gemfile: ci/rails-4.0.gemfile
|
54
|
-
- rvm: ree
|
55
|
-
gemfile: ci/rails-4.1.gemfile
|
56
|
-
- rvm: 1.8.7
|
36
|
+
- rvm: 2.4.2
|
57
37
|
gemfile: ci/rails-4.1.gemfile
|
58
|
-
- rvm: jruby-18mode
|
59
|
-
gemfile: ci/rails-4.1.gemfile
|
60
|
-
- rvm: ree
|
61
|
-
gemfile: ci/rails-4.2.gemfile
|
62
|
-
- rvm: 1.8.7
|
63
|
-
gemfile: ci/rails-4.2.gemfile
|
64
|
-
- rvm: jruby-18mode
|
65
|
-
gemfile: ci/rails-4.2.gemfile
|
66
|
-
- rvm: ree
|
67
|
-
gemfile: ci/rails-5.0.gemfile
|
68
|
-
- rvm: 1.8.7
|
69
|
-
gemfile: ci/rails-5.0.gemfile
|
70
|
-
- rvm: jruby-18mode
|
71
|
-
gemfile: ci/rails-5.0.gemfile
|
72
|
-
- rvm: jruby-19mode
|
73
|
-
gemfile: ci/rails-5.0.gemfile
|
74
|
-
- rvm: 1.9.3
|
75
|
-
gemfile: ci/rails-5.0.gemfile
|
76
|
-
- rvm: 2.0.0
|
77
|
-
gemfile: ci/rails-5.0.gemfile
|
78
|
-
- rvm: 2.1.10
|
79
|
-
gemfile: ci/rails-5.0.gemfile
|
80
|
-
- gemfile: ci/rails-3.2.gemfile
|
81
|
-
env: SEQUEL='~> 4.0'
|
82
38
|
notifications:
|
83
39
|
email:
|
84
40
|
- jonathan.tron@metrilio.com
|
data/Gemfile
CHANGED
@@ -5,28 +5,19 @@ gemspec
|
|
5
5
|
gem 'actionpack'
|
6
6
|
gem 'fakefs', '0.5.3', :require => 'fakefs/safe'
|
7
7
|
|
8
|
-
|
9
|
-
# why do we even care, it's deprecated
|
10
|
-
gem 'activesupport', '< 4'
|
11
|
-
gem 'pry', '< 0.10'
|
12
|
-
gem 'tzinfo'
|
13
|
-
else
|
14
|
-
gem 'pry'
|
15
|
-
end
|
8
|
+
gem 'pry'
|
16
9
|
|
17
10
|
# MRI/Rubinius Adapter Dependencies
|
18
11
|
platform :ruby do
|
19
|
-
gem '
|
20
|
-
if RUBY_VERSION < '2.4'
|
21
|
-
gem 'mysql'
|
22
|
-
end
|
12
|
+
gem 'mysql' if RUBY_VERSION < '2.4'
|
23
13
|
gem 'mysql2'
|
14
|
+
gem 'pg'
|
24
15
|
gem 'sqlite3'
|
25
16
|
end
|
26
17
|
|
27
18
|
# JRuby Adapter Dependencies
|
28
19
|
platform :jruby do
|
29
|
-
gem 'jdbc-sqlite3'
|
30
20
|
gem 'jdbc-mysql'
|
31
21
|
gem 'jdbc-postgres'
|
22
|
+
gem 'jdbc-sqlite3'
|
32
23
|
end
|
data/History.md
CHANGED
@@ -1,7 +1,15 @@
|
|
1
|
-
0.
|
2
|
-
|
1
|
+
1.0.0 (2017-11-20)
|
2
|
+
==================
|
3
3
|
|
4
|
-
*
|
4
|
+
* Support for Sequel ~> 5.0 (@Jesterovskiy and @ckoenig)
|
5
|
+
[#143](https://github.com/TalentBox/sequel-rails/pull/143)
|
6
|
+
* Better handling of missing database when using Postgresql (Steve Hoeksema)
|
7
|
+
[#140](https://github.com/TalentBox/sequel-rails/pull/140)
|
8
|
+
* Bump version to 1.0.0.alpha
|
9
|
+
* Drop CI testing with Rubies < 2.2 and Rails < 4.0, add Rails 5.1, and add
|
10
|
+
minimal Ruby (>= 2.2) and Rubygems (>= 1.8.11) version to gemspec
|
11
|
+
* Fix arguments for the shell exec commands on windows (Gencer W. Genç)
|
12
|
+
[#134](https://github.com/TalentBox/sequel-rails/pull/134)
|
5
13
|
|
6
14
|
0.9.16 (2017-06-22)
|
7
15
|
===================
|
data/README.md
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
|
11
11
|
This gem provides the railtie that allows
|
12
12
|
[sequel](http://github.com/jeremyevans/sequel) to hook into
|
13
|
-
[Rails (
|
13
|
+
[Rails (4.x and 5.x)](http://github.com/rails/rails) and thus behave like a
|
14
14
|
rails framework component. Just like activerecord does in rails,
|
15
15
|
[sequel-rails](http://github.com/talentbox/sequel-rails) uses the railtie API to
|
16
16
|
hook into rails. The two are actually hooked into rails almost identically.
|
@@ -28,8 +28,7 @@ Since January 2013, we've become the official maintainers of the gem after
|
|
28
28
|
Using sequel-rails
|
29
29
|
==================
|
30
30
|
|
31
|
-
Using sequel with Rails (
|
32
|
-
changes.
|
31
|
+
Using sequel with Rails (4.x or 5.x) requires a couple minor changes.
|
33
32
|
|
34
33
|
First, add the following to your Gemfile (after the `Rails` lines):
|
35
34
|
|
@@ -60,7 +59,7 @@ require "action_mailer/railtie"
|
|
60
59
|
require "action_view/railtie"
|
61
60
|
require "action_cable/engine"
|
62
61
|
require "sprockets/railtie"
|
63
|
-
require "rails/test_unit/railtie
|
62
|
+
require "rails/test_unit/railtie"
|
64
63
|
```
|
65
64
|
|
66
65
|
Then you need to get rid of `ActiveRecord` configurations, that is if you
|
@@ -398,7 +397,10 @@ Improvements have been made by those awesome contributors:
|
|
398
397
|
* Pablo Herrero (@pabloh)
|
399
398
|
* Henre Botha (@henrebotha)
|
400
399
|
* Mohammad Satrio (@tyok)
|
400
|
+
* Gencer W. Genç (@gencer)
|
401
401
|
* Steve Hoeksema (@steveh)
|
402
|
+
* Jester (@Jesterovskiy)
|
403
|
+
* ckoenig (@ckoenig)
|
402
404
|
|
403
405
|
Credits
|
404
406
|
=======
|
data/Rakefile
CHANGED
@@ -30,7 +30,7 @@ begin
|
|
30
30
|
|
31
31
|
configs = {
|
32
32
|
'postgresql' => { 'TEST_ENCODING' => 'unicode' },
|
33
|
-
'sqlite3' => { 'TEST_DATABASE' => 'db/database.sqlite3' },
|
33
|
+
'sqlite3' => { 'TEST_DATABASE' => File.join(File.expand_path('.'), 'spec/internal/db/database.sqlite3') },
|
34
34
|
}
|
35
35
|
|
36
36
|
configs.merge!(
|
data/ci/rails-4.0.gemfile
CHANGED
@@ -1,24 +1,16 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
|
3
|
-
gem 'railties', '~> 4.0.
|
3
|
+
gem 'railties', '~> 4.0.13'
|
4
4
|
|
5
5
|
gemspec :path => '../'
|
6
6
|
|
7
7
|
gem 'sequel', "#{ENV['SEQUEL']}"
|
8
8
|
|
9
|
-
gem 'fakefs', '0.
|
10
|
-
|
11
|
-
if RUBY_VERSION < '2.1'
|
12
|
-
gem 'nokogiri', '< 1.7.0'
|
13
|
-
end
|
9
|
+
gem 'fakefs', '0.11.2', :require => 'fakefs/safe'
|
14
10
|
|
15
11
|
# MRI/Rubinius Adapter Dependencies
|
16
12
|
platform :ruby do
|
17
|
-
|
18
|
-
gem 'pg', '~> 0.18.4'
|
19
|
-
else
|
20
|
-
gem 'pg'
|
21
|
-
end
|
13
|
+
gem 'pg'
|
22
14
|
if RUBY_VERSION < '2.4'
|
23
15
|
gem 'mysql'
|
24
16
|
end
|
data/ci/rails-4.1.gemfile
CHANGED
@@ -1,24 +1,16 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
|
3
|
-
gem 'railties', '~> 4.1.
|
3
|
+
gem 'railties', '~> 4.1.16'
|
4
4
|
|
5
5
|
gemspec :path => '../'
|
6
6
|
|
7
7
|
gem 'sequel', "#{ENV['SEQUEL']}"
|
8
8
|
|
9
|
-
gem 'fakefs', '0.
|
10
|
-
|
11
|
-
if RUBY_VERSION < '2.1'
|
12
|
-
gem 'nokogiri', '< 1.7.0'
|
13
|
-
end
|
9
|
+
gem 'fakefs', '0.11.2', :require => 'fakefs/safe'
|
14
10
|
|
15
11
|
# MRI/Rubinius Adapter Dependencies
|
16
12
|
platform :ruby do
|
17
|
-
|
18
|
-
gem 'pg', '~> 0.18.4'
|
19
|
-
else
|
20
|
-
gem 'pg'
|
21
|
-
end
|
13
|
+
gem 'pg'
|
22
14
|
if RUBY_VERSION < '2.4'
|
23
15
|
gem 'mysql'
|
24
16
|
end
|
data/ci/rails-4.2.gemfile
CHANGED
@@ -1,24 +1,16 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
|
3
|
-
gem 'railties', '~> 4.2.
|
3
|
+
gem 'railties', '~> 4.2.10'
|
4
4
|
|
5
5
|
gemspec :path => '../'
|
6
6
|
|
7
7
|
gem 'sequel', "#{ENV['SEQUEL']}"
|
8
8
|
|
9
|
-
gem 'fakefs', '0.
|
10
|
-
|
11
|
-
if RUBY_VERSION < '2.1'
|
12
|
-
gem 'nokogiri', '< 1.7.0'
|
13
|
-
end
|
9
|
+
gem 'fakefs', '0.11.2', :require => 'fakefs/safe'
|
14
10
|
|
15
11
|
# MRI/Rubinius Adapter Dependencies
|
16
12
|
platform :ruby do
|
17
|
-
|
18
|
-
gem 'pg', '~> 0.18.4'
|
19
|
-
else
|
20
|
-
gem 'pg'
|
21
|
-
end
|
13
|
+
gem 'pg'
|
22
14
|
if RUBY_VERSION < '2.4'
|
23
15
|
gem 'mysql'
|
24
16
|
end
|
data/ci/rails-5.0.gemfile
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
|
3
|
-
gem 'railties', '~> 5.0.
|
4
|
-
gem 'activemodel', '~> 5.0.
|
3
|
+
gem 'railties', '~> 5.0.6'
|
4
|
+
gem 'activemodel', '~> 5.0.6'
|
5
5
|
|
6
6
|
gemspec :path => '../'
|
7
7
|
|
8
8
|
gem 'sequel', "#{ENV['SEQUEL']}"
|
9
9
|
|
10
|
-
gem 'fakefs', '0.
|
10
|
+
gem 'fakefs', '0.11.2', :require => 'fakefs/safe'
|
11
11
|
|
12
12
|
# MRI/Rubinius Adapter Dependencies
|
13
13
|
platform :ruby do
|
@@ -0,0 +1,28 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
gem 'railties', '~> 5.1.4'
|
4
|
+
gem 'activemodel', '~> 5.1.4'
|
5
|
+
gem 'actionpack', '~> 5.1.4'
|
6
|
+
|
7
|
+
gemspec :path => '../'
|
8
|
+
|
9
|
+
gem 'sequel', "#{ENV['SEQUEL']}"
|
10
|
+
|
11
|
+
gem 'fakefs', '0.11.2', :require => 'fakefs/safe'
|
12
|
+
|
13
|
+
# MRI/Rubinius Adapter Dependencies
|
14
|
+
platform :ruby do
|
15
|
+
gem 'pg'
|
16
|
+
if RUBY_VERSION < '2.4'
|
17
|
+
gem 'mysql'
|
18
|
+
end
|
19
|
+
gem 'mysql2'
|
20
|
+
gem 'sqlite3'
|
21
|
+
end
|
22
|
+
|
23
|
+
# JRuby Adapter Dependencies
|
24
|
+
platform :jruby do
|
25
|
+
gem 'jdbc-sqlite3'
|
26
|
+
gem 'jdbc-mysql'
|
27
|
+
gem 'jdbc-postgres'
|
28
|
+
end
|
data/lib/generators/sequel.rb
CHANGED
@@ -17,6 +17,13 @@ module Sequel
|
|
17
17
|
)
|
18
18
|
end
|
19
19
|
|
20
|
+
# Implement the required interface for Rails::Generators::Migration.
|
21
|
+
#
|
22
|
+
def self.next_migration_number(dirname) #:nodoc:
|
23
|
+
next_migration_number = current_migration_number(dirname) + 1
|
24
|
+
[Time.now.utc.strftime('%Y%m%d%H%M%S'), format('%.14d', next_migration_number)].max
|
25
|
+
end
|
26
|
+
|
20
27
|
protected
|
21
28
|
|
22
29
|
# Sequel does not care if migrations have the same name as long as
|
@@ -25,13 +32,6 @@ module Sequel
|
|
25
32
|
def migration_exists?(_dirname, _file_name) #:nodoc:
|
26
33
|
false
|
27
34
|
end
|
28
|
-
|
29
|
-
# Implement the required interface for Rails::Generators::Migration.
|
30
|
-
#
|
31
|
-
def self.next_migration_number(dirname) #:nodoc:
|
32
|
-
next_migration_number = current_migration_number(dirname) + 1
|
33
|
-
[Time.now.utc.strftime('%Y%m%d%H%M%S'), format('%.14d', next_migration_number)].max
|
34
|
-
end
|
35
35
|
end
|
36
36
|
|
37
37
|
class ActiveModel < ::Rails::Generators::ActiveModel #:nodoc:
|
@@ -12,10 +12,11 @@ module Sequel
|
|
12
12
|
class_option :parent, :type => :string, :desc => 'The parent class for the generated model'
|
13
13
|
|
14
14
|
def create_migration_file
|
15
|
+
return unless options[:migration]
|
15
16
|
migration_template(
|
16
17
|
'migration.rb.erb',
|
17
18
|
File.join('db', 'migrate', "create_#{table_name}.rb")
|
18
|
-
)
|
19
|
+
)
|
19
20
|
end
|
20
21
|
|
21
22
|
def create_model_file
|
@@ -37,7 +37,7 @@ module SequelRails
|
|
37
37
|
def environments
|
38
38
|
@environments ||= raw.reduce(
|
39
39
|
# default config - use just the environment variable
|
40
|
-
Hash.new
|
40
|
+
Hash.new(normalize_repository_config({}))
|
41
41
|
) do |normalized, environment|
|
42
42
|
name = environment.first
|
43
43
|
config = environment.last
|
@@ -49,8 +49,8 @@ module SequelRails
|
|
49
49
|
def connect(environment)
|
50
50
|
normalized_config = environment_for environment
|
51
51
|
|
52
|
-
unless (normalized_config.keys & %w
|
53
|
-
|
52
|
+
unless (normalized_config.keys & %w[adapter url]).any?
|
53
|
+
raise "Database not configured.\n" \
|
54
54
|
'Please create config/database.yml or set DATABASE_URL in environment.'
|
55
55
|
end
|
56
56
|
|
@@ -64,7 +64,7 @@ module SequelRails
|
|
64
64
|
private
|
65
65
|
|
66
66
|
def default_schema_dump
|
67
|
-
!%w
|
67
|
+
!%w[test production].include? Rails.env
|
68
68
|
end
|
69
69
|
|
70
70
|
def normalize_repository_config(hash)
|
@@ -33,7 +33,7 @@ module SequelRails
|
|
33
33
|
ADAPTER_MAPPING = {
|
34
34
|
'sqlite3' => 'sqlite',
|
35
35
|
'postgresql' => 'postgres'
|
36
|
-
}
|
36
|
+
}.freeze
|
37
37
|
|
38
38
|
def normalize_adapter
|
39
39
|
self[:adapter] = ADAPTER_MAPPING[adapter.to_s] || adapter.to_s
|
@@ -59,7 +59,7 @@ module SequelRails
|
|
59
59
|
scheme, subadapter = adapter.split ':'
|
60
60
|
URI::Generic.build(
|
61
61
|
:scheme => scheme,
|
62
|
-
:opaque => build_url(to_hash.merge
|
62
|
+
:opaque => build_url(to_hash.merge('adapter' => subadapter)).to_s
|
63
63
|
)
|
64
64
|
else
|
65
65
|
build_url to_hash
|
data/lib/sequel_rails/railtie.rb
CHANGED
@@ -39,10 +39,10 @@ module SequelRails
|
|
39
39
|
rake_tasks do |app|
|
40
40
|
load_tasks_config = app.config.sequel.load_database_tasks
|
41
41
|
SequelRails::TASK_NAMESPACE =
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
42
|
+
case load_tasks_config
|
43
|
+
when Symbol, String then load_tasks_config.to_sym
|
44
|
+
else :db
|
45
|
+
end
|
46
46
|
load 'sequel_rails/railties/database.rake' if load_tasks_config
|
47
47
|
end
|
48
48
|
|
@@ -145,7 +145,7 @@ namespace sequel_rails_namespace do
|
|
145
145
|
desc 'Runs the "up" for a given migration VERSION.'
|
146
146
|
task :up => :load do
|
147
147
|
version = ENV['VERSION'] ? ENV['VERSION'].to_i : nil
|
148
|
-
|
148
|
+
raise 'VERSION is required' unless version
|
149
149
|
SequelRails::Migrations.migrate_up!(version)
|
150
150
|
Rake::Task["#{sequel_rails_namespace}:dump"].invoke if SequelRails.configuration.schema_dump
|
151
151
|
end
|
@@ -153,7 +153,7 @@ namespace sequel_rails_namespace do
|
|
153
153
|
desc 'Runs the "down" for a given migration VERSION.'
|
154
154
|
task :down => :load do
|
155
155
|
version = ENV['VERSION'] ? ENV['VERSION'].to_i : nil
|
156
|
-
|
156
|
+
raise 'VERSION is required' unless version
|
157
157
|
SequelRails::Migrations.migrate_down!(version)
|
158
158
|
Rake::Task["#{sequel_rails_namespace}:dump"].invoke if SequelRails.configuration.schema_dump
|
159
159
|
end
|
data/lib/sequel_rails/storage.rb
CHANGED
@@ -51,8 +51,6 @@ module SequelRails
|
|
51
51
|
lookup_class(config['adapter']).new config
|
52
52
|
end
|
53
53
|
|
54
|
-
private
|
55
|
-
|
56
54
|
def self.parse_url(value)
|
57
55
|
URI(value) if value.present?
|
58
56
|
rescue ArgumentError
|
@@ -106,12 +104,12 @@ module SequelRails
|
|
106
104
|
end
|
107
105
|
|
108
106
|
def self.lookup_class(adapter)
|
109
|
-
|
107
|
+
raise 'Adapter not specified in config, please set the :adapter key.' unless adapter
|
110
108
|
return Jdbc if adapter =~ /jdbc/
|
111
109
|
|
112
110
|
klass_name = adapter.camelize.to_sym
|
113
111
|
unless self.const_defined?(klass_name)
|
114
|
-
|
112
|
+
raise "Adapter #{adapter} not supported (#{klass_name.inspect})"
|
115
113
|
end
|
116
114
|
|
117
115
|
const_get klass_name
|
@@ -80,13 +80,13 @@ module SequelRails
|
|
80
80
|
if inserts.any?
|
81
81
|
res = inserts.join("\n")
|
82
82
|
unless sql_dump
|
83
|
-
res = <<-
|
83
|
+
res = <<-RUBY.strip_heredoc
|
84
84
|
Sequel.migration do
|
85
85
|
change do
|
86
86
|
#{res}
|
87
87
|
end
|
88
88
|
end
|
89
|
-
|
89
|
+
RUBY
|
90
90
|
end
|
91
91
|
end
|
92
92
|
res
|
@@ -127,7 +127,19 @@ module SequelRails
|
|
127
127
|
end
|
128
128
|
|
129
129
|
def safe_exec(args)
|
130
|
-
|
130
|
+
if !Gem.win_platform?
|
131
|
+
exec SequelRails::Shellwords.join(Array(args))
|
132
|
+
else
|
133
|
+
jarg = args.map do |arg|
|
134
|
+
str = arg.to_s
|
135
|
+
return "''" if str.empty?
|
136
|
+
str = str.dup
|
137
|
+
str.gsub!(%r{([^A-Za-z0-9_\-.,:/@\n])}, '\\1')
|
138
|
+
str.gsub!(/\n/, "'\n'")
|
139
|
+
str
|
140
|
+
end
|
141
|
+
exec jarg.join(' ')
|
142
|
+
end
|
131
143
|
end
|
132
144
|
|
133
145
|
def schema_information_inserts(migrator, sql_dump)
|
@@ -146,14 +158,14 @@ module SequelRails
|
|
146
158
|
if sql_dump
|
147
159
|
res = "#{set_search_path_sql};\n#{res}"
|
148
160
|
else
|
149
|
-
res = <<-
|
161
|
+
res = <<-RUBY.strip_heredoc
|
150
162
|
Sequel.migration do
|
151
163
|
change do
|
152
164
|
self << #{set_search_path_sql.inspect}
|
153
165
|
#{res}
|
154
166
|
end
|
155
167
|
end
|
156
|
-
|
168
|
+
RUBY
|
157
169
|
end
|
158
170
|
end
|
159
171
|
res
|
@@ -58,7 +58,7 @@ module SequelRails
|
|
58
58
|
adapter = ::SequelRails::Storage::Postgres.new(config)
|
59
59
|
adapter._dump(filename)
|
60
60
|
else
|
61
|
-
|
61
|
+
raise NotImplementedError
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
@@ -67,7 +67,7 @@ module SequelRails
|
|
67
67
|
adapter = ::SequelRails::Storage::Postgres.new(config)
|
68
68
|
adapter._load(filename)
|
69
69
|
else
|
70
|
-
|
70
|
+
raise NotImplementedError
|
71
71
|
end
|
72
72
|
end
|
73
73
|
|
@@ -110,7 +110,7 @@ module SequelRails
|
|
110
110
|
def add_connection_settings(commands)
|
111
111
|
add_option commands, '--username', username unless username.blank?
|
112
112
|
add_option commands, '--host', host unless host.blank?
|
113
|
-
add_option commands, '--port', port.to_s unless port.to_s.blank? || port.to_s ==
|
113
|
+
add_option commands, '--port', port.to_s unless port.to_s.blank? || port.to_s == '0'
|
114
114
|
end
|
115
115
|
end
|
116
116
|
end
|
data/lib/sequel_rails/version.rb
CHANGED
data/rubocop-todo.yml
CHANGED
data/sequel-rails.gemspec
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
+
|
2
3
|
$LOAD_PATH.push File.expand_path('../lib', __FILE__)
|
3
4
|
|
4
5
|
require 'sequel_rails/version'
|
@@ -20,29 +21,20 @@ Gem::Specification.new do |s|
|
|
20
21
|
s.rdoc_options = ['--charset=UTF-8']
|
21
22
|
s.license = 'MIT'
|
22
23
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
!!! sequel-rails
|
27
|
-
NOTE: Support for Ruby < 1.9.3 (this is 1.8.x, 1.9.0, 1.9.2) in sequel-rails
|
28
|
-
is deprecated and will be dropped in the next major release. If you really
|
29
|
-
rely on it please complain at http://git.io/WgfgZQ to delay the inevitable.
|
30
|
-
!!!
|
31
|
-
|
32
|
-
NOTE
|
33
|
-
end
|
24
|
+
s.required_ruby_version = '>= 2.2.2'
|
25
|
+
s.required_rubygems_version = '>= 1.8.11'
|
34
26
|
|
35
|
-
s.add_dependency 'activemodel'
|
36
|
-
s.add_dependency 'railties', '>=
|
37
|
-
s.add_dependency 'actionpack', '>=
|
38
|
-
s.add_dependency 'sequel', ['>= 3.28', '<
|
27
|
+
s.add_dependency 'activemodel', '>= 4.0.0'
|
28
|
+
s.add_dependency 'railties', '>= 4.0.0'
|
29
|
+
s.add_dependency 'actionpack', '>= 4.0.0'
|
30
|
+
s.add_dependency 'sequel', ['>= 3.28', '< 6.0']
|
39
31
|
|
40
32
|
s.add_development_dependency 'combustion'
|
41
33
|
s.add_development_dependency 'generator_spec'
|
42
|
-
s.add_development_dependency 'rake', '>= 0.8.7', '<
|
34
|
+
s.add_development_dependency 'rake', '>= 0.8.7', '< 12.1'
|
43
35
|
s.add_development_dependency 'rspec', '~> 3.1'
|
44
|
-
s.add_development_dependency 'rspec-rails', '~> 3.1', '< 3.
|
45
|
-
s.add_development_dependency 'rubocop', '~> 0.
|
46
|
-
s.add_development_dependency 'ammeter', '1.1.
|
47
|
-
s.add_development_dependency 'test-unit'
|
36
|
+
s.add_development_dependency 'rspec-rails', '~> 3.1', '< 3.6'
|
37
|
+
s.add_development_dependency 'rubocop', '~> 0.50.0'
|
38
|
+
s.add_development_dependency 'ammeter', '1.1.4'
|
39
|
+
s.add_development_dependency 'test-unit'
|
48
40
|
end
|
data/spec/helpers/io.rb
CHANGED
@@ -2,11 +2,7 @@ module IOSpecHelper
|
|
2
2
|
def pretend_file_not_exists(pattern)
|
3
3
|
allow(IO).to receive(:read).and_wrap_original do |m, *a|
|
4
4
|
# if this isn't a good use for case equality I don't know what is
|
5
|
-
|
6
|
-
fail Errno::ENOENT
|
7
|
-
else
|
8
|
-
m.call(*a)
|
9
|
-
end
|
5
|
+
pattern === a.first ? raise(Errno::ENOENT) : m.call(*a) # rubocop:disable CaseEquality
|
10
6
|
end
|
11
7
|
end
|
12
8
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sequel-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brasten Sager (brasten)
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-
|
12
|
+
date: 2017-11-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activemodel
|
@@ -17,42 +17,42 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - ">="
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version:
|
20
|
+
version: 4.0.0
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - ">="
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version:
|
27
|
+
version: 4.0.0
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: railties
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
32
|
- - ">="
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version:
|
34
|
+
version: 4.0.0
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
39
|
- - ">="
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version:
|
41
|
+
version: 4.0.0
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: actionpack
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
46
|
- - ">="
|
47
47
|
- !ruby/object:Gem::Version
|
48
|
-
version:
|
48
|
+
version: 4.0.0
|
49
49
|
type: :runtime
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
53
|
- - ">="
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version:
|
55
|
+
version: 4.0.0
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: sequel
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
@@ -62,7 +62,7 @@ dependencies:
|
|
62
62
|
version: '3.28'
|
63
63
|
- - "<"
|
64
64
|
- !ruby/object:Gem::Version
|
65
|
-
version: '
|
65
|
+
version: '6.0'
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
68
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -72,7 +72,7 @@ dependencies:
|
|
72
72
|
version: '3.28'
|
73
73
|
- - "<"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '6.0'
|
76
76
|
- !ruby/object:Gem::Dependency
|
77
77
|
name: combustion
|
78
78
|
requirement: !ruby/object:Gem::Requirement
|
@@ -110,7 +110,7 @@ dependencies:
|
|
110
110
|
version: 0.8.7
|
111
111
|
- - "<"
|
112
112
|
- !ruby/object:Gem::Version
|
113
|
-
version: '
|
113
|
+
version: '12.1'
|
114
114
|
type: :development
|
115
115
|
prerelease: false
|
116
116
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -120,7 +120,7 @@ dependencies:
|
|
120
120
|
version: 0.8.7
|
121
121
|
- - "<"
|
122
122
|
- !ruby/object:Gem::Version
|
123
|
-
version: '
|
123
|
+
version: '12.1'
|
124
124
|
- !ruby/object:Gem::Dependency
|
125
125
|
name: rspec
|
126
126
|
requirement: !ruby/object:Gem::Requirement
|
@@ -144,7 +144,7 @@ dependencies:
|
|
144
144
|
version: '3.1'
|
145
145
|
- - "<"
|
146
146
|
- !ruby/object:Gem::Version
|
147
|
-
version: '3.
|
147
|
+
version: '3.6'
|
148
148
|
type: :development
|
149
149
|
prerelease: false
|
150
150
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -154,35 +154,35 @@ dependencies:
|
|
154
154
|
version: '3.1'
|
155
155
|
- - "<"
|
156
156
|
- !ruby/object:Gem::Version
|
157
|
-
version: '3.
|
157
|
+
version: '3.6'
|
158
158
|
- !ruby/object:Gem::Dependency
|
159
159
|
name: rubocop
|
160
160
|
requirement: !ruby/object:Gem::Requirement
|
161
161
|
requirements:
|
162
162
|
- - "~>"
|
163
163
|
- !ruby/object:Gem::Version
|
164
|
-
version: 0.
|
164
|
+
version: 0.50.0
|
165
165
|
type: :development
|
166
166
|
prerelease: false
|
167
167
|
version_requirements: !ruby/object:Gem::Requirement
|
168
168
|
requirements:
|
169
169
|
- - "~>"
|
170
170
|
- !ruby/object:Gem::Version
|
171
|
-
version: 0.
|
171
|
+
version: 0.50.0
|
172
172
|
- !ruby/object:Gem::Dependency
|
173
173
|
name: ammeter
|
174
174
|
requirement: !ruby/object:Gem::Requirement
|
175
175
|
requirements:
|
176
176
|
- - '='
|
177
177
|
- !ruby/object:Gem::Version
|
178
|
-
version: 1.1.
|
178
|
+
version: 1.1.4
|
179
179
|
type: :development
|
180
180
|
prerelease: false
|
181
181
|
version_requirements: !ruby/object:Gem::Requirement
|
182
182
|
requirements:
|
183
183
|
- - '='
|
184
184
|
- !ruby/object:Gem::Version
|
185
|
-
version: 1.1.
|
185
|
+
version: 1.1.4
|
186
186
|
- !ruby/object:Gem::Dependency
|
187
187
|
name: test-unit
|
188
188
|
requirement: !ruby/object:Gem::Requirement
|
@@ -216,11 +216,11 @@ files:
|
|
216
216
|
- LICENSE
|
217
217
|
- README.md
|
218
218
|
- Rakefile
|
219
|
-
- ci/rails-3.2.gemfile
|
220
219
|
- ci/rails-4.0.gemfile
|
221
220
|
- ci/rails-4.1.gemfile
|
222
221
|
- ci/rails-4.2.gemfile
|
223
222
|
- ci/rails-5.0.gemfile
|
223
|
+
- ci/rails-5.1.gemfile
|
224
224
|
- config.ru
|
225
225
|
- lib/action_dispatch/middleware/session/sequel_store.rb
|
226
226
|
- lib/generators/sequel.rb
|
@@ -297,15 +297,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
297
297
|
requirements:
|
298
298
|
- - ">="
|
299
299
|
- !ruby/object:Gem::Version
|
300
|
-
version:
|
300
|
+
version: 2.2.2
|
301
301
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
302
302
|
requirements:
|
303
303
|
- - ">="
|
304
304
|
- !ruby/object:Gem::Version
|
305
|
-
version:
|
305
|
+
version: 1.8.11
|
306
306
|
requirements: []
|
307
307
|
rubyforge_project:
|
308
|
-
rubygems_version: 2.5.
|
308
|
+
rubygems_version: 2.5.2
|
309
309
|
signing_key:
|
310
310
|
specification_version: 4
|
311
311
|
summary: Use Sequel with Rails (3.x and 4.x)
|
data/ci/rails-3.2.gemfile
DELETED
@@ -1,42 +0,0 @@
|
|
1
|
-
source 'https://rubygems.org'
|
2
|
-
|
3
|
-
gem 'railties', '~> 3.2.13'
|
4
|
-
|
5
|
-
gemspec :path => '../'
|
6
|
-
|
7
|
-
gem 'sequel', "#{ENV['SEQUEL']}"
|
8
|
-
|
9
|
-
gem 'fakefs', '0.5.3', :require => 'fakefs/safe'
|
10
|
-
|
11
|
-
# activesupport has an undeclared dependency on tzinfo prior to 4.0.0
|
12
|
-
gem 'tzinfo'
|
13
|
-
|
14
|
-
if RUBY_VERSION < '1.9'
|
15
|
-
gem 'i18n', '< 0.7.0'
|
16
|
-
gem 'rake', '< 11.0.0'
|
17
|
-
end
|
18
|
-
if RUBY_VERSION < '2.0'
|
19
|
-
gem 'rack-cache', "< 1.3.0"
|
20
|
-
end
|
21
|
-
|
22
|
-
# MRI/Rubinius Adapter Dependencies
|
23
|
-
platform :ruby do
|
24
|
-
case
|
25
|
-
when RUBY_VERSION < '1.9'
|
26
|
-
gem 'pg', '~> 0.17.1'
|
27
|
-
when RUBY_VERSION < '2.0'
|
28
|
-
gem 'pg', '~> 0.18.4'
|
29
|
-
else
|
30
|
-
gem 'pg'
|
31
|
-
end
|
32
|
-
gem 'mysql'
|
33
|
-
gem 'mysql2'
|
34
|
-
gem 'sqlite3'
|
35
|
-
end
|
36
|
-
|
37
|
-
# JRuby Adapter Dependencies
|
38
|
-
platform :jruby do
|
39
|
-
gem 'jdbc-sqlite3'
|
40
|
-
gem 'jdbc-mysql'
|
41
|
-
gem 'jdbc-postgres'
|
42
|
-
end
|