sequel-rails 0.4.3 → 0.4.4

Sign up to get free protection for your applications and to get access to all the features.
data/History.md CHANGED
@@ -1,3 +1,11 @@
1
+ 0.4.4 (2013-06-06)
2
+ ==================
3
+
4
+ * Fix schema_dumper extension inclusion to remove deprecation warning in
5
+ Sequel 3.48 (Jacques Crocker)
6
+ * Add support for dumping/loading sql schema for MySQL (Saulius Grigaliunas)
7
+ * Add support for configuring max connections in app config (Rafał Rzepecki)
8
+
1
9
  0.4.3 (2013-04-03)
2
10
  ==================
3
11
 
data/README.md CHANGED
@@ -128,6 +128,8 @@ Improvements has been made by those awesome contributors:
128
128
  * Ed Ruder (edruder)
129
129
  * Rafał Rzepecki (dividedmind)
130
130
  * Sean Sorrell (rudle)
131
+ * Saulius Grigaliunas (sauliusg)
132
+ * Jacques Crocker (railsjedi)
131
133
 
132
134
  Credits
133
135
  =======
@@ -38,6 +38,7 @@ module SequelRails
38
38
  private
39
39
 
40
40
  def initialize(root, database_yml_hash)
41
+ super()
41
42
  @root, @raw = root, database_yml_hash
42
43
  end
43
44
 
@@ -72,6 +73,9 @@ module SequelRails
72
73
  end
73
74
  end
74
75
 
76
+ # override max connections if requested in app configuration
77
+ config['max_connections'] = max_connections if max_connections
78
+
75
79
  # some adapters only support an url
76
80
  if config['adapter'] && config['adapter'] =~ /^(jdbc|do):/
77
81
  params = {}
@@ -18,7 +18,7 @@ namespace :db do
18
18
  namespace :schema do
19
19
  desc "Create a db/schema.rb file that can be portably used against any DB supported by Sequel"
20
20
  task :dump => :environment do
21
- ::Sequel.extension :schema_dumper
21
+ db_for_current_env.extension :schema_dumper
22
22
  File.open(ENV['SCHEMA'] || "#{Rails.root}/db/schema.rb", "w") do |file|
23
23
  file.write db_for_current_env.dump_schema_migration(:same_db => true)
24
24
  end
@@ -11,6 +11,26 @@ module SequelRails
11
11
  execute("DROP DATABASE IF EXISTS `#{database}`")
12
12
  end
13
13
 
14
+ def _dump filename
15
+ commands = %w(mysqldump --no-data)
16
+ commands << "--user=#{Shellwords.escape(username)}" unless username.blank?
17
+ commands << "--password=#{Shellwords.escape(password)}" unless password.blank?
18
+ commands << "--host=#{host}" unless host.blank?
19
+ commands << "--result-file" << filename
20
+ commands << database
21
+ system(*commands)
22
+ end
23
+
24
+ def _load filename
25
+ commands = %w(mysql)
26
+ commands << "--user=#{Shellwords.escape(username)}" unless username.blank?
27
+ commands << "--password=#{Shellwords.escape(password)}" unless password.blank?
28
+ commands << "--host=#{host}" unless host.blank?
29
+ commands << '--execute' << %{SET FOREIGN_KEY_CHECKS = 0; SOURCE #{filename}; SET FOREIGN_KEY_CHECKS = 1}
30
+ commands << '--database' << database
31
+ system(*commands)
32
+ end
33
+
14
34
  private
15
35
 
16
36
  def execute(statement)
@@ -1,3 +1,3 @@
1
1
  module SequelRails
2
- VERSION = "0.4.3"
2
+ VERSION = "0.4.4"
3
3
  end
@@ -41,12 +41,46 @@ describe SequelRails::Configuration do
41
41
  subject { SequelRails.setup(environment) }
42
42
 
43
43
  describe ".setup" do
44
+
45
+ shared_context "max_connections" do
46
+ let(:max_connections) { 31337 }
47
+ before do
48
+ environments[environment]["max_connections"] = 7
49
+ SequelRails.configuration.max_connections = max_connections
50
+ end
51
+ end
52
+
53
+ shared_examples "max_connections_c" do
54
+ context "with max_connections config option" do
55
+ include_context "max_connections"
56
+ it "overrides the option from the configuration" do
57
+ ::Sequel.should_receive(:connect) do |hash|
58
+ hash['max_connections'].should == max_connections
59
+ end
60
+ subject
61
+ end
62
+ end
63
+ end
44
64
 
45
- context "for a postgres connection" do
65
+ shared_examples "max_connections_j" do
66
+ context "with max_connections config option" do
67
+ include_context "max_connections"
68
+ it "overrides the option from the configuration" do
69
+ ::Sequel.should_receive(:connect) do |url, hash|
70
+ url.should include("max_connections=#{max_connections}")
71
+ end
72
+ subject
73
+ end
74
+ end
75
+ end
46
76
 
77
+ context "for a postgres connection" do
78
+
47
79
  let(:environment) { 'development' }
48
80
 
49
81
  context "in C-Ruby" do
82
+
83
+ include_examples "max_connections_c"
50
84
 
51
85
  it "produces a sane config without url" do
52
86
  ::Sequel.should_receive(:connect) do |hash|
@@ -54,9 +88,12 @@ describe SequelRails::Configuration do
54
88
  end
55
89
  subject
56
90
  end
91
+
57
92
  end
58
93
 
59
94
  context "in JRuby" do
95
+
96
+ include_examples "max_connections_j"
60
97
 
61
98
  let(:is_jruby) { true }
62
99
 
@@ -72,11 +109,13 @@ describe SequelRails::Configuration do
72
109
  end
73
110
 
74
111
  context "for a mysql connection" do
75
-
112
+
76
113
  let(:environment) { 'remote' }
77
114
 
78
115
  context "in C-Ruby" do
79
116
 
117
+ include_examples "max_connections_c"
118
+
80
119
  it "produces a config without url" do
81
120
  ::Sequel.should_receive(:connect) do |hash|
82
121
  hash['adapter'].should == 'mysql'
@@ -86,6 +125,8 @@ describe SequelRails::Configuration do
86
125
  end
87
126
 
88
127
  context "in JRuby" do
128
+
129
+ include_examples "max_connections_j"
89
130
 
90
131
  let(:is_jruby) { true }
91
132
 
metadata CHANGED
@@ -1,7 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sequel-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ prerelease:
5
+ version: 0.4.4
5
6
  platform: ruby
6
7
  authors:
7
8
  - Brasten Sager (brasten)
@@ -9,92 +10,104 @@ authors:
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
- date: 2013-04-03 00:00:00.000000000 Z
13
+ date: 2013-06-06 00:00:00.000000000 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
16
+ name: sequel
15
17
  requirement: !ruby/object:Gem::Requirement
16
18
  requirements:
17
19
  - - ~>
18
20
  - !ruby/object:Gem::Version
19
21
  version: '3.28'
22
+ none: false
20
23
  type: :runtime
21
- prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
23
25
  requirements:
24
26
  - - ~>
25
27
  - !ruby/object:Gem::Version
26
28
  version: '3.28'
27
- name: sequel
29
+ none: false
30
+ prerelease: false
28
31
  - !ruby/object:Gem::Dependency
32
+ name: railties
29
33
  requirement: !ruby/object:Gem::Requirement
30
34
  requirements:
31
35
  - - ! '>='
32
36
  - !ruby/object:Gem::Version
33
37
  version: 3.2.0
38
+ none: false
34
39
  type: :runtime
35
- prerelease: false
36
40
  version_requirements: !ruby/object:Gem::Requirement
37
41
  requirements:
38
42
  - - ! '>='
39
43
  - !ruby/object:Gem::Version
40
44
  version: 3.2.0
41
- name: railties
45
+ none: false
46
+ prerelease: false
42
47
  - !ruby/object:Gem::Dependency
48
+ name: rake
43
49
  requirement: !ruby/object:Gem::Requirement
44
50
  requirements:
45
51
  - - ! '>='
46
52
  - !ruby/object:Gem::Version
47
53
  version: 0.8.7
54
+ none: false
48
55
  type: :development
49
- prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
51
57
  requirements:
52
58
  - - ! '>='
53
59
  - !ruby/object:Gem::Version
54
60
  version: 0.8.7
55
- name: rake
61
+ none: false
62
+ prerelease: false
56
63
  - !ruby/object:Gem::Dependency
64
+ name: rspec
57
65
  requirement: !ruby/object:Gem::Requirement
58
66
  requirements:
59
67
  - - ~>
60
68
  - !ruby/object:Gem::Version
61
69
  version: 2.7.0
70
+ none: false
62
71
  type: :development
63
- prerelease: false
64
72
  version_requirements: !ruby/object:Gem::Requirement
65
73
  requirements:
66
74
  - - ~>
67
75
  - !ruby/object:Gem::Version
68
76
  version: 2.7.0
69
- name: rspec
77
+ none: false
78
+ prerelease: false
70
79
  - !ruby/object:Gem::Dependency
80
+ name: combustion
71
81
  requirement: !ruby/object:Gem::Requirement
72
82
  requirements:
73
83
  - - ~>
74
84
  - !ruby/object:Gem::Version
75
85
  version: 0.3.1
86
+ none: false
76
87
  type: :development
77
- prerelease: false
78
88
  version_requirements: !ruby/object:Gem::Requirement
79
89
  requirements:
80
90
  - - ~>
81
91
  - !ruby/object:Gem::Version
82
92
  version: 0.3.1
83
- name: combustion
93
+ none: false
94
+ prerelease: false
84
95
  - !ruby/object:Gem::Dependency
96
+ name: generator_spec
85
97
  requirement: !ruby/object:Gem::Requirement
86
98
  requirements:
87
99
  - - ~>
88
100
  - !ruby/object:Gem::Version
89
101
  version: 0.8.7
102
+ none: false
90
103
  type: :development
91
- prerelease: false
92
104
  version_requirements: !ruby/object:Gem::Requirement
93
105
  requirements:
94
106
  - - ~>
95
107
  - !ruby/object:Gem::Version
96
108
  version: 0.8.7
97
- name: generator_spec
109
+ none: false
110
+ prerelease: false
98
111
  description: Integrate Sequel with Rails 3
99
112
  email:
100
113
  - brasten@gmail.com
@@ -162,7 +175,6 @@ files:
162
175
  - tasks/spec.rake
163
176
  homepage: https://github.com/TalentBox/sequel-rails
164
177
  licenses: []
165
- metadata: {}
166
178
  post_install_message:
167
179
  rdoc_options:
168
180
  - --charset=UTF-8
@@ -172,17 +184,25 @@ required_ruby_version: !ruby/object:Gem::Requirement
172
184
  requirements:
173
185
  - - ! '>='
174
186
  - !ruby/object:Gem::Version
187
+ segments:
188
+ - 0
189
+ hash: 4249584526401999272
175
190
  version: '0'
191
+ none: false
176
192
  required_rubygems_version: !ruby/object:Gem::Requirement
177
193
  requirements:
178
194
  - - ! '>='
179
195
  - !ruby/object:Gem::Version
196
+ segments:
197
+ - 0
198
+ hash: 4249584526401999272
180
199
  version: '0'
200
+ none: false
181
201
  requirements: []
182
202
  rubyforge_project:
183
- rubygems_version: 2.0.3
203
+ rubygems_version: 1.8.25
184
204
  signing_key:
185
- specification_version: 4
205
+ specification_version: 3
186
206
  summary: Use Sequel with Rails 3
187
207
  test_files:
188
208
  - spec/internal/Rakefile
checksums.yaml DELETED
@@ -1,15 +0,0 @@
1
- ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- ZGUzMDc4YTE3MzgzNDk3OTk0YWIzOTJhZDkyYmZiM2Q1ZGI0N2QxNA==
5
- data.tar.gz: !binary |-
6
- ZTUzM2RjZDFjZmQ1NjljYTU3NTE5MTcwODBhZjkzODNiMWI0NWM1Mw==
7
- !binary "U0hBNTEy":
8
- metadata.gz: !binary |-
9
- YTE4ZDhjNDllOGNhNzA2MzZmMTczMmM1Yjk4MDMzZWI2ZDM2YTAwNzU2MWRh
10
- M2UxYmJkYjA2YWFmOGQ2MjYwNTcyYjNlOGI3ZWYwODBjYTU0YThhZjlhYmNl
11
- MmQ0NzQ1MzExOTliYWRlNjhkMzYwNDAxMTAyZWRhYTBlMzcxZTE=
12
- data.tar.gz: !binary |-
13
- NjdlNmEwNWM1MjM3NmVmZjVlMDIzYjY1MzcwOGZlMTFhNzIyY2EzNGIzMDIw
14
- MmEyNzc2NDEyNDUyZTllY2IwNmYzODI4YmVmYzc2YWEzY2ZlZTZiZTU3ZGY1
15
- MTA2YzkyY2JkNDJiZDZiYmQzZDA3YzMzMDBlZDkwMjIzOGJkMjk=