Forum: Ruby problem with rubygems and rake creating a new gem

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
97334b75c93574ed3e514f33849f0953?d=identicon&s=25 Mario Ruiz (tcblues)
on 2009-04-24 15:33
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. :)
58479f76374a3ba3c69b9804163f39f4?d=identicon&s=25 Eric Hodel (Guest)
on 2009-04-24 20:56
(Received via mailing list)
On Apr 24, 2009, at 06:33, Mario Ruiz wrote:
> 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
5a837592409354297424994e8d62f722?d=identicon&s=25 Ryan Davis (Guest)
on 2009-04-24 23:55
(Received via mailing list)
On Apr 24, 2009, at 11:55 , Eric Hodel wrote:

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

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
97334b75c93574ed3e514f33849f0953?d=identicon&s=25 Mario Ruiz (tcblues)
on 2009-04-27 11:48
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
97334b75c93574ed3e514f33849f0953?d=identicon&s=25 Mario Ruiz (tcblues)
on 2009-04-27 11:49
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
97334b75c93574ed3e514f33849f0953?d=identicon&s=25 Mario Ruiz (tcblues)
on 2009-04-27 12:31
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
5a837592409354297424994e8d62f722?d=identicon&s=25 Ryan Davis (Guest)
on 2009-04-27 19:42
(Received via mailing list)
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

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:

--
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?
This topic is locked and can not be replied to.