cocoapods-metadata-service icon indicating copy to clipboard operation
cocoapods-metadata-service copied to clipboard

Handle getting README/CHANGELOG from source :http with zip

Open orta opened this issue 6 years ago • 3 comments

I have some example code that I've been playing with:

import * as request from "request"
import * as unzipper from "unzipper"
import { CentralDirectory } from "unzipper"

interface ZipMD {
  readme?: string
  changelog?: string
}

// export const getREADMEAndCHANGELOGFromZipAtURL = async (url: string): Promise<ZipMD> => {
//   const zip: CentralDirectory = (await unzipper.Open.url(request as any, url)) as any
//   console.log("OK")
//   console.log(zip)
//   if (!zip) {
//     return {}
//   }

//   const zipMD: ZipMD = {}

//   const readme = zip.files.find(file => file.path === "README.md")
//   if (readme) {
//     const readmeBuffer = await readme.buffer
//     zipMD.readme = readmeBuffer.toString()
//   }
//   debugger
//   return zipMD
// }

// unzipper.Open.url(request,'http://www2.census.gov/geo/tiger/TIGER2015/ZCTA5/tl_2015_us_zcta510.zip')
//   .then(function(d) {
//     var file = d.files.filter(function(d) {
//       return d.path === 'tl_2015_us_zcta510.shp.iso.xml';
//     })[0];
//     return file.buffer();
//   })
//   .then(function(d) {
//     console.log(d.toString());
//   });
// debugger
// ;(unzipper.Open.url(request as any, "https://github.com/kevva/decompress/archive/master.zip") as any)
//   .then((d: any) => {
//     debugger
//     console.log("OK")
//     const readme = d.files.find((file: any) => file.path === "README.md")
//     return readme.buffer()
//   })
//   .then((d: Buffer) => {
//     console.log(d.toString())
//   })
//   .error((e: any) => console.error(e))

// getREADMEAndCHANGELOGFromZipAtURL("https://github.com/kevva/decompress/archive/master.zip")

orta avatar Mar 16 '18 20:03 orta

Hi @orta , I have a suggestion how to deal with not open source pods in another way?

Maybe new property can be inroduced to Podspec like spec.readme = 'http://***.com'. I think it can be good workaround for frameworks, what do you think?

Best regards Alex.

Parabak avatar May 25 '18 10:05 Parabak

Hey @orta, is anyone working on this?? I think rolling this out has broken README parsing for all pods using http sources. We need to either get this done ASAP or roll back to whatever was doing the parsing before.

kylerjensen avatar Jun 05 '18 00:06 kylerjensen

Afraid that’s not an option as cocoadocs was deprecated over a year ago, you’re welcome to take a look, otherwise I’ll get round to it when I can

orta avatar Jun 05 '18 01:06 orta