我无法在ruby中安装此捆绑包

3pvhb19x  于 12个月前  发布在  Ruby
关注(0)|答案(2)|浏览(131)

我在尝试在ruby中安装bundle时遇到问题。我尝试在创建Gemfile后更新它
我使用了这个命令:
bundle gem GEM_NAME

emna@tarek-Vostro-3902:~/Gemfile$ ls -l
total 32
drwxrwxr-x 2 emna emna 4096 Dec 28 13:11 bin
-rw-rw-r-- 1 emna emna 3238 Dec 28 13:11 CODE_OF_CONDUCT.md
-rw-rw-r-- 1 emna emna   92 Dec 28 13:11 Gemfile
-rw-rw-r-- 1 emna emna 1428 Dec 28 13:11 Gemfile.gemspec
drwxrwxr-x 3 emna emna 4096 Dec 28 13:11 lib
-rw-rw-r-- 1 emna emna  117 Dec 28 13:11 Rakefile
-rw-rw-r-- 1 emna emna 1400 Dec 28 13:11 README.md
drwxrwxr-x 2 emna emna 4096 Dec 28 13:11 spec
emna@tarek-Vostro-3902:~/Gemfile$ bundle update
The gemspec at /home/emna/Gemfile/Gemfile.gemspec is not valid. Please fix this gemspec.
The validation error was '"FIXME" or "TODO" is not an author'
emna@tarek-Vostro-3902:~/Gemfile$ echo 'gem "rspec"' >> Gemfile
emna@tarek-Vostro-3902:~/Gemfile$ bundle install
You have one or more invalid gemspecs that need to be fixed.
The gemspec at /home/emna/Gemfile/Gemfile.gemspec is not valid. Please fix this gemspec.
The validation error was '"FIXME" or "TODO" is not an author'
emna@tarek-Vostro-3902:~/Gemfile$ bundle exec rspec
bundler: command not found: rspec
Install missing gem executables with `bundle install`
emna@tarek-Vostro-3902:~/Gemfile$ ls
bin  CODE_OF_CONDUCT.md  Gemfile  Gemfile.gemspec  lib  Rakefile  README.md  spec


这是同一个问题的更新,我添加了文件
Gemfile.gemspec

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

Gem::Specification.new do |spec|
  spec.name          = "Gemfile"
  spec.version       = Gemfile::VERSION
  spec.authors       = ["TODO: Write your name"]
  spec.email         = ["TODO: Write your email address"]

  spec.summary       = %q{TODO: Write a short summary, because Rubygems requires one.}
  spec.description   = %q{TODO: Write a longer description or delete this line.}
  spec.homepage      = "TODO: Put your gem's website or public repo URL here."

  # 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'] = "TODO: Set to 'http://mygemserver.com'"
  else
    raise "RubyGems 2.0 or newer is required to protect against " \
      "public gem pushes."
  end

  spec.files         = `git ls-files -z`.split("\x0").reject do |f|
    f.match(%r{^(test|spec|features)/})
  end
  spec.bindir        = "exe"
  spec.executables   = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
  spec.require_paths = ["lib"]

  spec.add_development_dependency "bundler", "~> 1.13"
  spec.add_development_dependency "rake", "~> 10.0"
  spec.add_development_dependency "rspec", "~> 3.0"
end
~                                                                                                                                                                                 
~
kxe2p93d

kxe2p93d1#

您应该根据错误消息中的建议修改bundle gem ...为您生成的模板:

The validation error was '"FIXME" or "TODO" is not an author'

也就是说,使用您选择的编辑器打开Gemfile.gemspec并修复包含FIXME和/或TODO内容的行。
另外,在ruby world中,我们倾向于用所有的字母来命名gem(而你的gem是用大写的G来命名的)。

qmb5sa22

qmb5sa222#

我创建了一个新的项目,使用:

bundle gem project

在运行bundle add后,它抛出了上面的错误,所以我不得不删除project.gemspec文件中包含这个词的所有行

TODO:

举例来说:

spec.summary = "TODO: Write a short summary, because RubyGems requires one."

成为

spec.summary = "a short summary"

对所有包含TODO的行执行相同的操作

相关问题