Skip to content

Instantly share code, notes, and snippets.

@alvaromuir
Created February 9, 2014 18:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alvaromuir/8904144 to your computer and use it in GitHub Desktop.
Save alvaromuir/8904144 to your computer and use it in GitHub Desktop.
Thor file that copies and install keys form a .heroku_config file in rails app root
class Config < Thor
desc "heroku", "setup heroku from .heroku_config"
def heroku
puts "running Heroku config . . ."
config = ".heroku_config"
if File.exists?(config)
settings = File.open(config).read
settings.gsub!(/\r\n?/, "\n")
settings.each_line do |line|
if line.length > 2 && line.start_with?('#') == false
IO.popen("heroku config:set #{line.split("\n")[0]}") { |f| puts f.gets }
end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment