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

Function parse_gemspec

src/pipeline/pass_pkgmap.c:637–662  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

635
636/* Ruby: *.gemspec — spec.name = '...' */
637static void parse_gemspec(const char *source, int source_len, const char *rel_path,
638 cbm_pkg_entries_t *entries) {
639 const char *end = source + source_len;
640 /* Try spec.name, s.name, gem.name patterns */
641 static const char *patterns[] = {".name", NULL};
642 for (int i = 0; patterns[i]; i++) {
643 const char *p = source;
644 while (p < end) {
645 const char *found = strstr(p, patterns[i]);
646 if (!found || found >= end) {
647 break;
648 }
649 char *name = extract_quoted(found + strlen(patterns[i]), end);
650 if (name) {
651 char *dir = path_dirname(rel_path);
652 char entry[PKGMAP_PATH_BUF];
653 snprintf(entry, sizeof(entry), "%s%slib/%s", dir[0] ? dir : "", dir[0] ? "/" : "",
654 name);
655 pkg_entries_push(entries, name, strdup(entry));
656 free(dir);
657 return;
658 }
659 p = found + SKIP_ONE;
660 }
661 }
662}
663
664/* ── Public: manifest detection + parsing ──────────────────────── */
665

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