rom-sql 0.5.3 → 0.6.0.beta1

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: a3b5357a86ca00174aa17cce24a077a1eb843238
4
- data.tar.gz: 4e7165c1dc95b56b1823def507746fefc0c0c74e
3
+ metadata.gz: f021e93524b9b69f53f28b06b664c5b118ff3756
4
+ data.tar.gz: 37721788b60206c7db1874ca725197eac7bd11d1
5
5
  SHA512:
6
- metadata.gz: fe54d5beae0bf5cb3b249ff8a6c17b445b351ebcf61651b02903dda3205d4d1696162be311b82ff68a08b6d9496f735529e7d0807f200a88f3b5445b11787314
7
- data.tar.gz: 5458d5da39115d940d9c01989723bbee280ad6f50710c3324e78936c41b91d1c2b2a642e1a5ed58d2bf04320c9b6b1fb1beff26f5795f2806082f0f635dc241b
6
+ metadata.gz: 1f402a0f8c0e292e759a586fae0e7d3ac00bb53867ca1217a7a8415006be7c47b4118bb65059ae816784fd28048faf2a20fd9aa772240eb4e70d8e7f741a9fae
7
+ data.tar.gz: ece947688c9b65010aee26585bfbb07650db44414a6b8c1b8fc5b209664761e19c7953b760d374032b4fbe5a24b2cfa7ed6b788d1be4f76976026067d6d74d71
data/.gitignore CHANGED
@@ -1,3 +1,5 @@
1
+ /vendor/
2
+ /db/
1
3
  /.bundle/
2
4
  /.yardoc
3
5
  /Gemfile.lock
data/Gemfile CHANGED
@@ -6,6 +6,8 @@ group :test do
6
6
  gem 'byebug', platforms: :mri
7
7
  gem 'anima'
8
8
  gem 'rom', github: 'rom-rb/rom', branch: 'master'
9
+ gem 'rom-support', github: 'rom-rb/rom-support', branch: 'master'
10
+ gem 'rom-mapper', github: 'rom-rb/rom-mapper', branch: 'master'
9
11
  gem 'virtus'
10
12
  gem 'activesupport'
11
13
  gem 'rspec', '~> 3.1'
@@ -1,57 +1,16 @@
1
1
  require "sequel"
2
2
  require "rom"
3
3
 
4
- module ROM
5
- module SQL
6
- NoAssociationError = Class.new(StandardError)
7
-
8
- class Error < StandardError
9
- attr_reader :original_exception
10
-
11
- def initialize(original_exception)
12
- super(original_exception.message)
13
- @original_exception = original_exception
14
- set_backtrace(original_exception.backtrace)
15
- end
16
- end
17
-
18
- DatabaseError = Class.new(Error)
19
-
20
- ConstraintError = Class.new(Error)
21
-
22
- NotNullConstraintError = Class.new(ConstraintError)
23
- UniqueConstraintError = Class.new(ConstraintError)
24
- ForeignKeyConstraintError = Class.new(ConstraintError)
25
- CheckConstraintError = Class.new(ConstraintError)
26
-
27
- ERROR_MAP = {
28
- Sequel::DatabaseError => DatabaseError,
29
- Sequel::NotNullConstraintViolation => NotNullConstraintError,
30
- Sequel::UniqueConstraintViolation => UniqueConstraintError,
31
- Sequel::ForeignKeyConstraintViolation => ForeignKeyConstraintError,
32
- Sequel::CheckConstraintViolation => CheckConstraintError
33
- }.freeze
34
- end
35
- end
36
-
37
- require 'rom/sql/plugin/associates'
38
- require 'rom/sql/plugin/pagination'
39
-
40
- ROM.plugins do
41
- adapter :sql do
42
- register :pagination, ROM::SQL::Plugin::Pagination, type: :relation
43
- register :associates, ROM::SQL::Plugin::Associates, type: :command
44
- end
45
- end
46
-
47
4
  require "rom/sql/version"
5
+ require "rom/sql/errors"
6
+ require "rom/sql/plugins"
48
7
  require "rom/sql/relation"
49
8
  require "rom/sql/gateway"
50
9
  require "rom/sql/migration"
51
10
 
52
11
  if defined?(Rails)
53
12
  require "rom/sql/support/active_support_notifications"
54
- require 'rom/sql/support/rails_log_subscriber'
13
+ require "rom/sql/support/rails_log_subscriber"
55
14
  end
56
15
 
57
16
  ROM.register_adapter(:sql, ROM::SQL)
@@ -0,0 +1,13 @@
1
+ module ROM
2
+ module SQL
3
+ class Error < StandardError
4
+ attr_reader :original_exception
5
+
6
+ def initialize(original_exception)
7
+ super(original_exception.message)
8
+ @original_exception = original_exception
9
+ set_backtrace(original_exception.backtrace)
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,21 @@
1
+ require "rom/sql/error"
2
+
3
+ module ROM
4
+ module SQL
5
+ NoAssociationError = Class.new(StandardError)
6
+ DatabaseError = Class.new(Error)
7
+ ConstraintError = Class.new(Error)
8
+ NotNullConstraintError = Class.new(ConstraintError)
9
+ UniqueConstraintError = Class.new(ConstraintError)
10
+ ForeignKeyConstraintError = Class.new(ConstraintError)
11
+ CheckConstraintError = Class.new(ConstraintError)
12
+
13
+ ERROR_MAP = {
14
+ Sequel::DatabaseError => DatabaseError,
15
+ Sequel::NotNullConstraintViolation => NotNullConstraintError,
16
+ Sequel::UniqueConstraintViolation => UniqueConstraintError,
17
+ Sequel::ForeignKeyConstraintViolation => ForeignKeyConstraintError,
18
+ Sequel::CheckConstraintViolation => CheckConstraintError
19
+ }.freeze
20
+ end
21
+ end
@@ -56,8 +56,6 @@ module ROM
56
56
  option :pager, reader: true, default: proc { |relation|
57
57
  Pager.new(relation.dataset, per_page: relation.class.per_page)
58
58
  }
59
-
60
- exposed_relations.merge([:pager, :page, :per_page])
61
59
  end
62
60
  end
63
61
 
@@ -0,0 +1,9 @@
1
+ require "rom/sql/plugin/associates"
2
+ require "rom/sql/plugin/pagination"
3
+
4
+ ROM.plugins do
5
+ adapter :sql do
6
+ register :pagination, ROM::SQL::Plugin::Pagination, type: :relation
7
+ register :associates, ROM::SQL::Plugin::Associates, type: :command
8
+ end
9
+ end
@@ -1,5 +1,5 @@
1
1
  module ROM
2
2
  module SQL
3
- VERSION = '0.5.3'.freeze
3
+ VERSION = '0.6.0.beta1'.freeze
4
4
  end
5
5
  end
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_runtime_dependency "sequel", "~> 4.18"
22
22
  spec.add_runtime_dependency "equalizer", "~> 0.0", ">= 0.0.9"
23
- spec.add_runtime_dependency "rom", "~> 0.8", ">= 0.8.0"
23
+ spec.add_runtime_dependency "rom", "~> 0.9.0.beta1"
24
24
 
25
25
  spec.add_development_dependency "bundler"
26
26
  spec.add_development_dependency "rake", "~> 10.0"
@@ -21,6 +21,8 @@ begin
21
21
  rescue LoadError
22
22
  end
23
23
 
24
+ ROM.use :auto_registration
25
+
24
26
  LOGGER = Logger.new(File.open('./log/test.log', 'a'))
25
27
  DB_URI = 'postgres://localhost/rom'
26
28
 
@@ -43,6 +45,6 @@ RSpec.configure do |config|
43
45
  config.after do
44
46
  added_constants = Object.constants - @constants
45
47
  added_constants.each { |name| Object.send(:remove_const, name) }
46
- ROM.instance_variable_set('@gateways', {})
48
+ ROM.instance_variable_get('@environment').instance_variable_set('@gateways', {})
47
49
  end
48
50
  end
@@ -39,8 +39,8 @@ describe 'Plugin / Pagination' do
39
39
  it 'returns paginated relation with provided limit' do
40
40
  users = rom.relation(:users).page(2).per_page(5)
41
41
 
42
- expect(users.relation.dataset.opts[:offset]).to eql(5)
43
- expect(users.relation.dataset.opts[:limit]).to eql(5)
42
+ expect(users.dataset.opts[:offset]).to eql(5)
43
+ expect(users.dataset.opts[:limit]).to eql(5)
44
44
 
45
45
  expect(users.pager.current_page).to eql(2)
46
46
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rom-sql
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3
4
+ version: 0.6.0.beta1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Solnica
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-23 00:00:00.000000000 Z
11
+ date: 2015-08-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sequel
@@ -50,20 +50,14 @@ dependencies:
50
50
  requirements:
51
51
  - - "~>"
52
52
  - !ruby/object:Gem::Version
53
- version: '0.8'
54
- - - ">="
55
- - !ruby/object:Gem::Version
56
- version: 0.8.0
53
+ version: 0.9.0.beta1
57
54
  type: :runtime
58
55
  prerelease: false
59
56
  version_requirements: !ruby/object:Gem::Requirement
60
57
  requirements:
61
58
  - - "~>"
62
59
  - !ruby/object:Gem::Version
63
- version: '0.8'
64
- - - ">="
65
- - !ruby/object:Gem::Version
66
- version: 0.8.0
60
+ version: 0.9.0.beta1
67
61
  - !ruby/object:Gem::Dependency
68
62
  name: bundler
69
63
  requirement: !ruby/object:Gem::Requirement
@@ -119,6 +113,8 @@ files:
119
113
  - lib/rom/sql/commands/transaction.rb
120
114
  - lib/rom/sql/commands/update.rb
121
115
  - lib/rom/sql/commands_ext/postgres.rb
116
+ - lib/rom/sql/error.rb
117
+ - lib/rom/sql/errors.rb
122
118
  - lib/rom/sql/gateway.rb
123
119
  - lib/rom/sql/header.rb
124
120
  - lib/rom/sql/migration.rb
@@ -126,6 +122,7 @@ files:
126
122
  - lib/rom/sql/migration/template.rb
127
123
  - lib/rom/sql/plugin/associates.rb
128
124
  - lib/rom/sql/plugin/pagination.rb
125
+ - lib/rom/sql/plugins.rb
129
126
  - lib/rom/sql/rake_task.rb
130
127
  - lib/rom/sql/relation.rb
131
128
  - lib/rom/sql/relation/associations.rb
@@ -178,9 +175,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
178
175
  version: '0'
179
176
  required_rubygems_version: !ruby/object:Gem::Requirement
180
177
  requirements:
181
- - - ">="
178
+ - - ">"
182
179
  - !ruby/object:Gem::Version
183
- version: '0'
180
+ version: 1.3.1
184
181
  requirements: []
185
182
  rubyforge_project:
186
183
  rubygems_version: 2.4.5