I'm trying to build a custom gem I wrote called client_package
but it is failing.
My directory structure looks like this:
client_package Gemfile Gemfile.lock client_package.gemspec Rakefile Readme.md .gitignore .git ...git files... lib client_package.rb client_package version.rb api.rb ...more...
And my client_package.gemspec
looks like this:
# encoding: UTF-8 require File.expand_path('../lib/client_package/version', __FILE__) Gem::Specification.new do |s| s.name = 'client_package' s.version = ClientPackage::VERSION s.platform = Gem::Platform::RUBY s.files = `git ls-files`.split('\n') s.executables = `git ls-files -- bin/*`.split('\n').map{ |f| File.basename(f) } s.require_paths = ['lib'] # also have s.authors, s.email, s.homepage, s.summary, s.description s.add_dependency 'httparty' s.add_dependency 'json' end
And all my files are committed and the git state is clean.
From within the top client_package
directory, I run gem build client_package.gemspec
and get this error:
ERROR: While executing gem ... (Gem::InvalidSpecificationException) [".gitignore Gemfile Rakefile Readme.md client_package.gemspec lib/client_package.rb lib/client_package/api.rb lib/client_package/version.rb lib/client_package/...more... "] are not files
This is puzzling to me, because those certainly seem to be files to me. Anyway, I figured there is some path problem if it's not seeing these files, and just doing some trial and error I discovered that if I go up a directory (one above the top-level client_package
) and then run gem build client_package/client_package.gemspec
it does appear to work at first, creating the file client_package-1.0.0.gem
. But something is still wrong. If I then install that gem with gem install client_package-1.0.0.gem
that also appears to work. But then this:
require 'rubygems' require 'client_package'
Returns LoadError: no such file to load -- client_package
.
I feel like I must be missing something small but important. Any ideas?
Excuses for resurrecting this old thread, but I found another cause: if you did not check in git, some old (deleted files) might interfere: on disk they do not exist, but git ls-files migh report them as being included in the gem.
Check in the files and this exact error is over.
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