sequel-rails 0.6.0 → 0.6.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: 3330d90f962d4bfa80130c3493821dd336026f9f
4
- data.tar.gz: 0bf339401f577de82fbabc98a7e0802c445a8937
3
+ metadata.gz: f72c17bd6336f3beaf4c924f50df1c3c5f465e26
4
+ data.tar.gz: 68c754a39afbf03af0beada56cd545c38167d59f
5
5
  SHA512:
6
- metadata.gz: f2223b86642bc6a5ee1fdf190fb50f49a3b7e75f98df818c0d00bc1bf787ab9c7643735cf6789737d0397d7e269e02a9de3d064f30d6b5354a0d3dd9e453016f
7
- data.tar.gz: fb92d8c8da9c8850b5ae5c843d9025049065b163e354284c8e78c378a1b27d547b969c82204b79969051e45dc8f9cd415dde02b984f29e716892abc576600197
6
+ metadata.gz: ba99ffdebabe0e37b4d17c4de59a00bc0fba5475505d7ddd5998570fb45652f1e2f93c4597b356a798c94e1b3a174d50ac6cf7181ae506ae6d56a699b49a1449
7
+ data.tar.gz: 46740f777f70160dd7d8ffa6158557280c0677dabe0b2eae00dc7631b33b3780da148d759c9f554b0b2d9bfa90fbe56f5f07d2796f6c74a4e946f6f1bef84346
data/History.md CHANGED
@@ -1,3 +1,8 @@
1
+ 0.6.1 (2013-09-16)
2
+ ==================
3
+
4
+ * Use a `SequelRails::Configuration` from the start in `app.config.sequel` [#44](https://github.com/TalentBox/sequel-rails/issues/41)
5
+
1
6
  0.6.0 (2013-09-12)
2
7
  ==================
3
8
 
@@ -16,16 +16,22 @@ module SequelRails
16
16
  class Configuration < ActiveSupport::OrderedOptions
17
17
 
18
18
  def self.for(root, database_yml_hash)
19
- ::SequelRails.configuration ||= new(root, database_yml_hash)
19
+ ::SequelRails.configuration ||= begin
20
+ config = new
21
+ config.root = root
22
+ config.raw = database_yml_hash
23
+ config
24
+ end
20
25
  end
21
26
 
22
- attr_reader :root, :raw
23
- attr_accessor :logger
24
- attr_accessor :migration_dir
25
-
26
- def initialize(root, database_yml_hash)
27
- super()
28
- @root, @raw = root, database_yml_hash
27
+ def initialize(*)
28
+ super
29
+ self.root = Rails.root
30
+ self.raw = nil
31
+ self.logger = Rails.logger
32
+ self.migration_dir = nil
33
+ self.schema_dump = default_schema_dump
34
+ self.load_database_tasks = true
29
35
  end
30
36
 
31
37
  def environment_for(name)
@@ -40,14 +46,6 @@ module SequelRails
40
46
  end
41
47
  end
42
48
 
43
- def schema_dump
44
- super.nil? ? (schema_dump = default_schema_dump) : super
45
- end
46
-
47
- def load_database_tasks
48
- super.nil? ? (load_database_tasks = true) : super
49
- end
50
-
51
49
  private
52
50
 
53
51
  def default_schema_dump
@@ -34,7 +34,7 @@ module SequelRails
34
34
  "Sequel::NoExistingObject" => :unprocessable_entity
35
35
  )
36
36
 
37
- config.sequel = ActiveSupport::OrderedOptions.new
37
+ config.sequel = ::SequelRails::Configuration.new
38
38
 
39
39
  rake_tasks do |app|
40
40
  if app.config.sequel.load_database_tasks
@@ -65,9 +65,11 @@ module SequelRails
65
65
 
66
66
  # Support overwriting crucial steps in subclasses
67
67
  def configure_sequel(app)
68
- app.config.sequel = ::SequelRails::Configuration.for(
69
- ::Rails.root, app.config.database_configuration
70
- ).merge!(app.config.sequel)
68
+ app.config.sequel.merge!(
69
+ :root => ::Rails.root,
70
+ :raw => app.config.database_configuration
71
+ )
72
+ ::SequelRails.configuration = app.config.sequel
71
73
  end
72
74
 
73
75
  def setup_i18n_support(app)
@@ -1,3 +1,3 @@
1
1
  module SequelRails
2
- VERSION = "0.6.0"
2
+ VERSION = "0.6.1"
3
3
  end
@@ -39,7 +39,8 @@ describe SequelRails::Configuration do
39
39
  let(:is_jruby) { false }
40
40
 
41
41
  before do
42
- SequelRails.configuration.stub(:raw).and_return environments
42
+ SequelRails.configuration = described_class.new
43
+ SequelRails.configuration.raw = environments
43
44
  SequelRails.configuration.instance_variable_set('@environments', nil)
44
45
  SequelRails.stub(:jruby?).and_return is_jruby
45
46
  end
@@ -188,7 +189,7 @@ describe SequelRails::Configuration do
188
189
 
189
190
  describe "#schema_dump" do
190
191
  before{ Rails.stub(:env).and_return environment }
191
- subject { SequelRails::Configuration.new("path/to/app", {}) }
192
+ subject{ described_class.new }
192
193
 
193
194
  context "in test environment" do
194
195
  let(:environment) { "test" }
@@ -237,7 +238,7 @@ describe SequelRails::Configuration do
237
238
  end
238
239
 
239
240
  describe "#load_database_tasks" do
240
- subject { SequelRails::Configuration.new("path/to/app", {}) }
241
+ subject{ described_class.new }
241
242
 
242
243
  it "defaults to true" do
243
244
  subject.load_database_tasks.should be_true
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.6.0
4
+ version: 0.6.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: 2013-09-12 00:00:00.000000000 Z
12
+ date: 2013-09-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sequel