iron_core 0.3.2 → 0.3.3

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.
Files changed (3) hide show
  1. data/VERSION +1 -1
  2. data/lib/iron_core/client.rb +10 -8
  3. metadata +2 -2
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.2
1
+ 0.3.3
@@ -26,7 +26,7 @@ module IronCore
26
26
  end
27
27
 
28
28
  @env = options[:env] || options['env']
29
- @env ||= ENV[company.upcase + '_' + product.upcase + '_ENV'] || ENV[product.upcase + '_ENV'] || ENV[company.upcase + '_ENV']
29
+ @env ||= ENV[company.upcase + '_' + product.upcase + '_ENV'] || ENV[company.upcase + '_ENV']
30
30
 
31
31
  IronCore::Logger.info 'IronCore', "Setting env to '#{@env}'" unless @env.nil?
32
32
 
@@ -35,25 +35,23 @@ module IronCore
35
35
  load_from_config(company, product, options[:config] || options['config'])
36
36
 
37
37
  load_from_config(company, product, ENV[company.upcase + '_' + product.upcase + '_CONFIG'])
38
- load_from_config(company, product, ENV[product.upcase + '_CONFIG'])
39
38
  load_from_config(company, product, ENV[company.upcase + '_CONFIG'])
40
39
 
41
40
  load_from_env(company.upcase + '_' + product.upcase)
42
- load_from_env(product.upcase)
43
41
  load_from_env(company.upcase)
44
42
 
45
43
  suffixes = []
46
44
 
47
45
  unless @env.nil?
48
- suffixes << "-#{env}"
49
- suffixes << "_#{env}"
46
+ suffixes << "-#{@env}"
47
+ suffixes << "_#{@env}"
50
48
  end
51
49
 
52
50
  suffixes << ''
53
51
 
54
52
  suffixes.each do |suffix|
55
- ['.json', ''].each do |ext|
56
- ["#{company}-#{product}", "#{company}_#{product}", product, company].each do |config_base|
53
+ ['.json'].each do |ext|
54
+ ["#{company}-#{product}", "#{company}_#{product}", company].each do |config_base|
57
55
  load_from_config(company, product, "#{config_base}#{suffix}#{ext}")
58
56
  load_from_config(company, product, ".#{config_base}#{suffix}#{ext}")
59
57
  load_from_config(company, product, "~/#{config_base}#{suffix}#{ext}")
@@ -110,12 +108,16 @@ module IronCore
110
108
  return if config_file.nil?
111
109
 
112
110
  if File.exists?(File.expand_path(config_file))
111
+ config_data = '{}'
112
+
113
113
  begin
114
- config = JSON.load(File.read(File.expand_path(config_file)))
114
+ config_data = File.read(File.expand_path(config_file))
115
115
  rescue
116
116
  return
117
117
  end
118
118
 
119
+ config = JSON.parse(config_data)
120
+
119
121
  unless @env.nil?
120
122
  load_from_hash(config_file, get_sub_hash(config, [@env, "#{company}_#{product}"]))
121
123
  load_from_hash(config_file, get_sub_hash(config, [@env, company, product]))
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iron_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -89,7 +89,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
89
89
  version: '0'
90
90
  segments:
91
91
  - 0
92
- hash: 831761085
92
+ hash: -553634863
93
93
  required_rubygems_version: !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements: