1
1
require 'bundler'
2
+ require_relative 'helpers/helpers'
2
3
3
4
module Config
4
5
module Integrations
5
6
class Heroku < Struct . new ( :app )
7
+ include Integrations ::Helpers
8
+
6
9
def invoke
7
10
puts 'Setting vars...'
8
11
heroku_command = "config:set #{ vars } "
@@ -14,13 +17,13 @@ def invoke
14
17
def vars
15
18
# Load only local options to Heroku
16
19
Config . load_and_set_settings (
17
- Rails . root . join ( "config" , "settings.local.yml" ) . to_s ,
18
- Rails . root . join ( "config" , "settings" , "#{ environment } .local.yml" ) . to_s ,
19
- Rails . root . join ( "config" , "environments" , "#{ environment } .local.yml" ) . to_s
20
+ :: Rails . root . join ( "config" , "settings.local.yml" ) . to_s ,
21
+ :: Rails . root . join ( "config" , "settings" , "#{ environment } .local.yml" ) . to_s ,
22
+ :: Rails . root . join ( "config" , "environments" , "#{ environment } .local.yml" ) . to_s
20
23
)
21
24
22
25
out = ''
23
- dotted_hash = to_dotted_hash Kernel . const_get ( Config . const_name ) . to_hash , { } , Config . const_name
26
+ dotted_hash = to_dotted_hash Kernel . const_get ( Config . const_name ) . to_hash , namespace : Config . const_name
24
27
dotted_hash . each { |key , value | out += " #{ key } =#{ value } " }
25
28
out
26
29
end
@@ -38,22 +41,6 @@ def `(command)
38
41
Bundler . with_clean_env { super }
39
42
end
40
43
41
- def to_dotted_hash ( source , target = { } , namespace = nil )
42
- prefix = "#{ namespace } ." if namespace
43
- case source
44
- when Hash
45
- source . each do |key , value |
46
- to_dotted_hash ( value , target , "#{ prefix } #{ key } " )
47
- end
48
- when Array
49
- source . each_with_index do |value , index |
50
- to_dotted_hash ( value , target , "#{ prefix } #{ index } " )
51
- end
52
- else
53
- target [ namespace ] = source
54
- end
55
- target
56
- end
57
44
end
58
45
end
59
46
end
0 commit comments