Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails: Gemspec is not valid. Please fix this gemspec

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?

like image 649
Bishma Stornelli Avatar asked Oct 24 '12 16:10

Bishma Stornelli


3 Answers

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
like image 80
mguymon Avatar answered Nov 07 '22 07:11

mguymon


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"
like image 5
kia nasirzadeh Avatar answered Nov 07 '22 06:11

kia nasirzadeh


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

like image 1
Van_Paitin Avatar answered Nov 07 '22 06:11

Van_Paitin