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.
Mario R. (Guest)
on 2009-04-24 17: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 R."
    s.email     =   "removed_email_address@domain.invalid"
    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. :)
Eric H. (Guest)
on 2009-04-24 22:56
(Received via mailing list)
On Apr 24, 2009, at 06:33, Mario R. 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 R."
    s.email     =   "removed_email_address@domain.invalid"
    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
Ryan D. (Guest)
on 2009-04-25 01:55
(Received via mailing list)
On Apr 24, 2009, at 11:55 , Eric H. 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 R.', 'removed_email_address@domain.invalid')
end
Mario R. (Guest)
on 2009-04-27 13: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 H. wrote:
> On Apr 24, 2009, at 06:33, Mario R. wrote:
>> I've updated rubygems to the last version since it was necessary for
Mario R. (Guest)
on 2009-04-27 13:49
Sorry Ryan I don't understand what your are proposing, I don't have a
BxWW.rb file

Ryan D. wrote:
> On Apr 24, 2009, at 11:55 , Eric H. wrote:
>
>>   s.summary   =   "blabla blabla"
>> task :default => "build/#{spec.name}-#{spec.version}.gem" do
Mario R. (Guest)
on 2009-04-27 14:31
Ok it works if I require 'rubygems/package_task'

Thanks.

Mario R. 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 H. wrote:
>> On Apr 24, 2009, at 06:33, Mario R. wrote:
>>> I've updated rubygems to the last version since it was necessary for
Ryan D. (Guest)
on 2009-04-27 21:42
(Received via mailing list)
On Apr 27, 2009, at 02:49 , Mario R. 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 R.', 'removed_email_address@domain.invalid')
> 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.