2016-12-28 60 views
-4

嘗試在Ruby中安裝軟件包時遇到問題。我嘗試創建的Gemfile我無法在ruby中安裝該軟件包

我已經使用這個命令後更新:

束寶石GEM_NAME

[email protected]:~/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 
[email protected]:~/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' 
[email protected]:~/Gemfile$ echo 'gem "rspec"' >> Gemfile 
[email protected]:~/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' 
[email protected]:~/Gemfile$ bundle exec rspec 
bundler: command not found: rspec 
Install missing gem executables with `bundle install` 
[email protected]:~/Gemfile$ ls 
bin CODE_OF_CONDUCT.md Gemfile Gemfile.gemspec lib Rakefile README.md spec 

enter image description here 這是同一個問題的最新情況,我加入文件

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 
~                                             
~ 
+3

你有沒有...... *讀*錯誤? – Biffen

+0

是的,但我是紅寶石初學者,我不知道如何處理這些文件!所以我要求 – Emna

回答

1

你應該bundle gem ...根據錯誤信息的建議你已經有了修改爲您生成模板:

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

這就是說,開放Gemfile.gemspec與您所選擇的編輯和修復內容爲FIXME和/或TODO的行。

此外,在紅寶石的世界,我們往往名全小寫寶石(而你的命名與資本G。)

+0

這是新的錯誤:您有一個或多個無效的gemspecs需要修復。 /home/emna/Gemfile/Gemfile.gemspec上的gemspec無效。請修復這個gemspec。 驗證錯誤是'「把寶石的網站或公共回購網址放在這裏。」是不是一個URI' – Emna

+1

什麼期望我做,除**重複錯誤消息** ?!請**輸入一個有效的URI代替「將您的寶石網站或公共回購網址放在這裏」。string **,或者只是註釋掉這一行。 – mudasobwa