Ruby: *.gemspec — spec.name = '...' */
| 635 | |
| 636 | /* Ruby: *.gemspec — spec.name = '...' */ |
| 637 | static 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 |
no test coverage detected