MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / parse_gemspec

Function parse_gemspec

src/pipeline/pass_pkgmap.c:655–680  ·  view source on GitHub ↗

Ruby: *.gemspec — spec.name = '...' */

Source from the content-addressed store, hash-verified

653
654/* Ruby: *.gemspec — spec.name = '...' */
655static void parse_gemspec(const char *source, int source_len, const char *rel_path,
656 cbm_pkg_entries_t *entries) {
657 const char *end = source + source_len;
658 /* Try spec.name, s.name, gem.name patterns */
659 static const char *patterns[] = {".name", NULL};
660 for (int i = 0; patterns[i]; i++) {
661 const char *p = source;
662 while (p < end) {
663 const char *found = strstr(p, patterns[i]);
664 if (!found || found >= end) {
665 break;
666 }
667 char *name = extract_quoted(found + strlen(patterns[i]), end);
668 if (name) {
669 char *dir = path_dirname(rel_path);
670 char entry[PKGMAP_PATH_BUF];
671 snprintf(entry, sizeof(entry), "%s%slib/%s", dir[0] ? dir : "", dir[0] ? "/" : "",
672 name);
673 pkg_entries_push(entries, name, strdup(entry));
674 free(dir);
675 return;
676 }
677 p = found + SKIP_ONE;
678 }
679 }
680}
681
682/* Swift: Package.swift — SwiftPM manifest.
683 *

Callers 1

cbm_pkgmap_try_parseFunction · 0.85

Calls 3

extract_quotedFunction · 0.85
path_dirnameFunction · 0.85
pkg_entries_pushFunction · 0.85

Tested by

no test coverage detected