docs: def _generate_metadata(path, cookbook_path, name):
      """Checks whether metadata.rb has changed and regenerate metadata.json"""
      global knife_installed
      if not knife_installed:
          return
      metadata_path_rb = os.path.join(path, 'metadata.rb')
      metadata_path_json = os.path.join(path, 'metadata.json')
      if (os.path.exists(metadata_path_rb) and
              (not os.path.exists(metadata_path_json) or
               os.stat(metadata_path_rb).st_mtime >
               os.stat(metadata_path_json).st_mtime)):
          error_msg = "Warning: metadata.json for {0}".format(name)
          error_msg += " in {0} is older that metadata.rb".format(cookbook_path)
          error_msg += ", cookbook attributes could be out of date\n\n"
          try:
              proc = subprocess.Popen(
                  ['knife', 'cookbook', 'metadata', '-o', cookbook_path, name],
                  stdout=subprocess.PIPE, stderr=subprocess.PIPE)
              resp, error = proc.communicate()
              if ('ERROR:' in resp or 'FATAL:' in resp
                      or 'Generating metadata for' not in resp):
                  if("No user specified, pass via -u or specifiy 'node_name'"
                          in error):
                      error_msg += "You need to have an up-to-date (>=0.10.x)"
                      error_msg += " version of knife installed locally in order"
                      error_msg += " to generate metadata.json.\nError "
                  else:
                      error_msg += "Unkown error "
                  error_msg += "while executing knife to generate "
                  error_msg += "metadata.json for {0}".format(path)
                  print(error_msg)
                  print resp
              if env.loglevel == 'debug':
                  print "\n".join(resp.split("\n")[:2])
          except OSError:
              knife_installed = False
              error_msg += "If you locally install Chef's knife tool, LittleChef"
              error_msg += " will regenerate metadata.json files automatically\n"
              print(error_msg)
          else:
              print("Generated metadata.json for {0}\n".format(path))