standalone_migrations 4.0.1 → 4.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZTJmMmQ1NTE4N2YxNDhmYmQ2Y2IyYWJkZTE0YjkyYzdlNjA3NDBiYQ==
4
+ NDNhNGI2ZGY4YTM1MjgxNDQzZjNmNmE3M2ZjZDA1N2M4MjBlYWRiYg==
5
5
  data.tar.gz: !binary |-
6
- ZjcyOTYzMDVlNTBhZWJiNmQ5MTk3MTFmYzhlM2Q0NWNhNTQ2MzIxZg==
6
+ ZmRiZjRiNzJiNzUyMWFmZjU3ZWM4NmNiZmIzNDJkOTFhY2VmMTVhNw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZjhjMmY4NGU3YTE2Mjg3MjM0YTAxZTAyMjk0OTk5Mzk4MzYzZmNlODhlNTJh
10
- ODZlNTljZWZlOTlmMzJjYzYwOWZlZmMzMDQwZTEyNzdkNWY1YWM1NTEyMDM2
11
- OGIxNDhjMjY3NzJkNmJiY2E2ZWUzZmY0MzI1M2NjMDAxY2NkMWI=
9
+ MGY2YTA4Y2ZhMTk5ZDAxYWJiNjc4NzQ4YTE5ODYxMTYwMzI0OGNkMzkyMzBh
10
+ NjZkZDExYmFlNjdmNWRmOGZlNGVlNDEzMjc5NjQ3ZTAxMjlkZGJjMjY4Zjli
11
+ ZTBjMWQ3YzZkZjU1MDMzNTE0NzQxMDVmMmI1NDkxZmQ0YTE5NDE=
12
12
  data.tar.gz: !binary |-
13
- NWY2MGJiM2M4NGU5MDVjMGRjMjE3MTVjNzVkYjUyMjViMDc2OThkZmM5YmQ3
14
- NzVkYzdlMGQ4NzBmMmE1Zjg1OTdhZTk4MDdkNWQ1YmI4ODRmYWMyODdiYTEz
15
- NmRmMTJjZTgzN2Y1NjgwMmMzY2UxNjRmY2E0ZjgyOGQ5MDhhZjg=
13
+ NTAzNDUyNjc3YTRkNTYxYTUzZDE5MDMyYTBjZGUxZWUwNDUzZGQ0YzYxMjZh
14
+ YWQ5YTUxYzg1YjAyMjIzMDhjMmVmZGUwYzViZTgzMGFhM2JjZWIyM2ZkMDMz
15
+ YmY3NWVlMTdhNzUyNTc2YTE0YTcxMDNlMzdlMjRmMDY5NDRkMzM=
data/VERSION CHANGED
@@ -1 +1 @@
1
- 4.0.1
1
+ 4.0.2
@@ -22,11 +22,9 @@ module StandaloneMigrations
22
22
  class Configurator
23
23
  def self.load_configurations
24
24
  @standalone_configs ||= Configurator.new.config
25
- if url = ENV['DATABASE_URL']
26
- @environments_config = {url: url}
27
- else
28
- @environments_config ||= YAML.load(ERB.new(File.read(@standalone_configs)).result).with_indifferent_access
29
- end
25
+ @env_config ||= Rails.application.config.database_configuration
26
+ ActiveRecord::Base.configurations = @env_config
27
+ @env_config
30
28
  end
31
29
 
32
30
  def self.environments_config
@@ -43,6 +41,9 @@ module StandaloneMigrations
43
41
  }
44
42
  @options = load_from_file(defaults.dup) || defaults.merge(options)
45
43
  ENV['SCHEMA'] = ENV['SCHEMA'] || File.expand_path(schema)
44
+
45
+ Rails.application.config.root = Pathname.pwd
46
+ Rails.application.config.paths["config/database"] = config
46
47
  end
47
48
 
48
49
  def config
@@ -66,7 +67,7 @@ module StandaloneMigrations
66
67
  end
67
68
 
68
69
  def config_for(environment)
69
- config_for_all[environment]
70
+ config_for_all[environment.to_s]
70
71
  end
71
72
 
72
73
  private
@@ -1,8 +1,8 @@
1
1
  require File.expand_path("../../../standalone_migrations", __FILE__)
2
2
  namespace :standalone do
3
3
  task :connection do
4
- configurator = StandaloneMigrations::Configurator.new
5
- ActiveRecord::Base.establish_connection configurator.config_for(Rails.env)
4
+ StandaloneMigrations::Configurator.load_configurations
5
+ ActiveRecord::Base.establish_connection
6
6
  StandaloneMigrations.run_on_load_callbacks
7
7
  end
8
8
  end
@@ -39,7 +39,7 @@ module StandaloneMigrations
39
39
 
40
40
  it "load the yaml with environment configurations" do
41
41
  config = Configurator.new.config_for(:development)
42
- config[:database].should == "db/development.sql"
42
+ config["database"].should == "db/development.sql"
43
43
  end
44
44
 
45
45
  it "allow access the original configuration hash (for all environments)" do
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: standalone_migrations 4.0.1 ruby lib
5
+ # stub: standalone_migrations 4.0.2 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "standalone_migrations"
9
- s.version = "4.0.1"
9
+ s.version = "4.0.2"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["Todd Huss", "Michael Grosser"]
14
- s.date = "2015-04-01"
14
+ s.date = "2015-04-14"
15
15
  s.email = "thuss@gabrito.com"
16
16
  s.extra_rdoc_files = [
17
17
  "LICENSE",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: standalone_migrations
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.1
4
+ version: 4.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Todd Huss
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-04-01 00:00:00.000000000 Z
12
+ date: 2015-04-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake