Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gemspec failing

Tags:

ruby

rubygems

gem

I'm developing a GEM for my graduation final project and Travis CI build is failing constantly.

This is my link on Travis: https://travis-ci.org/ricardobond/perpetuus/builds/8709218

The error on the build is:

$ 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.

Below is my 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         = ["[email protected]"]
  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

And here is my Gemfile:

source 'https://rubygems.org'

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

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

Any tips?

I'm using Ruby 2.0.0 on Mac OS and RVM 1.19.1

like image 938
ricardocaldeira Avatar asked Jul 03 '13 20:07

ricardocaldeira


2 Answers

You don't have a default task configured in your Rakefile. If you want Travis to run your test suite you should probably add something like this in your Rakefile:

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

You can test this configuration locally by running rake in your project dir.

like image 154
Slartibartfast Avatar answered Oct 31 '22 13:10

Slartibartfast


You are missing the default task in your Rakefile

Assuming that you usually run

rake test

To run your specs, just add this at the end of the file:

task :default => [:test]

You could in theory edit .travis.yml instead and give it something other to run than just rake:

script: "bundle exec rake spec:travis"

. . . but adding a default Rake task is easier.

like image 27
Neil Slater Avatar answered Oct 31 '22 13:10

Neil Slater