From e8fbed123bc14c59fc02529e21e62c69a71c50d4 Mon Sep 17 00:00:00 2001 From: Ippei Obayashi Date: Tue, 13 Sep 2016 01:14:45 +0900 Subject: [PATCH 1/3] Use rake to run rspec By this changeset, how to compile and test narray is changed as follows: rake compile rake spec --- Rakefile | 5 +++++ spec/bit_spec.rb | 2 +- spec/narray_spec.rb | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Rakefile b/Rakefile index 2b5ca481..4a3884e1 100644 --- a/Rakefile +++ b/Rakefile @@ -3,6 +3,8 @@ begin require "rake/extensiontask" require "rake_compiler_dock" require "shellwords" +require "rspec/core/rake_task" + spec = Bundler::GemHelper.gemspec @@ -12,6 +14,9 @@ Rake::ExtensionTask.new("numo/narray", spec) do |ext| ext.cross_platform = cross_platforms end +RSpec::Core::RakeTask.new("spec") +Rake::Task[:spec].prerequisites << :compile + pkg_dir = "pkg" windows_gem_paths = cross_platforms.collect do |platform| File.join(pkg_dir, "#{spec.full_name}-#{platform}.gem") diff --git a/spec/bit_spec.rb b/spec/bit_spec.rb index bc368635..e69ffdc7 100644 --- a/spec/bit_spec.rb +++ b/spec/bit_spec.rb @@ -1,4 +1,4 @@ -require File.join(File.dirname(__FILE__), "../ext/numo/narray/narray") +require_relative '../lib/numo/narray.so' #Numo::NArray.debug = true RSpec.configure do |config| diff --git a/spec/narray_spec.rb b/spec/narray_spec.rb index 93e70480..f569baaa 100644 --- a/spec/narray_spec.rb +++ b/spec/narray_spec.rb @@ -1,4 +1,4 @@ -require File.join(File.dirname(__FILE__), "../ext/numo/narray/narray") +require_relative "../lib/numo/narray.so" #Numo::NArray.debug = true RSpec.configure do |config| From 7300dfda3874a90b43e176045e754f228bc303fd Mon Sep 17 00:00:00 2001 From: Ippei Obayashi Date: Tue, 13 Sep 2016 01:44:03 +0900 Subject: [PATCH 2/3] Run rspec on travis-ci --- .travis.yml | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 25320325..9748ef62 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,18 +5,24 @@ rvm: - '2.0' - '2.1' - '2.2' - - '2.3.0' + - '2.3.1' matrix: fast_finish: true -install: true +# before_install: +# - sudo apt-get update -qq +# - sudo apt-get install ruby gcc ruby-dev rake make -y -before_install: - - sudo apt-get update -qq - - sudo apt-get install ruby gcc ruby-dev rake make -y +cache: bundler + + + +before_script: + - rake compile script: + - rake spec - gem build numo-narray.gemspec - gem install numo-narray-0.9.0.3.gem From 92c197066af0cb126e174c6e5757e1c59686cd4b Mon Sep 17 00:00:00 2001 From: Ippei Obayashi Date: Tue, 13 Sep 2016 01:48:25 +0900 Subject: [PATCH 3/3] Add "bundle exec" to .travis.yml --- .travis.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9748ef62..cee9a7f3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,8 +3,6 @@ language: rvm: - '2.0' - - '2.1' - - '2.2' - '2.3.1' matrix: @@ -20,9 +18,9 @@ cache: bundler before_script: - - rake compile + - bundle exec rake compile script: - - rake spec - - gem build numo-narray.gemspec - - gem install numo-narray-0.9.0.3.gem + - bundle exec rake spec + - bundle exec gem build numo-narray.gemspec + - bundle exec gem install numo-narray-0.9.0.3.gem