class InfraCommand

def process_target(targets, cfg_synth)

process stage for target
def process_target(targets, cfg_synth)
  namespaces    = cfg_synth[:namespace].keys.map(&:to_sym)
  environments  = []
  namespaces.each do |ns_name|
    environments.concat(cfg_synth[:namespace][ns_name].keys.map(&:to_sym))
  end
  case targets.length.to_i
    # only provided namespace
  when 1
    nil
    # only provided namespace.site
  when 2
    nil
    # only provided namespace.site.project
  when 3
    announce_preflight_info(targets, cfg_synth)
    environments.each do |e_name|
      projects = cfg_synth[:namespace][targets[0]][e_name][:projects]
      projects.each do |project|
        announce_project(project)
        synth = TerraformSynthesizer.new
        case project[:src][:type].to_sym
        when :local
          system %(mkdir -p #{CACHE_DIR}) unless Dir.exist?(CACHE_DIR)
          PROJECT_SRC_DIRS.each do |src_dir|
            next unless File.exist?(File.join(
                                      project[:src][:location].to_s,
                                      %(src),
                                      src_dir.to_s
                                    ))
            synth_files = Dir.glob("#{File.join(
              project[:src][:location].to_s,
              %(src),
              src_dir.to_s
            )}/**/*.rb")
            synth_files.each do |synth_file|
              synth.synthesize(File.read(synth_file))
            end
          end
          Say.terminal JSON.pretty_generate(synth.synthesis)
          project_cache_dir = File.join(CACHE_DIR, project[:name].to_s)
          system %(mkdir -p #{project_cache_dir}) unless Dir.exist?(project_cache_dir)
          File.write(File.join(project_cache_dir, ARTIFACT_FILE), synth.synthesis.to_json)
          system %(cd #{project_cache_dir} && terraform init)
          system %(cd #{project_cache_dir} && terraform plan)
        when :git
          nil
        end
      end
    end
    # fetch project data
    # projet_data = cfg_synth[:namespace][targets[0]]
  end
end