From: Jeremy Hinegardner Date: 2007-02-17T06:05:23+09:00 Subject: Re: "Support Files" in Rubygems --WhfpMioaduB5tiZL Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Sat, Feb 17, 2007 at 05:40:06AM +0900, Manuel Holtgrewe wrote: > Hi > > Is it possible to include files in rubygems that are neither .rb nor > documentation files? I would like to publish Mozilla's cacert.pem in > my gem but seemingly, rubygems does not include the pem file in the > build gem. > > You can find the Rakefile used to build the gem here: > > http://preview.tinyurl.com/yrce7b > Feel free to take a look at the Rakefile for keybox, I have a 'data' directory that gets included. FileList is your friend. Here's a patch to google4r HEAD that I think does what you want. You'll probably want to take advantage of spec.rdoc_options to make sure that when the rdoc is generated from the gem that your 'README' is the main document. Something like : spec.rdoc_options = ["--line-numbers", "--inline-source", "--main","README"] You can also add a task :debug_gem (from hoe) which can help debug issues. task :debug_gem do puts spec.to_ruby end enjoy, -jeremy -- ======================================================================== Jeremy Hinegardner jeremy@hinegardner.org --WhfpMioaduB5tiZL Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="google4r_file_list.patch" Index: Rakefile =================================================================== --- Rakefile (revision 2) +++ Rakefile (working copy) @@ -7,9 +7,15 @@ task :default => :test # +# File sets +# +RUBY_FILES = FileList['lib/**/*.rb', 'lib/**/vendor/**'] +RDOC_EXTRA = FileList['README','LICENSE'] +EXTRA_FILES = FileList['var/*.pem'] + +# # Documentation # - desc 'Generate documentation for the google4r library.' Rake::RDocTask.new(:doc) do |rdoc| rdoc.rdoc_dir = 'doc' @@ -17,10 +23,7 @@ rdoc.main = 'README' rdoc.options << '--line-numbers' << '--inline-source' #rdoc.template = "var/allison/allison.rb" - rdoc.rdoc_files.include('README') - rdoc.rdoc_files.include('LICENSE') - rdoc.rdoc_files.include('lib/**/*.rb') - rdoc.rdoc_files.exclude('lib/**/vendor/**') + rdoc.rdoc_files = RUBY_FILES + RDOC_EXTRA end # @@ -78,10 +81,11 @@ spec.version = version spec.author = "Manuel Holtgrewe" - spec.test_files = Dir.glob('test/**/*_test.rb') - spec.files << 'README' << 'LICENSE' << 'var/cacert.pem' - spec.files += Dir.glob('lib/**/*.rb') - spec.files.reject! { |str| str ~= /^\./ } + spec.test_files = FileList['test/**/*_test.rb'] + spec.files = RUBY_FILES + EXTRA_FILES + spec.extra_rdoc_files = RDOC_EXTRA + spec.files.reject! { |str| str =~ /^\./ } + spec.require_path = 'lib' spec.required_ruby_version = '>= 1.8.4' spec.autorequire = '' @@ -93,4 +97,4 @@ Rake::GemPackageTask.new(spec) do |pkg| pkg.need_zip = true pkg.need_tar = true -end \ No newline at end of file +end --WhfpMioaduB5tiZL--