1
1
require 'thor'
2
+ require 'json'
2
3
require 'envied/env_var_extractor'
3
4
4
5
class ENVied
@@ -84,7 +85,7 @@ def check
84
85
85
86
The Heroku config should be piped to this task:
86
87
87
- heroku config | bundle exec envied check:heroku
88
+ heroku config --json | bundle exec envied check:heroku
88
89
89
90
Use the check:heroku:binstub-task to turn this into a bash-script.
90
91
@@ -96,16 +97,12 @@ def check
96
97
define_method "check:heroku" do
97
98
if STDIN . tty?
98
99
error <<-ERR
99
- Please pipe the contents of `heroku config` to this task.
100
- I.e. `heroku config | bundle exec envied check:heroku`"
100
+ Please pipe the contents of `heroku config --json ` to this task.
101
+ I.e. `heroku config --json | bundle exec envied check:heroku`"
101
102
ERR
102
103
exit 1
103
104
end
104
- config = STDIN . read
105
- heroku_env = Hash [ config . split ( "\n " ) [ 1 ..-1 ] . each_with_object ( [ ] ) do |i , res |
106
- res << i . split ( ":" , 2 ) . map ( &:strip )
107
- end ]
108
-
105
+ heroku_env = JSON . parse ( STDIN . read )
109
106
ENV . replace ( { } ) . update ( heroku_env )
110
107
111
108
requested_groups = ENV [ 'ENVIED_GROUPS' ] || options [ :groups ]
@@ -119,7 +116,7 @@ def check
119
116
long_desc <<-LONG
120
117
Generates a shell script to check the Heroku config against the local Envfile.
121
118
122
- The same as the check:heroku-task, but all in one script (no need to pipe `heroku config` to it etc.).
119
+ The same as the check:heroku-task, but all in one script (no need to pipe `heroku config --json ` to it etc.).
123
120
124
121
LONG
125
122
option :dest , banner : "where to put the script" , desc : "Default: bin/<app>-env-check or bin/heroku-env-check"
0 commit comments