Problem with rubygems and rake creating a new gem

Hæ,
I've updated rubygems to the last version since it was necessary for
another library and now I cannot create the gem file for my framework.

What I have is a rakefile.rb:
require 'rubygems'
Gem::manage_gems

require 'rake/gempackagetask'

spec = Gem::Specification.new do |s|
    s.platform = Gem::Platform::RUBY
    s.name = "BxWW"
    s.version = "1.3.0"
    s.author = "Mario Ruiz"
    s.email = "mario@mario.com"
    s.summary = "blabla blabla"
    s.files = FileList['src/**/*'].to_a
    s.require_path = "."
    s.has_rdoc = true
end

Rake::GemPackageTask.new(spec) do |pkg|
    pkg.need_tar = true
end

task :default => "build/#{spec.name}-#{spec.version}.gem" do
    puts "generated latest version"
end

And then I run in command line: rake gem

It was working for me before but now this error is displayed: rake
aborted! undefined method 'manage_gems' for Gem::Module.
I was taking a look at google and I found out Gem::manage_gems is
unsupported now and should be changed for require 'rubygems/builder' but
then the error is: rake aborted! undefined method 'empty?' for
nil:NilClass

Any idea???

Thanks in advance. :slight_smile:

···

--
Posted via http://www.ruby-forum.com/.

I've updated rubygems to the last version since it was necessary for
another library and now I cannot create the gem file for my framework.

RubyGems 1.3.2 removed Gem::manage_gems:

http://rubyforge.org/forum/forum.php?forum_id=3166

It had been deprecated and was giving warnings for some time now.

Also, you should use Gem::PackageTask instead of Rake's GemPackage task.

What I have is a rakefile.rb:
[...]

I've fixed it for you:

require 'rubygems'
require 'rubygems/packagetask'

spec = Gem::Specification.new do |s|
    s.name = "BxWW"
    s.version = "1.3.0"
    s.author = "Mario Ruiz"
    s.email = "mario@mario.com"
    s.summary = "blabla blabla"
    s.description = "FIX"
    s.homepage = "FIX"
    s.files = FileList['src/**/*'].to_a
    s.require_path = "."
end

Gem::PackageTask.new(spec) do |pkg|
    pkg.need_tar = true
end

task :default => "build/#{spec.name}-#{spec.version}.gem" do
    puts "generated latest version"
end

···

On Apr 24, 2009, at 06:33, Mario Ruiz wrote:

I've fixed it moar:

require 'rubygems'
require 'hoe'
require './lib/BxWW.rb'

Hoe.new('BxWW', BxWW::VERSION) do |bxww|
   bxww.developer('Mario Ruiz', 'mario@mario.com')
end

···

On Apr 24, 2009, at 11:55 , Eric Hodel wrote:

I've fixed it for you:

require 'rubygems'
require 'rubygems/packagetask'

spec = Gem::Specification.new do |s|
  s.name = "BxWW"
  s.version = "1.3.0"
  s.author = "Mario Ruiz"
  s.email = "mario@mario.com"
  s.summary = "blabla blabla"
  s.description = "FIX"
  s.homepage = "FIX"
  s.files = FileList['src/**/*'].to_a
  s.require_path = "."
end

Gem::PackageTask.new(spec) do |pkg|
  pkg.need_tar = true
end

task :default => "build/#{spec.name}-#{spec.version}.gem" do
  puts "generated latest version"
end

Thanks Eric,

When I try your code...
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`gem_original_require': no such file to load -- rubygems/packagetask
(LoadError)
  from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`require'
  from rakefile.rb:2

Eric Hodel wrote:

···

On Apr 24, 2009, at 06:33, Mario Ruiz wrote:

I've updated rubygems to the last version since it was necessary for

--
Posted via http://www.ruby-forum.com/\.

Sorry Ryan I don't understand what your are proposing, I don't have a
BxWW.rb file

Ryan Davis wrote:

···

On Apr 24, 2009, at 11:55 , Eric Hodel wrote:

  s.summary = "blabla blabla"
task :default => "build/#{spec.name}-#{spec.version}.gem" do

--
Posted via http://www.ruby-forum.com/\.

Ok it works if I require 'rubygems/package_task'

Thanks.

Mario Ruiz wrote:

···

Thanks Eric,

When I try your code...
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`gem_original_require': no such file to load -- rubygems/packagetask
(LoadError)
  from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`require'
  from rakefile.rb:2

Eric Hodel wrote:

On Apr 24, 2009, at 06:33, Mario Ruiz wrote:

I've updated rubygems to the last version since it was necessary for

--
Posted via http://www.ruby-forum.com/\.

Luckily, that is just a string and easy for you to fix.

I also fixed your email so that full context was available again and provided instructions for further mailing list correspondence:

···

On Apr 27, 2009, at 02:49 , Mario Ruiz wrote:

Sorry Ryan I don't understand what your are proposing, I don't have a
BxWW.rb file

require 'rubygems'
require 'hoe'
require './lib/BxWW.rb'

Hoe.new('BxWW', BxWW::VERSION) do |bxww|
bxww.developer('Mario Ruiz', 'mario@mario.com')
end

--
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?