What are the best methods for updating the gemspec file list?

Regarding the file list for gemspecs.

I noticed that the jeweler updates this list manually using the list of files in the project. eg

Gem::Specification.new do |s| # stuff s.files = [ "lib/somegem.rb", "README.md" ] # ... more stuff end 

Is there any evidence that using git ls-files or Dir.glob('**/*') to dynamically create a list of files for gemspec causes performance problems when using gems inside projects (especially rails projects)? eg?

 Gem::Specification.new do |s| # stuff s.files = `git ls-files`.split("\n") # ... more stuff end 
+4
source share
1 answer

It is great for generating a list of files dynamically. In fact, Gemspec Specification docs show several ways to do this.

From the Rubygems docs:

 require 'rake' spec.files = FileList['lib .rb', 'bin/*', '[AZ]*', 'test/ *'].to_a # or without Rake... spec.files = Dir['lib/ *.rb'] + Dir['bin/*'] spec.files += Dir['[AZ]*'] + Dir['test/**/*'] spec.files.reject! { |fn| fn.include? "CVS" } 

I would stick with the above methods and not use git ls-files , because I did not assume that every system using a gem would have git on it.

+1
source

All Articles