Permalink
Browse files

added rs, cu and tests script to call rspec and cucumber in a nicer way

  • Loading branch information...
1 parent 5643f56 commit 70830f4c792fd39d780648e227e6939ea969478c @triskweline triskweline committed Jun 10, 2011
Showing with 64 additions and 23 deletions.
  1. +27 −5 README.md
  2. +11 −0 bin/cu
  3. +18 −0 bin/rs
  4. +0 −17 bin/rspec-and-cucumber
  5. +7 −0 bin/tests
  6. +1 −1 lib/geordi/version.rb
View
@@ -30,6 +30,18 @@ Runs the given command under `bundle exec` if a `Gemfile` is present in your wor
More information at http://makandra.com/notes/684-automatically-run-bundle-exec-if-required
+
+cu
+-----
+
+Runs Cucumber with the arguments you want, bundle exec, cucumber_spinner detection, etc.:
+
+ cu features/users.feature
+
+More information at http://makandra.com/notes/1277-a-nicer-way-to-run-rspec-and-or-cucumber
+
+
+
cleanup-directory
-----------------
@@ -111,14 +123,14 @@ Recursively removes executable flags from files in the working directory that pr
More information at http://makandra.com/notes/659-recursively-remove-unnecessary-execute-flags
-rspec-and-cucumber
---------------
+rs
+-----
-Runs both RSpec and Cucumber. Call from any project directory:
+Runs RSpec with the arguments you want, RSpec 1/2 detection, bundle exec, rspec_spinner detection, etc.:
- rspec-and-cucumber
+ rs spec/models/user_spec.rb
-More information at http://makandra.com/notes/1197-bash-script-to-run-specs-and-features
+More information at http://makandra.com/notes/1277-a-nicer-way-to-run-rspec-and-or-cucumber
shell-for
@@ -129,3 +141,13 @@ Opens an SSH shell on the given [Capistrano multistage](https://github.com/capis
shell-for production
More information at http://makandra.com/notes/1209-script-to-open-an-ssh-shell-to-a-capistrano-deployment-target
+
+
+tests
+--------------
+
+Runs both `rs` and `cu`. Call from any project directory:
+
+ tests
+
+More information at http://makandra.com/notes/1277-a-nicer-way-to-run-rspec-and-or-cucumber
View
@@ -0,0 +1,11 @@
+#!/usr/bin/env ruby
+
+# Print some whitespace
+4.times { puts }
+
+# Check if cucumber_spinner is available
+spinner_available = File.open('Gemfile').read.scan(/cucumber_spinner/).any?
+format_args = spinner_available ? ['--format', 'CucumberSpinner::CuriousProgressBarFormatter'] : ['--format', 'progress']
+
+# Run cucumber behind bundler
+exec *["b", "cucumber", format_args, ARGV].flatten
View
@@ -0,0 +1,18 @@
+#!/usr/bin/env ruby
+
+# Print some whitespace
+4.times { puts }
+
+# Check if we're looking at a Rails 2 / rspec 1 project
+rspec1 = File.exists?('script/spec')
+rspec_args = rspec1 ? ["spec", "-c"] : ["rspec"]
+
+# Check if rspec_spinner is available
+spinner_available = File.open('Gemfile').read.scan(/rspec_spinner/).any?
+spinner_args = spinner_available ? ['-r', 'rspec_spinner', '-f', 'RspecSpinner::Bar'] : []
+
+# Run examples in 'spec' unless an argument is given
+ARGV[0] ||= 'spec'
+
+# Run rspec behind bundler
+exec *["b", rspec_args, spinner_args, ARGV].flatten
@@ -1,17 +0,0 @@
-#!/usr/bin/env ruby
-File.delete 'rerun.txt' if FileTest.exists? 'rerun.txt'
-
-if File.open('Gemfile').read.scan(/rspec_spinner/).any?
- spec = "script/spec -r rspec_spinner -f RspecSpinner::Bar -c spec"
-else
- spec = "script/spec spec"
-end
-
-if File.open('Gemfile').read.scan(/cucumber_spinner/).any?
- cucumber = "script/cucumber --format CucumberSpinner::CuriousProgressBarFormatter features"
-else
- cucumber = "script/cucumber --format progress features"
-end
-
-exec "bundle exec #{spec} && bundle exec #{cucumber}"
-
View
@@ -0,0 +1,7 @@
+#!/usr/bin/env ruby
+
+# Delete any state from previous Cucumber failures
+File.delete 'rerun.txt' if File.exists? 'rerun.txt'
+
+# Run rspec and cucumber
+exec "rs && cu"
@@ -1,3 +1,3 @@
module Geordi
- VERSION = '0.2.7'
+ VERSION = '0.3.0'
end

0 comments on commit 70830f4

Please sign in to comment.