Skip to content
This repository
Browse code

Improve the way we run builds.

- It was causing issues to have a rake task shell out to `script/test_all`
  since that itself was re-bundling.
- No need for `find_path_to_rspec_exe`; I've discovered that `--standalone`
  and `--binstubs` together produce bins that don't load bundler.
- Add `-x` to `set -e` as that will cause the script to print each command
  as it runs.  No need for `print_and_run`.
- Add cucumber to test_all script, and use just that for the build.
  • Loading branch information...
commit 4d06cef45fb19ca7f7604d9556239f6c11836a36 1 parent 82817f7
Myron Marston authored December 19, 2012
4  .travis.yml
... ...
@@ -1,7 +1,7 @@
1 1
 before_install:
2 2
   - if [[ `gem -v` != 1.8.* ]]; then gem update --system; fi
3  
-script: "script/test_all 2>&1 && bin/rake cucumber --backtrace 2>&1"
4  
-bundler_args: "--binstubs"
  3
+script: "script/test_all 2>&1"
  4
+bundler_args: "--standalone --binstubs"
5 5
 rvm:
6 6
   - 1.8.7
7 7
   - 1.9.2
8  Rakefile
@@ -22,11 +22,6 @@ namespace :spec do
22 22
     t.ruby_opts = %w[-w]
23 23
     t.rspec_opts = %w[--tag ui]
24 24
   end
25  
-
26  
-  desc "Runs all specs together and then file-by-file"
27  
-  task :ci do
28  
-    sh "script/test_all"
29  
-  end
30 25
 end
31 26
 
32 27
 if RUBY_VERSION.to_f == 1.8
@@ -78,4 +73,5 @@ task :relish, :version do |t, args|
78 73
   sh "rm features/Changelog.md"
79 74
 end
80 75
 
81  
-task :default => ["spec:ci", :cucumber]
  76
+task :default => [:spec, :cucumber]
  77
+
7  script/find_path_to_rspec_exe
... ...
@@ -1,7 +0,0 @@
1  
-#!/usr/bin/env ruby
2  
-
3  
-require File.expand_path('../../bundle/bundler/setup', __FILE__)
4  
-rspec_core_path = $LOAD_PATH.grep(/rspec-core\/lib$/).first
5  
-
6  
-puts File.expand_path('../exe/rspec', rspec_core_path)
7  
-
22  script/test_all
... ...
@@ -1,11 +1,6 @@
1 1
 #!/bin/bash
2 2
 
3  
-function print_and_run {
4  
-  echo $1
5  
-  ($1)
6  
-}
7  
-
8  
-set -e
  3
+set -e -x
9 4
 
10 5
 # ideas taken from: http://blog.headius.com/2010/03/jruby-startup-time-tips.html
11 6
 export JRUBY_OPTS='-X-C' # disable JIT since these processes are so short lived
@@ -13,20 +8,23 @@ export JAVA_OPTS='-d32'  # force jRuby to use client JVM for faster startup time
13 8
 
14 9
 echo "Bundling Standalone so we can run the specs w/o bundler loaded"
15 10
 
16  
-bundle install --standalone
17  
-path_to_rspec_exe=`script/find_path_to_rspec_exe`
18  
-
19  
-command_prefix="ruby -r./bundle/bundler/setup.rb -S $path_to_rspec_exe"
  11
+bundle install --standalone --binstubs
20 12
 
21 13
 echo "Running all..."
22 14
 
23  
-print_and_run "$command_prefix spec -b --format progress --profile"
  15
+bin/rspec spec -b --format progress --profile
24 16
 
25 17
 echo
26 18
 echo "--------------------------------------------------------------------"
27 19
 echo
28 20
 
29 21
 for file in `find spec -iname '*_spec.rb'`; do
30  
-  print_and_run "$command_prefix $file -b --format progress"
  22
+  bin/rspec $file -b --format progress
31 23
 done
32 24
 
  25
+# TODO: it would be nice to figure out how to run the cukes w/o the overhead of
  26
+# bundler, but just running `bin/cucumber` can fail due to the fact that it
  27
+# shells out (via aruba) and executes `rspec`--which can pick up the wrong
  28
+# rspec version if we're not running with bundler.
  29
+bundle exec bin/cucumber
  30
+

0 notes on commit 4d06cef

Mislav Marohnić

How about this then:

export PATH=./bin:"$PATH"
cucumber
Myron Marston

It's a great idea, but it unfortunately didn't work when I tried it locally:

(::) failed steps (::)

expected "\nAn error occurred \n  NoMethodError: undefined method `failure_color' for #<RSpec::Core::Configuration:0x007ff3138f26c8>\n  occurred at /Users/myron/code/rspec-dev/repos/rspec-core/lib/rspec/core/formatters/base_text_formatter.rb:166:in `failure_color'\n\n\n\nFailures:\n\n  1) exit 0 at_exit does not interfere with rspec's exit code\n/Users/myron/code/rspec-dev/repos/rspec-core/lib/rspec/core/formatters/base_text_formatter.rb:166:in `failure_color': undefined method `failure_color' for #<RSpec::Core::Configuration:0x007ff3138f26c8> (NoMethodError)\n\tfrom /Users/myron/code/rspec-dev/repos/rspec-core/lib/rspec/core/formatters/base_text_formatter.rb:261:in `dump_failure_info'\n\tfrom /Users/myron/code/rspec-dev/repos/rspec-core/lib/rspec/core/formatters/base_text_formatter.rb:255:in `dump_failure'\n\tfrom /Users/myron/code/rspec-dev/repos/rspec-core/lib/rspec/core/formatters/base_text_formatter.rb:23:in `block in dump_failures'\n\tfrom /Users/myron/code/rspec-dev/repos/rspec-core/lib/rspec/core/formatters/base_text_formatter.rb:21:in `each'\n\tfrom /Users/myron/code/rspec-dev/repos/rspec-core/lib/rspec/core/formatters/base_text_formatter.rb:21:in `each_with_index'\n\tfrom /Users/myron/code/rspec-dev/repos/rspec-core/lib/rspec/core/formatters/base_text_formatter.rb:21:in `dump_failures'\n\tfrom /Users/myron/.rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.12.2/lib/rspec/core/reporter.rb:98:in `block in notify'\n\tfrom /Users/myron/.rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.12.2/lib/rspec/core/reporter.rb:97:in `each'\n\tfrom /Users/myron/.rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.12.2/lib/rspec/core/reporter.rb:97:in `notify'\n\tfrom /Users/myron/.rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.12.2/lib/rspec/core/reporter.rb:81:in `finish'\n\tfrom /Users/myron/.rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.12.2/lib/rspec/core/reporter.rb:36:in `ensure in report'\n\tfrom /Users/myron/.rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.12.2/lib/rspec/core/reporter.rb:36:in `report'\n\tfrom /Users/myron/.rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.12.2/lib/rspec/core/command_line.rb:25:in `run'\n\tfrom /Users/myron/.rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.12.2/lib/rspec/core/runner.rb:80:in `run'\n\tfrom /Users/myron/.rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.12.2/lib/rspec/core/runner.rb:17:in `block in autorun'\n" to include "1 example, 1 failure"
Diff:
@@ -1,2 +1,27 @@
-1 example, 1 failure
+
+An error occurred 
+  NoMethodError: undefined method `failure_color' for #<RSpec::Core::Configuration:0x007ff3138f26c8>
+  occurred at /Users/myron/code/rspec-dev/repos/rspec-core/lib/rspec/core/formatters/base_text_formatter.rb:166:in `failure_color'
+
+
+
+Failures:
+
+  1) exit 0 at_exit does not interfere with rspec's exit code
+/Users/myron/code/rspec-dev/repos/rspec-core/lib/rspec/core/formatters/base_text_formatter.rb:166:in `failure_color': undefined method `failure_color' for #<RSpec::Core::Configuration:0x007ff3138f26c8> (NoMethodError)
+   from /Users/myron/code/rspec-dev/repos/rspec-core/lib/rspec/core/formatters/base_text_formatter.rb:261:in `dump_failure_info'
+   from /Users/myron/code/rspec-dev/repos/rspec-core/lib/rspec/core/formatters/base_text_formatter.rb:255:in `dump_failure'
+   from /Users/myron/code/rspec-dev/repos/rspec-core/lib/rspec/core/formatters/base_text_formatter.rb:23:in `block in dump_failures'
+   from /Users/myron/code/rspec-dev/repos/rspec-core/lib/rspec/core/formatters/base_text_formatter.rb:21:in `each'
+   from /Users/myron/code/rspec-dev/repos/rspec-core/lib/rspec/core/formatters/base_text_formatter.rb:21:in `each_with_index'
+   from /Users/myron/code/rspec-dev/repos/rspec-core/lib/rspec/core/formatters/base_text_formatter.rb:21:in `dump_failures'
+   from /Users/myron/.rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.12.2/lib/rspec/core/reporter.rb:98:in `block in notify'
+   from /Users/myron/.rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.12.2/lib/rspec/core/reporter.rb:97:in `each'
+   from /Users/myron/.rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.12.2/lib/rspec/core/reporter.rb:97:in `notify'
+   from /Users/myron/.rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.12.2/lib/rspec/core/reporter.rb:81:in `finish'
+   from /Users/myron/.rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.12.2/lib/rspec/core/reporter.rb:36:in `ensure in report'
+   from /Users/myron/.rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.12.2/lib/rspec/core/reporter.rb:36:in `report'
+   from /Users/myron/.rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.12.2/lib/rspec/core/command_line.rb:25:in `run'
+   from /Users/myron/.rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.12.2/lib/rspec/core/runner.rb:80:in `run'
+   from /Users/myron/.rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.12.2/lib/rspec/core/runner.rb:17:in `block in autorun'
 (RSpec::Expectations::ExpectationNotMetError)
features/command_line/exit_status.feature:82:in `And the output should contain "1 example, 1 failure"'

expected "\n\nFailures:\n\n  1) 1 is < 2\n/Users/myron/code/rspec-dev/repos/rspec-core/lib/rspec/core/formatters/base_text_formatter.rb:166:in `failure_color': undefined method `failure_color' for #<RSpec::Core::Configuration:0x007f9b0a1c1978> (NoMethodError)\n\tfrom /Users/myron/code/rspec-dev/repos/rspec-core/lib/rspec/core/formatters/base_text_formatter.rb:261:in `dump_failure_info'\n\tfrom /Users/myron/code/rspec-dev/repos/rspec-core/lib/rspec/core/formatters/base_text_formatter.rb:255:in `dump_failure'\n\tfrom /Users/myron/code/rspec-dev/repos/rspec-core/lib/rspec/core/formatters/base_text_formatter.rb:23:in `block in dump_failures'\n\tfrom /Users/myron/code/rspec-dev/repos/rspec-core/lib/rspec/core/formatters/base_text_formatter.rb:21:in `each'\n\tfrom /Users/myron/code/rspec-dev/repos/rspec-core/lib/rspec/core/formatters/base_text_formatter.rb:21:in `each_with_index'\n\tfrom /Users/myron/code/rspec-dev/repos/rspec-core/lib/rspec/core/formatters/base_text_formatter.rb:21:in `dump_failures'\n\tfrom /Users/myron/.rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.12.2/lib/rspec/core/reporter.rb:98:in `block in notify'\n\tfrom /Users/myron/.rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.12.2/lib/rspec/core/reporter.rb:97:in `each'\n\tfrom /Users/myron/.rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.12.2/lib/rspec/core/reporter.rb:97:in `notify'\n\tfrom /Users/myron/.rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.12.2/lib/rspec/core/reporter.rb:81:in `finish'\n\tfrom /Users/myron/.rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.12.2/lib/rspec/core/reporter.rb:36:in `ensure in report'\n\tfrom /Users/myron/.rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.12.2/lib/rspec/core/reporter.rb:36:in `report'\n\tfrom /Users/myron/.rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.12.2/lib/rspec/core/command_line.rb:25:in `run'\n\tfrom /Users/myron/.rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.12.2/lib/rspec/core/runner.rb:80:in `run'\n\tfrom /Users/myron/.rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.12.2/lib/rspec/core/runner.rb:17:in `block in autorun'\n" to include "1 example, 0 failures"
Diff:
@@ -1,2 +1,22 @@
-1 example, 0 failures
+
+
+Failures:
+
+  1) 1 is < 2
+/Users/myron/code/rspec-dev/repos/rspec-core/lib/rspec/core/formatters/base_text_formatter.rb:166:in `failure_color': undefined method `failure_color' for #<RSpec::Core::Configuration:0x007f9b0a1c1978> (NoMethodError)
+   from /Users/myron/code/rspec-dev/repos/rspec-core/lib/rspec/core/formatters/base_text_formatter.rb:261:in `dump_failure_info'
+   from /Users/myron/code/rspec-dev/repos/rspec-core/lib/rspec/core/formatters/base_text_formatter.rb:255:in `dump_failure'
+   from /Users/myron/code/rspec-dev/repos/rspec-core/lib/rspec/core/formatters/base_text_formatter.rb:23:in `block in dump_failures'
+   from /Users/myron/code/rspec-dev/repos/rspec-core/lib/rspec/core/formatters/base_text_formatter.rb:21:in `each'
+   from /Users/myron/code/rspec-dev/repos/rspec-core/lib/rspec/core/formatters/base_text_formatter.rb:21:in `each_with_index'
+   from /Users/myron/code/rspec-dev/repos/rspec-core/lib/rspec/core/formatters/base_text_formatter.rb:21:in `dump_failures'
+   from /Users/myron/.rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.12.2/lib/rspec/core/reporter.rb:98:in `block in notify'
+   from /Users/myron/.rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.12.2/lib/rspec/core/reporter.rb:97:in `each'
+   from /Users/myron/.rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.12.2/lib/rspec/core/reporter.rb:97:in `notify'
+   from /Users/myron/.rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.12.2/lib/rspec/core/reporter.rb:81:in `finish'
+   from /Users/myron/.rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.12.2/lib/rspec/core/reporter.rb:36:in `ensure in report'
+   from /Users/myron/.rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.12.2/lib/rspec/core/reporter.rb:36:in `report'
+   from /Users/myron/.rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.12.2/lib/rspec/core/command_line.rb:25:in `run'
+   from /Users/myron/.rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.12.2/lib/rspec/core/runner.rb:80:in `run'
+   from /Users/myron/.rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.12.2/lib/rspec/core/runner.rb:17:in `block in autorun'
 (RSpec::Expectations::ExpectationNotMetError)
features/command_line/ruby.feature:22:in `Then the output should contain "1 example, 0 failures"'

Failing Scenarios:
cucumber features/command_line/exit_status.feature:68 # Scenario: exit with rspec's exit code when an at_exit hook is added upstream
cucumber features/command_line/ruby.feature:10 # Scenario: 

216 scenarios (2 failed, 214 passed)
991 steps (2 failed, 989 passed)
0m54.808s

(running bundle exec cucumber does not fail in the same way)

I'd be happy to merge a PR from you if you took the time to figure this out :).

Please sign in to comment.
Something went wrong with that request. Please try again.