Created
September 28, 2015 12:46
-
-
Save satour/1e0cd0578a49ed199c50 to your computer and use it in GitHub Desktop.
heroku-connect-config json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#argv[0]: path to json file. argv[1]:app_name, argv[2]:organization_id | |
require "json" | |
def check_args | |
unless ARGV[0] && ARGV[1] && ARGV[2] | |
puts "ARGV[0]: path to json file. ARGV[1]:app_name, ARGV[2]:organization_id" | |
return | |
end | |
create_file | |
end | |
def create_file | |
str = "" | |
file1 = File.open(ARGV[0], "r").each { |line| str << line } | |
hash = JSON.parse(str).to_hash | |
hash["connection"]["app_name"] = ARGV[1] | |
hash["connection"]["organization_id"] = ARGV[2] | |
file2 = File.open("config.json", "w") << hash.to_json | |
file1.close | |
file2.close | |
puts "file created." | |
end | |
check_args |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment