I'm trying to build my engine using gem build myengine
but I keep getting the following error:
ERROR: While executing gem ... (Gem::Package::TooLongFileName)
Gem::Package::TooLongFileName
I wouldn't expect myengine
not to be too long of a name. Any idea what might be going on here?
I solved this issue by finding the exact file that was causing the issue - it was a migration file with a long name.
For those who are interested, the error is thrown from the split_name
method of TarWriter
class of the rubygems
source code. This error will bet thrown if:
I hope this helps. I've attached the source code for the split_name
method below for review.
def split_name(name) # :nodoc:
raise Gem::Package::TooLongFileName if name.size > 256
if name.size <= 100 then
prefix = ""
else
parts = name.split(/\//)
newname = parts.pop
nxt = ""
loop do
nxt = parts.pop
break if newname.size + 1 + nxt.size > 100
newname = nxt + "/" + newname
end
prefix = (parts + [nxt]).join "/"
name = newname
if name.size > 100 or prefix.size > 155 then
raise Gem::Package::TooLongFileName
end
end
return name, prefix
end
I solved this Problem by updateing rubygems to 1.8.25 (gem update --system)
-edit-
check your project.gemspec file: comment out
s.files = ... or s.test_files = ...
if there is any file in your project with a name too long
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With