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

Function parse_gemspec

src/pipeline/pass_pkgmap.c:641–666  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

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

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