Gemspec失败了

时间:2013-07-03 20:07:23

标签: ruby rubygems 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

2 个答案:

答案 0 :(得分:7)

您的Rakefile中没有配置默认任务。如果你想让Travis运行你的测试套件你应该在你的Rakefile中添加这样的东西:

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

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

答案 1 :(得分:3)

您错过了Rakefile

中的默认任务

假设你经常跑

rake test

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

task :default => [:test]

理论上你可以改为编辑.travis.yml并给它一些其他的东西而不仅仅是rake

script: "bundle exec rake spec:travis"

。 。 。但添加默认的Rake任务更容易。