From: Keith Packard <keithp@keithp.com>
Date: Thu, 17 Jul 2025 17:52:48 +0200
Subject: Allow non-git directory for gemspec

Fall back to 'all files' when git is not available.

Signed-off-by: Keith Packard <keithp@keithp.com>
---
 rghost.gemspec | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/rghost.gemspec b/rghost.gemspec
index fff76bb..2762150 100644
--- a/rghost.gemspec
+++ b/rghost.gemspec
@@ -23,10 +23,15 @@ Gem::Specification.new do |s|
   s.required_ruby_version = ">= 2.7.0"
 
   # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
+  begin
+    files = (result = `git ls-files -z`.split ?\0).empty? ? Dir['**/*'] : result
+  rescue
+    files = Dir['**/*']
+  end
   s.files = Dir.chdir(__dir__) do
-    `git ls-files -z`.split("\x0").reject do |f|
+    files.reject do |f|
       (File.expand_path(f) == __FILE__) ||
-        f.start_with?(*%w[bin/ spec/ features/ .git .github Gemfile])
+        f.start_with?(*%w[bin/ spec/ features/ debian/ .git .git Gemfile])
     end
   end
   s.require_paths = ["lib"]
