Gemspec失败

5
我正在为我的毕业设计开发一个GEM,但是Travis CI构建一直失败。
这是我在Travis上的链接:https://travis-ci.org/ricardobond/perpetuus/builds/8709218 构建错误信息如下:
$ bundle exec rake
rake aborted!
Don't know how to build task 'default'
/home/travis/.rvm/gems/ruby-1.9.3-p448/bin/ruby_noexec_wrapper:14:in `eval'
/home/travis/.rvm/gems/ruby-1.9.3-p448/bin/ruby_noexec_wrapper:14:in `<main>'
(See full trace by running task with --trace)
The command "bundle exec rake" exited with 1.
Done. Your build exited with 1.

以下是我的perpetuus.gemspec文件。
# coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'perpetuus/version'

Gem::Specification.new do |spec|
  spec.name          = "perpetuus"
  spec.version       = Perpetuus::VERSION
  spec.authors       = ["Ricardo Caldeira"]
  spec.email         = ["ricardo.nezz@gmail.com"]
  spec.description   = %q{A continuous deploy GEM}
  spec.summary       = %q{Built on top of Ruby on Rails}
  spec.homepage      = ""
  spec.license       = "MIT"

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

  spec.add_development_dependency "bundler", "~> 1.3"
  spec.add_development_dependency "rake"
end

这是我的Gemfile:

source 'https://rubygems.org'

# Specify your gem's dependencies in perpetuus.gemspec
gemspec

group :development, :test do
  gem "rspec", "~> 2.13"
end

有什么提示吗?

我正在使用 Mac OS 上的 Ruby 2.0.0 和 RVM 1.19.1


你的项目根目录中是否有.travis.yml文件? - Jason Kim
2个回答

7

您的Rakefile中没有配置默认任务。如果您想让Travis运行您的测试套件,您应该在Rakefile中添加类似以下内容:

require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)
task :default => :spec

您可以在项目目录中运行rake来本地测试此配置。

3

你的Rakefile缺少默认任务。

假设你通常运行以下命令:

rake test

为了运行你的规范,只需在文件末尾添加以下内容:
task :default => [:test]

你理论上可以编辑 .travis.yml 文件,而不是只运行rake命令,你也可以让它运行其他命令。
script: "bundle exec rake spec:travis"

...但是添加一个默认的Rake任务更容易。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接