rails-infrastructure 0.1.1 → 0.1.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,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 068152765c0f61ee6b1c368e2ba33d76797423ae
4
- data.tar.gz: 752717d2c0373131c3a3219a1e0c32187aaf893f
3
+ metadata.gz: a5045a137b3998ad395180087110314e178da906
4
+ data.tar.gz: 633b880d6a015d602f50c68ec800d6691ec504ff
5
5
  SHA512:
6
- metadata.gz: 6b55b493ee54c3f9a2bb1c67188641737d38a864952ae79afd115292b663fc76e6dcb4a5f50ff845823463a9844e7f6dd3eb5f6e6bd4ff36d7a8eed7fac8364d
7
- data.tar.gz: 32ebad1cf90c6800de2ae1d9ffcee7e424cc9b5676f5685e73a372a0133426fb1594af12dd70129fdc8aa76ab0e6dd020554682b90aa72767306185868376f9d
6
+ metadata.gz: 5210f0ce3c3428b49b1b900c7584605826374ec10faef069498668b08340f3f6b9aedaff9f9cd339df8240bf6f64242ae39523c5ee91ad36644be3a8a8fd3544
7
+ data.tar.gz: a6d1ce9fe4b843858396051e8c57fad8881c39a4ba4ef26fc28af6e4dd3bf9ec521b758f8f441d5e1e1fc954f649ca19b750c824715222e4816085d2cf77c18c
@@ -1,5 +1,5 @@
1
1
  class Infrastructure
2
2
 
3
- VERSION = '0.1.1'
3
+ VERSION = '0.1.2'
4
4
 
5
5
  end
@@ -11,7 +11,9 @@ class Infrastructure
11
11
  @environment = environment.to_sym
12
12
  @global_defaults = {}
13
13
  @environment_defaults = {}
14
- @system = {}
14
+ @system = {
15
+ id: 'system'
16
+ }
15
17
  callback :after_configure, -> { merge_defaults }
16
18
  callback :after_assignment, -> (key, value) { merge_defaults }
17
19
  end
@@ -94,17 +96,21 @@ class Infrastructure
94
96
  connection.create_database database(id)
95
97
  end
96
98
 
97
- def connect(id)
98
- orm.establish_connection config(id)
99
+ def connect(id, params = {})
100
+ config = config(id)
101
+ unless params[:fallback]
102
+ raise ArgumentError, "database configuration for #{id} in environment #{environment} is not configured" if config[:id] != id.to_s
103
+ end
104
+ orm.establish_connection config
99
105
  end
100
106
 
101
- def connect!(id)
107
+ def connect!(id, params = {})
102
108
  begin
103
- connect id
109
+ connect id, params
104
110
  rescue StandardError
105
111
  connect system
106
112
  create id
107
- connect id
113
+ connect id, params
108
114
  end
109
115
  end
110
116
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-infrastructure
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Griffith Chaffee