"Support Files" in Rubygems

M

Manuel Holtgrewe

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

Thanks in advance,

Manuel Holtgrewe
 
A

Austin Ziegler

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

Thanks in advance,

Yes. See PDF::Writer and various others for how to do this.

RubyGems doesn't really care what you include; it just wants you to
enumerate it.

-austin
 
J

Jeremy Hinegardner

--WhfpMioaduB5tiZL
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

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 (e-mail address removed)


--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--
 
E

Eric Hodel

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.

You can also add a task :debug_gem (from hoe) which can help debug
issues.

Or you could just use Hoe and let somebody else (me) take care of
these things.
 
J

Jeremy Hinegardner

Or you could just use Hoe and let somebody else (me) take care of
these things.

Yup, that would work too, hoe makes the common stuff pretty easy, and
your publication to rubyforge and announcements and such.

-jeremy
 
M

Manuel Holtgrewe

Hi

Thank you all for your kind suggestions - they all solve my problem =)

I will certainly have a look at Hoe since it seems to be what I am
trying to duplicate (although I could not find much documentation on
it on the net).

Kind Regards,

Manuel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,792
Messages
2,569,639
Members
45,351
Latest member
RoxiePulli

Latest Threads

Top