sequel-rails 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e86a6f0412e0e4ba310a49df1c54a707f7a95ded
4
- data.tar.gz: bd6ed554e0ccbff298b4c5cbf6fe813149e39039
3
+ metadata.gz: 246de7c0ab5e5b678e5cc36cbd9e4b8244e1e508
4
+ data.tar.gz: 2a1e078efd0934a6c93ac02772c0fcef672fbf78
5
5
  SHA512:
6
- metadata.gz: 3ab0f6cda2bc41a90f5e806063c4990c1c49c2de012b7342dda416a00f6287ecb8a77ad3a7d341e21770144145ce08a61984fb7ddc8984c3abd387f19808ad6d
7
- data.tar.gz: 1ce064ffe25f21bfc0aabc66101ff3707a82c6cc8e03e595bad652622a0d632708894011b10d3a955b48bc42ee1b5224c2c3d597357aa1e51c28b3e97b80e71a
6
+ metadata.gz: 8507eb62d41126c59d9cf089476d87cc3a6da8cb25c2794a47665a157274604f203b9c59542a8612cd5907fa77387c7555cd766bb38e7e0c2ea3d21b8b54bc6d
7
+ data.tar.gz: 59e78d025928669a0d92b5b4fa5bbd4f017e5ca5a1805a6459ebf7d3db30be31c0a459c0c23313c5e04325f660a8efd7efa536eb5d6fb000dc46f7d18a86bfcd
@@ -2,11 +2,11 @@ language: ruby
2
2
  cache: bundler
3
3
  sudo: false
4
4
  rvm:
5
- - 2.2.7
6
- - 2.3.4
7
- - 2.4.2
8
- - jruby-9.0.5.0
9
- - jruby-9.1.13.0
5
+ - 2.2.9
6
+ - 2.3.6
7
+ - 2.4.3
8
+ - 2.5.0
9
+ - jruby-9.1.16.0
10
10
  before_script:
11
11
  - mysql -e 'create database sequel_rails_test;'
12
12
  - mysql -e 'create database sequel_rails_test_mysql2;'
@@ -14,7 +14,6 @@ before_script:
14
14
  - psql -c 'create database sequel_rails_test_storage_dev;' -U postgres
15
15
  - psql -c 'create database sequel_rails_test;' -U postgres
16
16
  env:
17
- - SEQUEL='~> 3.0'
18
17
  - SEQUEL='~> 4.0'
19
18
  - SEQUEL='~> 5.0'
20
19
  gemfile:
@@ -24,16 +23,14 @@ gemfile:
24
23
  - ci/rails-5.0.gemfile
25
24
  - ci/rails-5.1.gemfile
26
25
  matrix:
27
- allow_failures:
28
- - rvm: jruby-9.0.5.0
29
- gemfile: ci/rails-4.2.gemfile
30
- - rvm: jruby-9.0.5.0
31
- gemfile: ci/rails-5.0.gemfile
32
- - gemfile: ci/rails-5.1.gemfile
33
26
  exclude:
34
- - rvm: 2.4.2
27
+ - rvm: 2.4.3
35
28
  gemfile: ci/rails-4.0.gemfile
36
- - rvm: 2.4.2
29
+ - rvm: 2.4.3
30
+ gemfile: ci/rails-4.1.gemfile
31
+ - rvm: 2.5.0
32
+ gemfile: ci/rails-4.0.gemfile
33
+ - rvm: 2.5.0
37
34
  gemfile: ci/rails-4.1.gemfile
38
35
  notifications:
39
36
  email:
data/History.md CHANGED
@@ -1,3 +1,21 @@
1
+ 1.0.1 (2018-02-27)
2
+ ==================
3
+
4
+ * Check that db/ exists before running db:schema:load (Olivier Lacan)
5
+ [#157](https://github.com/TalentBox/sequel-rails/pull/157)
6
+ * Raise useful exception when db/migrate directory is absent (Olivier Lacan)
7
+ [#156](https://github.com/TalentBox/sequel-rails/pull/156)
8
+ * Test Ruby 2.5.0 on Travis CI (Olivier Lacan)
9
+ [#155](https://github.com/TalentBox/sequel-rails/pull/155)
10
+ * Fix Sequel::DatabaseConnectionError on db:create:all task (Olivier Lacan)
11
+ [#154](https://github.com/TalentBox/sequel-rails/pull/154)
12
+ * Enable skip_connect in db:create rake task (Olivier Lacan)
13
+ [#148](https://github.com/TalentBox/sequel-rails/pull/148)
14
+ * Update controller tests to cope with `ActionDispatch::IntegrationTest`
15
+ params handling change.
16
+ * Fix db:create rake tasks (Rolf Timmermans)
17
+ [#145](https://github.com/TalentBox/sequel-rails/pull/145)
18
+
1
19
  1.0.0 (2017-11-20)
2
20
  ==================
3
21
 
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # sequel-rails
2
2
 
3
- [![Gem Version](https://badge.fury.io/rb/sequel-rails.png)][gem]
4
- [![Build Status](https://secure.travis-ci.org/TalentBox/sequel-rails.png?branch=master)][travis]
5
- [![Code Climate](https://codeclimate.com/github/TalentBox/sequel-rails.png)][codeclimate]
3
+ [![Gem Version](https://badge.fury.io/rb/sequel-rails.svg)][gem]
4
+ [![Build Status](https://secure.travis-ci.org/TalentBox/sequel-rails.svg?branch=master)][travis]
5
+ [![Code Climate](https://codeclimate.com/github/TalentBox/sequel-rails.svg)][codeclimate]
6
6
 
7
7
  [gem]: https://rubygems.org/gems/sequel-rails
8
8
  [travis]: http://travis-ci.org/TalentBox/sequel-rails
@@ -401,6 +401,8 @@ Improvements have been made by those awesome contributors:
401
401
  * Steve Hoeksema (@steveh)
402
402
  * Jester (@Jesterovskiy)
403
403
  * ckoenig (@ckoenig)
404
+ * Rolf Timmermans (@rolftimmermans)
405
+ * Olivier Lacan (@olivierlacan)
404
406
 
405
407
  Credits
406
408
  =======
@@ -6,7 +6,13 @@ module SequelRails
6
6
  def migrate(version = nil)
7
7
  opts = {}
8
8
  opts[:target] = version.to_i if version
9
- ::Sequel::Migrator.run(::Sequel::Model.db, migrations_dir, opts)
9
+
10
+ if migrations_dir.directory?
11
+ ::Sequel::Migrator.run(::Sequel::Model.db, migrations_dir, opts)
12
+ else
13
+ relative_path_name = migrations_dir.relative_path_from(Rails.root).to_s
14
+ raise "The #{relative_path_name} directory doesn't exist, you need to create it."
15
+ end
10
16
  end
11
17
  alias_method :migrate_up!, :migrate
12
18
  alias_method :migrate_down!, :migrate
@@ -38,12 +38,16 @@ module SequelRails
38
38
 
39
39
  rake_tasks do |app|
40
40
  load_tasks_config = app.config.sequel.load_database_tasks
41
+
41
42
  SequelRails::TASK_NAMESPACE =
42
43
  case load_tasks_config
43
44
  when Symbol, String then load_tasks_config.to_sym
44
45
  else :db
45
46
  end
47
+
46
48
  load 'sequel_rails/railties/database.rake' if load_tasks_config
49
+
50
+ check_skip_connect_conditions(app)
47
51
  end
48
52
 
49
53
  initializer 'sequel.load_hooks' do
@@ -68,7 +72,7 @@ module SequelRails
68
72
  end
69
73
 
70
74
  initializer 'sequel.connect' do |app|
71
- ::SequelRails.setup ::Rails.env unless app.config.sequel[:skip_connect]
75
+ ::SequelRails.setup(::Rails.env) if database_connection_required?(app)
72
76
  end
73
77
 
74
78
  initializer 'sequel.spring' do |_app|
@@ -105,5 +109,17 @@ module SequelRails
105
109
  require 'sequel_rails/railties/controller_runtime'
106
110
  ActionController::Base.send :include, SequelRails::Railties::ControllerRuntime
107
111
  end
112
+
113
+ def check_skip_connect_conditions(app)
114
+ app.config.sequel[:skip_connect] ||= database_create_command?
115
+ end
116
+
117
+ def database_connection_required?(app)
118
+ !app.config.sequel[:skip_connect]
119
+ end
120
+
121
+ def database_create_command?
122
+ ["db:create", "db:create:all"].any? { |c| ARGV.include?(c) }
123
+ end
108
124
  end
109
125
  end
@@ -22,11 +22,17 @@ namespace sequel_rails_namespace do
22
22
  task :dump => :environment do
23
23
  db_for_current_env.extension :schema_dumper
24
24
  filename = ENV['SCHEMA'] || "#{Rails.root}/db/schema.rb"
25
- File.open filename, 'w' do |file|
26
- file << db_for_current_env.dump_schema_migration(:same_db => true)
27
- file << SequelRails::Migrations.dump_schema_information(:sql => false)
25
+
26
+ if Rails.root.join("db").exist?
27
+ File.open filename, 'w' do |file|
28
+ file << db_for_current_env.dump_schema_migration(:same_db => true)
29
+ file << SequelRails::Migrations.dump_schema_information(:sql => false)
30
+ end
31
+
32
+ Rake::Task["#{sequel_rails_namespace}:schema:dump"].reenable
33
+ else
34
+ abort "The db/ directory doesn't exist, please create it."
28
35
  end
29
- Rake::Task["#{sequel_rails_namespace}:schema:dump"].reenable
30
36
  end
31
37
 
32
38
  desc 'Load a schema.rb file into the database'
@@ -45,6 +51,7 @@ namespace sequel_rails_namespace do
45
51
  namespace :structure do
46
52
  desc 'Dump the database structure to db/structure.sql'
47
53
  task :dump, [:env] => :environment do |_t, args|
54
+ db_for_current_env
48
55
  args.with_defaults(:env => Rails.env)
49
56
 
50
57
  filename = ENV['DB_STRUCTURE'] || File.join(Rails.root, 'db', 'structure.sql')
@@ -126,6 +133,7 @@ namespace sequel_rails_namespace do
126
133
  namespace :migrate do
127
134
  task :load => :environment do
128
135
  require 'sequel_rails/migrations'
136
+ db_for_current_env
129
137
  end
130
138
 
131
139
  desc 'Rollbacks the database one migration and re migrate up. If you want to rollback more than one step, define STEP=x. Target specific version with VERSION=x.'
@@ -1,3 +1,3 @@
1
1
  module SequelRails
2
- VERSION = '1.0.0'.freeze
2
+ VERSION = '1.0.1'.freeze
3
3
  end
@@ -32,9 +32,9 @@ Gem::Specification.new do |s|
32
32
  s.add_development_dependency 'combustion'
33
33
  s.add_development_dependency 'generator_spec'
34
34
  s.add_development_dependency 'rake', '>= 0.8.7', '< 12.1'
35
- s.add_development_dependency 'rspec', '~> 3.1'
36
- s.add_development_dependency 'rspec-rails', '~> 3.1', '< 3.6'
37
- s.add_development_dependency 'rubocop', '~> 0.50.0'
35
+ s.add_development_dependency 'rspec', '~> 3.7'
36
+ s.add_development_dependency 'rspec-rails', '~> 3.7'
37
+ s.add_development_dependency 'rubocop', '~> 0.52.0'
38
38
  s.add_development_dependency 'ammeter', '1.1.4'
39
39
  s.add_development_dependency 'test-unit'
40
40
  end
@@ -4,7 +4,12 @@ describe SessionsController, :type => :request do
4
4
  let(:session_class) { ::ActionDispatch::Session::SequelStore.session_class }
5
5
 
6
6
  def login
7
- post '/session', :status => 'logged_in'
7
+ opts = if ActionPack::VERSION::MAJOR >= 5
8
+ {params: {:status => 'logged_in'}}
9
+ else
10
+ {:status => 'logged_in'}
11
+ end
12
+ post '/session', opts
8
13
  end
9
14
 
10
15
  describe '#create' do
@@ -53,6 +53,7 @@ end
53
53
  begin
54
54
  require 'sequel_rails/storage'
55
55
  require 'sequel/extensions/migration'
56
+ ::SequelRails.setup(Rails.env)
56
57
  load "#{Rails.root}/db/schema.rb.init"
57
58
  Sequel::Migration.descendants.first.apply Sequel::Model.db, :up
58
59
  rescue Sequel::DatabaseConnectionError => e
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: 1.0.0
4
+ version: 1.0.1
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-11-20 00:00:00.000000000 Z
12
+ date: 2018-02-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activemodel
@@ -127,48 +127,42 @@ dependencies:
127
127
  requirements:
128
128
  - - "~>"
129
129
  - !ruby/object:Gem::Version
130
- version: '3.1'
130
+ version: '3.7'
131
131
  type: :development
132
132
  prerelease: false
133
133
  version_requirements: !ruby/object:Gem::Requirement
134
134
  requirements:
135
135
  - - "~>"
136
136
  - !ruby/object:Gem::Version
137
- version: '3.1'
137
+ version: '3.7'
138
138
  - !ruby/object:Gem::Dependency
139
139
  name: rspec-rails
140
140
  requirement: !ruby/object:Gem::Requirement
141
141
  requirements:
142
142
  - - "~>"
143
143
  - !ruby/object:Gem::Version
144
- version: '3.1'
145
- - - "<"
146
- - !ruby/object:Gem::Version
147
- version: '3.6'
144
+ version: '3.7'
148
145
  type: :development
149
146
  prerelease: false
150
147
  version_requirements: !ruby/object:Gem::Requirement
151
148
  requirements:
152
149
  - - "~>"
153
150
  - !ruby/object:Gem::Version
154
- version: '3.1'
155
- - - "<"
156
- - !ruby/object:Gem::Version
157
- version: '3.6'
151
+ version: '3.7'
158
152
  - !ruby/object:Gem::Dependency
159
153
  name: rubocop
160
154
  requirement: !ruby/object:Gem::Requirement
161
155
  requirements:
162
156
  - - "~>"
163
157
  - !ruby/object:Gem::Version
164
- version: 0.50.0
158
+ version: 0.52.0
165
159
  type: :development
166
160
  prerelease: false
167
161
  version_requirements: !ruby/object:Gem::Requirement
168
162
  requirements:
169
163
  - - "~>"
170
164
  - !ruby/object:Gem::Version
171
- version: 0.50.0
165
+ version: 0.52.0
172
166
  - !ruby/object:Gem::Dependency
173
167
  name: ammeter
174
168
  requirement: !ruby/object:Gem::Requirement
@@ -305,7 +299,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
305
299
  version: 1.8.11
306
300
  requirements: []
307
301
  rubyforge_project:
308
- rubygems_version: 2.5.2
302
+ rubygems_version: 2.6.14
309
303
  signing_key:
310
304
  specification_version: 4
311
305
  summary: Use Sequel with Rails (3.x and 4.x)