Sha256: 2b91a9ee9b419a27813c01cd4f356cb4f58f5ad7d135e125c1c3c070ec4f430e
Contents?: true
Size: 1.45 KB
Versions: 2
Compression:
Stored size: 1.45 KB
Contents
module Hanzo class Config < Base def compare Hanzo.title "Fetching environment variables" fetch_variables Hanzo.title "Comparing environment variables" compare_variables end protected def initialize_variables @type = extract_argument(1) end def initialize_cli initialize_help and return if @type != "compare" compare end def initialize_help @options.banner = <<-BANNER.unindent Usage: hanzo config TYPE Available install type: compare - Compare the environment variables set across the remotes BANNER end private def fetch_variables @variables = Hanzo::Installers::Remotes.environments.keys.inject({}) do |memo, env| # Fetch the variables over at Heroku config = Hanzo.run("heroku config -r #{env}", true).split("\n") # Reject the first line (Heroku header) config = config.reject { |line| line =~ /^=/ } # Only keep the variable name, not their value config = config.map { |line| line.gsub(/^([^:]+):.*$/, '\1') } memo.merge env => config end end def compare_variables all_variables = @variables.values.flatten.uniq @variables.each_pair do |env, variables| missing_variables = all_variables - variables Hanzo.print "Missing variables in #{env}", :yellow Hanzo.print missing_variables.map { |v| "- #{v}" } end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
hanzo-0.4.2 | lib/hanzo/modules/config.rb |
hanzo-0.4.1 | lib/hanzo/modules/config.rb |