【问题标题】:gemspec error on creating new rails engine在创建新的 Rails 引擎时出现 gemspec 错误
【发布时间】:2016-10-21 02:45:15
【问题描述】:

我正在尝试使用以下链接创建 Rails 引擎: http://guides.rubyonrails.org/engines.html

我收到以下错误

您有一个或多个无效的 gemspecs 需要修复。 /home/shariq/Documents/plugin/blorgh/blorgh.gemspec 中的 gemspec 无效。请修复此 gemspec。

验证错误为'"FIXME" or "TODO" is not a description'

我已经尝试过捆绑更新和捆绑安装

这是我的全部工作

日志
shariq@SDEV-MACHINE:~/Documents/plugin$ ruby -v
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux]
shariq@SDEV-MACHINE:~/Documents/plugin$ rails -v
Rails 5.0.0.1
shariq@SDEV-MACHINE:~/Documents/plugin$ mysql --version
mysql  Ver 14.14 Distrib 5.7.15, for Linux (x86_64) using  EditLine wrapper
shariq@SDEV-MACHINE:~/Documents/plugin$ rails plugin new blorgh --mountable -d mysql
      create  
      create  README.md
      create  Rakefile
      create  blorgh.gemspec
      create  MIT-LICENSE
      create  .gitignore
      create  Gemfile
      create  app
      create  app/controllers/blorgh/application_controller.rb
      create  app/helpers/blorgh/application_helper.rb
      create  app/jobs/blorgh/application_job.rb
      create  app/mailers/blorgh/application_mailer.rb
      create  app/models/blorgh/application_record.rb
      create  app/views/layouts/blorgh/application.html.erb
      create  app/assets/images/blorgh
      create  app/assets/images/blorgh/.keep
      create  config/routes.rb
      create  lib/blorgh.rb
      create  lib/tasks/blorgh_tasks.rake
      create  lib/blorgh/version.rb
      create  lib/blorgh/engine.rb
      create  app/assets/config/blorgh_manifest.js
      create  app/assets/stylesheets/blorgh/application.css
      create  app/assets/javascripts/blorgh/application.js
      create  bin/rails
      create  test/test_helper.rb
      create  test/blorgh_test.rb
      append  Rakefile
      create  test/integration/navigation_test.rb
  vendor_app  test/dummy
         run  bundle install
You have one or more invalid gemspecs that need to be fixed.
The gemspec at /home/shariq/Documents/plugin/blorgh/blorgh.gemspec is not valid. Please fix this gemspec.
The validation error was '"FIXME" or "TODO" is not a description'
shariq@SDEV-MACHINE:~/Documents/plugin$ 

这里是 gemspec 文件:

##### log #######
$:.push File.expand_path("../lib", __FILE__)


require "blorgh/version"

Gem::Specification.new do |s|
  s.name        = "blorgh"
  s.version     = Blorgh::VERSION
  s.authors     = ["Shariq"]
  s.email       = ["gr8shariq@live.com"]
  s.homepage    = "TODO"
  s.summary     = "TODO: Summary of Blorgh."
  s.description = "TODO: Description of Blorgh."
  s.license     = "MIT"

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

  s.add_dependency "rails", "~> 5.0.0", ">= 5.0.0.1"

end

【问题讨论】:

    标签: ruby-on-rails ruby-on-rails-plugins rails-engines


    【解决方案1】:

    错误是不言自明的。您必须将 gemspec 中的“TODO”字符串替换为一些“实际”描述。

    【讨论】:

    • 我的问题解决了,谢谢。但是在创建每个引擎时都需要修改?还是有办法解决?
    【解决方案2】:

    rails 存储库中有一个已关闭的问题#26474
    rails plugin new does not complete properly since bundler 1.12

    Ruby on Rails 团队成员 vipulnsward 说:

    我们现在不捆绑安装 - fbd1e98

    fbd1e98的提交信息解释:

    生成新插件时不要运行bundle install

    从 bundler 1.12.0 开始,gemspec 已经过验证,所以 bundle install 命令将在 gem 创建后立即失败,从而导致混淆 用户。此更改是对正确验证 gemspecs 的错误修复。

    添加选项-B 以跳过bundle install

    rails plugin new NAME -B
    

    如果您需要运行捆绑程序,可以从 .gemspec 文件中删除所有出现的 TODOFIXME,然后运行 ​​bundle install

    【讨论】:

      【解决方案3】:

      我今天遇到了这个问题。这就是我所做的(git diff)让我活下来。

      @@ -9,15 +9,15 @@ Gem::Specification.new do |spec|
         spec.version     = Blorgh::VERSION
         spec.authors     = ["Torvalds Du"]
         spec.email       = ["torvalds@ekohe.com"]
      -  spec.homepage    = "TODO"
      -  spec.summary     = "TODO: Summary of Blorgh."
      -  spec.description = "TODO: Description of Blorgh."
      +  spec.homepage    = ""
      +  spec.summary     = "Summary of Blorgh."
      +  spec.description = "Description of Blorgh."
         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"] = "TODO: Set to 'http://mygemserver.com'"
      +    spec.metadata["allowed_push_host"] = "http://mygemserver.com"
         else
           raise "RubyGems 2.0 or newer is required to protect against " \
             "public gem pushes."
      

      因此,您必须从gem_name.gemspec 中删除所有文本TODO

      祝你好运。

      【讨论】:

        猜你喜欢
        • 2015-09-04
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2019-06-28
        • 1970-01-01
        • 2019-12-29
        相关资源
        最近更新 更多