Jekyll theme gem is empty

Update, found the approximate cause of the issue. Still unclear to me of exactly what the underlying issues is though. See reply

I’m trying to create a gem theme and the gem that is created is always empty. My minimal test case is the following commands:

> jekyll new-theme jekyll-theme-test
> cd jekyll-theme-test
> gem build jekyll-theme-test.gemspec
> gem unpack jekyll-theme-test-0.1.0.gem

I have also modified the gemspec (added summary and summary and homepage so that it builds successfully. All commands complete with no warnings or errors. The unpacked folder is empty. As is the install directory if I install the gem

If I try to use the theme, jekyll build/serve complains about missing layouts (which makes sense as there’s no files!)

What additional steps should I be taking to produce a theme gem and is there any way to see errors for the above commands?

Thanks

OK, dug a bit further and it’s the default spec.files that is causing issues. (also there was a warning in the build output about no files specified, which I should have spotted sooner)

the default
spec.files = git ls-files -z.split(“\x0”).select { |f| f.match(%r!^(assets|_data|_layouts|_includes|_sass|LICENSE|README|_config.yml)!i) }

Am I right in thinking this is only going to work if I’m actually working in a valid git branch (which I’m not)?

I’m not sure if this helps, but i had an issue with theme not found. I had to choose remote theme so it would fetch it on github actions.