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 和 RVM 1.19.1 上使用 Ruby 2.0.0

4

2 回答 2

7

您没有在Rakefile. 如果您希望 Travis 运行您的测试套件,您可能应该在您的 Rakefile 中添加类似这样的内容:

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

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

于 2013-07-03T20:36:19.487 回答
3

您缺少默认任务Rakefile

假设您通常运行

rake test

要运行您的规范,只需在文件末尾添加以下内容:

task :default => [:test]

理论上,您可以.travis.yml改为编辑并为其提供其他运行方式,而不仅仅是rake

script: "bundle exec rake spec:travis"

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

于 2013-07-03T20:36:11.300 回答