16

When I install a gem from github it gives me the error:

number_internationalizer at /usr/local/rvm/gems/ruby-1.9.3-p194@number_internationalizer/bundler/gems/number_internationalizer-c0d642b04e87 did not have a valid gemspec.
This prevents bundler from installing bins or native extensions, but that may not affect its functionality.
The validation message from Rubygems was:
  "FIXME" or "TODO" is not a description

The gemspec is:

# -*- encoding: utf-8 -*-
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'number_internationalizer/version'

Gem::Specification.new do |gem|
  gem.name          = "number_internationalizer"
  gem.version       = NumberInternationalizer::VERSION
  gem.authors       = ["Myself"]
  gem.email         = ["[email protected]"]
  gem.description   = %q{Internationalize numbers adding normalization, validation and modifying the number field to restor the value to its original if validation fails}
  gem.summary       = gem.description
  gem.homepage      = ""

  gem.files         = `git ls-files`.split($/)
  gem.executables   = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
  gem.test_files    = gem.files.grep(%r{^(test|spec|features)/})
  gem.require_paths = ["lib"]
end

How can I fix that error?

1
  • 1
    How did you solve this problem ? i'm having such a similar one !
    – Emna Ayadi
    Dec 28, 2016 at 12:16

4 Answers 4

6

The error seems out of sync with the gemspec you show, the error indicates the gem.descripton is invalid. According to the error, you are using the Gem from git, which has a commit fixing the invalid gem.description.

Have Bundler update to the latest number_internationalizer commit:

bundle update
2
  • I did that and now I get Could not find i18n-0.6.1 in any of the sources when trying to run rails s. I run bundle show i18n and the answer is /usr/local/rvm/gems/ruby-1.9.3-p194@number_internationalizer/gems/i18n-0.6.1. I'm not sure why that @number_internationalizer is appearing. Oct 24, 2012 at 17:18
  • 2
    I found the solution to the new error. I had used rvm gemset use number_internationalizer before. I had to reset rvm. Oct 24, 2012 at 17:34
5

this answer is not for all situations but if you have sth like this in you blob.gemspec file:

  spec.summary       = "TODO: Write a short summary, because Rubygems requires one."
  spec.homepage      = "TODO: Put your gem's website or public repo URL here."

you should remove "TODO" word from it and also provide a valid HTTP URI for spec.homepage, you can just replace it like this:

  spec.summary       = "Write a short summary, because Rubygems requires one."
  spec.homepage      = "http://website.com"
1

I strongly feel there is a check for TODO or FIXME while the interpreter is parsing your gemspec. This check has been programmed to throw an error if it sees any one of these two words. I had this same issue and I resolved it by removing any reference to TODO in my gemspec. I put a valid uri in the homepage session and everything started working fine again

1
  • changed TODO with FART and bundle install was succesfull
    – Salomanuel
    Nov 30, 2017 at 14:24
0

Just to add to Ashkan Nasirzadeh's answer.

I had a similar when working with Rails Engines in a Rails 6.0.2.2 Application.

The trick is to:

  1. Remove every occurrence of TODO in the your_engine.gemspec file.
  2. Add a website of your choice in double-quotes to the spec.homepage.
  3. Ensure that you maintain the double quotes around the values where you removed every occurrence of TODO to avoid the undefined method of for main:Object error.

Below is a sample your_engine.gemspec file that has been properly modified.

$:.push File.expand_path("lib", __dir__)

# Maintain your gem's version:
require "app_component/version"

# Describe your gem and declare its dependencies:
Gem::Specification.new do |spec|
  spec.name        = "app_component"
  spec.version     = AppComponent::VERSION
  spec.authors     = ["Promise Preston"]
  spec.email       = ["[email protected]"]
  spec.homepage    = "http://website.com"
  spec.summary     = "Summary of AppComponent"
  spec.description = "Description of AppComponent"
  spec.license     = "MIT"

  # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
  # to allow pushing to a single host or delete this section to allow pushing to any host.
  if spec.respond_to?(:metadata)
    spec.metadata["allowed_push_host"] = "Set to 'http://mygemserver.com'"
  else
    raise "RubyGems 2.0 or newer is required to protect against " \
      "public gem pushes."
  end

  spec.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.md"]

  spec.add_dependency "rails", "~> 6.0.2", ">= 6.0.2.2"

  spec.add_development_dependency "sqlite3"
end

That's all.

I hope this helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.