11require 'thor'
2+ require 'json'
23require 'envied/env_var_extractor'
34
45class ENVied
@@ -84,7 +85,7 @@ def check
8485
8586 The Heroku config should be piped to this task:
8687
87- heroku config | bundle exec envied check:heroku
88+ heroku config --json | bundle exec envied check:heroku
8889
8990 Use the check:heroku:binstub-task to turn this into a bash-script.
9091
@@ -96,16 +97,12 @@ def check
9697 define_method "check:heroku" do
9798 if STDIN . tty?
9899 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`"
101102ERR
102103 exit 1
103104 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 )
109106 ENV . replace ( { } ) . update ( heroku_env )
110107
111108 requested_groups = ENV [ 'ENVIED_GROUPS' ] || options [ :groups ]
@@ -119,7 +116,7 @@ def check
119116 long_desc <<-LONG
120117 Generates a shell script to check the Heroku config against the local Envfile.
121118
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.).
123120
124121 LONG
125122 option :dest , banner : "where to put the script" , desc : "Default: bin/<app>-env-check or bin/heroku-env-check"
0 commit comments