soundcheck 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -2,14 +2,14 @@ GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
4
  builder (3.0.0)
5
- cucumber (1.0.4)
5
+ cucumber (1.1.0)
6
6
  builder (>= 2.1.2)
7
7
  diff-lcs (>= 1.1.2)
8
- gherkin (~> 2.4.18)
8
+ gherkin (~> 2.5.0)
9
9
  json (>= 1.4.6)
10
10
  term-ansicolor (>= 1.0.6)
11
11
  diff-lcs (1.1.3)
12
- gherkin (2.4.18)
12
+ gherkin (2.5.4)
13
13
  json (>= 1.4.6)
14
14
  git (1.2.5)
15
15
  jeweler (1.6.4)
@@ -17,7 +17,7 @@ GEM
17
17
  git (>= 1.2.5)
18
18
  rake
19
19
  json (1.6.1)
20
- rake (0.9.2)
20
+ rake (0.9.2.2)
21
21
  rcov (0.9.11)
22
22
  rspec (2.3.0)
23
23
  rspec-core (~> 2.3.0)
@@ -27,7 +27,7 @@ GEM
27
27
  rspec-expectations (2.3.0)
28
28
  diff-lcs (~> 1.1.2)
29
29
  rspec-mocks (2.3.0)
30
- term-ansicolor (1.0.6)
30
+ term-ansicolor (1.0.7)
31
31
 
32
32
  PLATFORMS
33
33
  ruby
data/README.markdown CHANGED
@@ -12,6 +12,10 @@ you require that file, you'll probably need all of Rails loaded. If you don't (a
12
12
  often do when running a spec for something you put in `Rails.root.join("lib")`), it'll execute
13
13
  "rspec $0", otherwise it'll execute "bundle exec rspec $0".
14
14
 
15
+ ## Is Soundcheck not working for your project?
16
+
17
+ Feel free to submit a pull request that adds only a fixture and RSpec testcase which describes the situation in which it fails. If you can fix it yourself, then great, but I'll happily accept patches that add more project styles which Soundcheck currently can't handle.
18
+
15
19
  ## Contributing to Soundcheck
16
20
 
17
21
  * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
data/bin/soundcheck CHANGED
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require 'soundcheck'
4
- exec Soundcheck.command_to_run(ARGV[0])
4
+ exec Soundcheck.new(ARGV[0]).command_to_run
@@ -3,6 +3,6 @@ Feature: Soundcheck
3
3
  I want to require as little as possible
4
4
 
5
5
  Scenario: Ruby and RSpec
6
- Given the "ruby/rspec" fixture
6
+ Given the "ruby-bundler-rspec" fixture
7
7
  When I run soundcheck with "spec"
8
8
  Then it should have passed
@@ -1,9 +1,11 @@
1
+ SOUNDCHECK_ROOT = File.expand_path(File.join(File.dirname(__FILE__), "..", ".."))
2
+
1
3
  Given /^the "([^"]*)" fixture$/ do |fixture_path|
2
- Dir.chdir(File.join(File.expand_path(File.dirname(__FILE__)), "../../spec/fixtures", fixture_path))
4
+ Dir.chdir(File.join(SOUNDCHECK_ROOT, "fixtures", fixture_path))
3
5
  end
4
6
 
5
7
  When /^I run soundcheck with "([^"]*)"$/ do |spec_file|
6
- puts output = `#{File.join(File.expand_path(File.dirname(__FILE__)), "../../bin/soundcheck")} #{spec_file}`
8
+ puts output = `ruby -I#{File.join(SOUNDCHECK_ROOT, "lib")} #{File.join(SOUNDCHECK_ROOT, "bin", "soundcheck")} #{spec_file}`
7
9
  end
8
10
 
9
11
  Then /^it should have passed$/ do
@@ -0,0 +1,3 @@
1
+ source :rubygems
2
+
3
+ gem 'rspec'
@@ -0,0 +1,18 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ diff-lcs (1.1.3)
5
+ rspec (2.7.0)
6
+ rspec-core (~> 2.7.0)
7
+ rspec-expectations (~> 2.7.0)
8
+ rspec-mocks (~> 2.7.0)
9
+ rspec-core (2.7.1)
10
+ rspec-expectations (2.7.0)
11
+ diff-lcs (~> 1.1.2)
12
+ rspec-mocks (2.7.0)
13
+
14
+ PLATFORMS
15
+ ruby
16
+
17
+ DEPENDENCIES
18
+ rspec
File without changes
@@ -0,0 +1 @@
1
+ require 'spec_helper'
data/lib/soundcheck.rb CHANGED
@@ -1,41 +1,29 @@
1
- #!/usr/bin/env ruby
2
- # Put this in the script/ directory of your Rails app, then run it with a spec
3
- # filename. If the spec uses spec_helper, it'll be run inside Bundler.
4
- # Otherwise, it'll be run directly with whatever `rspec` executable is on the
5
- # path.
6
-
7
1
  class Soundcheck
8
- def self.command_to_run(path = nil)
9
- path = "spec" unless path
10
-
11
- `grep -r 'spec_helper' #{path}`
12
- if $?.exitstatus == 1 # no match; we have a stand-alone spec
13
- "rspec #{path}"
14
- else
15
- "bundle exec rspec #{path}"
16
- end
17
- end
18
- end
19
-
20
- #need_rails=1
2
+ attr_accessor :path
21
3
 
22
- #if [ $# -gt 0 ]; then # we have args
23
- #filename=$1
24
- ## Remove trailing line numbers from filename, e.g. spec/my_spec.rb:33
25
- #grep_filename=`echo $1 | sed 's/:.*$//g'`
4
+ def initialize(path = "spec")
5
+ @path = path || "spec"
6
+ end
26
7
 
27
- #(set +e; grep -r 'spec_helper' $grep_filename; echo '') > /dev/null
28
- #if [ $? -eq 1 ]; then # no match; we have a stand-alone spec
29
- #need_rails=''
30
- #fi
31
- #else # we have no args
32
- #filename='spec'
33
- #fi
8
+ def command_to_run
9
+ if has_gemfile?
10
+ if requires_spec_helper?
11
+ return "rspec #{@path}"
12
+ else
13
+ return "bundle exec rspec #{@path}"
14
+ end
15
+ end
34
16
 
35
- #command='rspec'
17
+ # Assume rspec
18
+ "rspec #{@path}"
19
+ end
36
20
 
37
- #if [ $need_rails ]; then
38
- #command="ruby -S bundle exec $command"
39
- #fi
21
+ def requires_spec_helper?
22
+ `grep -r 'spec_helper' #{@path}`
23
+ $?.exitstatus == 1 # no match; we have a stand-alone spec
24
+ end
40
25
 
41
- #RAILS_ENV=test $command $filename
26
+ def has_gemfile?
27
+ File.exist?("Gemfile")
28
+ end
29
+ end
data/soundcheck.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "soundcheck"
8
- s.version = "0.0.1"
8
+ s.version = "0.0.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Marten Veldthuis"]
12
- s.date = "2011-10-17"
12
+ s.date = "2011-10-28"
13
13
  s.description = "Soundcheck tries to figure out what kind of project you're working on, what test file you're trying to run, and what the fastest way is to run that."
14
14
  s.email = "marten@veldthuis.com"
15
15
  s.executables = ["soundcheck"]
@@ -29,11 +29,16 @@ Gem::Specification.new do |s|
29
29
  "bin/soundcheck",
30
30
  "features/soundcheck.feature",
31
31
  "features/step_definitions/steps.rb",
32
+ "fixtures/ruby-bundler-rspec/Gemfile",
33
+ "fixtures/ruby-bundler-rspec/Gemfile.lock",
34
+ "fixtures/ruby-bundler-rspec/spec/spec_helper.rb",
35
+ "fixtures/ruby-bundler-rspec/spec/with_spec_helper_spec.rb",
36
+ "fixtures/ruby-bundler-rspec/spec/without_spec_helper_spec.rb",
37
+ "fixtures/ruby-rspec/spec/spec_helper.rb",
38
+ "fixtures/ruby-rspec/spec/with_spec_helper_spec.rb",
39
+ "fixtures/ruby-rspec/spec/without_spec_helper_spec.rb",
32
40
  "lib/soundcheck.rb",
33
41
  "soundcheck.gemspec",
34
- "spec/fixtures/ruby/rspec/spec/spec_helper.rb",
35
- "spec/fixtures/ruby/rspec/spec/with_spec_helper_spec.rb",
36
- "spec/fixtures/ruby/rspec/spec/without_spec_helper_spec.rb",
37
42
  "spec/soundcheck_spec.rb"
38
43
  ]
39
44
  s.homepage = "http://github.com/marten/soundcheck"
@@ -1,31 +1,40 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + '/../lib/soundcheck')
2
2
 
3
3
  CURRENT_PWD = Dir.pwd
4
- FIXTURES_ROOT = File.expand_path(File.dirname(__FILE__) + '/fixtures')
4
+ FIXTURES_ROOT = File.expand_path(File.dirname(__FILE__) + '/../fixtures')
5
+
6
+ def cmd_for(path = nil)
7
+ Soundcheck.new(path).command_to_run
8
+ end
5
9
 
6
10
  describe "Soundcheck" do
7
11
  context "for a ruby project" do
8
12
  context "using rspec" do
9
- before(:all) { Dir.chdir(FIXTURES_ROOT + '/ruby/rspec') }
10
- after(:all) { Dir.chdir(CURRENT_PWD) }
13
+ before(:all) { Dir.chdir(FIXTURES_ROOT + '/ruby-rspec') }
11
14
 
12
- it "should return 'bundle exec rspec spec' when run with no arguments" do
13
- Soundcheck.command_to_run().should == "bundle exec rspec spec"
15
+ it "should not use bundler when no Gemfile exists" do
16
+ cmd_for.should == "rspec spec"
14
17
  end
15
18
 
16
- it "should return 'bundle exec rspec spec/with_spec_helper_spec.rb'" do
17
- Soundcheck.command_to_run('spec/with_spec_helper_spec.rb').should == "bundle exec rspec spec/with_spec_helper_spec.rb"
18
- end
19
+ context "using bundler" do
20
+ before(:all) { Dir.chdir(FIXTURES_ROOT + '/ruby-bundler-rspec') }
19
21
 
20
- it "should return 'rspec spec/without_spec_helper_spec.rb'" do
21
- Soundcheck.command_to_run('spec/without_spec_helper_spec.rb').should == "rspec spec/without_spec_helper_spec.rb"
22
- end
22
+ it "should return 'bundle exec rspec spec' when run with no arguments" do
23
+ cmd_for.should == "bundle exec rspec spec"
24
+ end
25
+
26
+ it "should return 'bundle exec rspec spec/with_spec_helper_spec.rb'" do
27
+ cmd_for('spec/with_spec_helper_spec.rb').should == "bundle exec rspec spec/with_spec_helper_spec.rb"
28
+ end
23
29
 
24
- it "should not use bundler when no Gemfile exists"
25
- it "should not call rspec outside of bundler when the rspec command does not exist"
30
+ it "should return 'rspec spec/without_spec_helper_spec.rb'" do
31
+ cmd_for('spec/without_spec_helper_spec.rb').should == "rspec spec/without_spec_helper_spec.rb"
32
+ end
33
+ end
26
34
  end
27
35
 
28
36
  context "using minitest"
37
+ context "using test::unit"
29
38
  end
30
39
 
31
40
  context "for a python project"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: soundcheck
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-10-17 00:00:00.000000000Z
12
+ date: 2011-10-28 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &19873260 !ruby/object:Gem::Requirement
16
+ requirement: &21299080 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 2.3.0
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *19873260
24
+ version_requirements: *21299080
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: jeweler
27
- requirement: &19871160 !ruby/object:Gem::Requirement
27
+ requirement: &21298600 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 1.6.4
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *19871160
35
+ version_requirements: *21298600
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rcov
38
- requirement: &19869480 !ruby/object:Gem::Requirement
38
+ requirement: &21298000 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *19869480
46
+ version_requirements: *21298000
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: cucumber
49
- requirement: &19868540 !ruby/object:Gem::Requirement
49
+ requirement: &21297400 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *19868540
57
+ version_requirements: *21297400
58
58
  description: Soundcheck tries to figure out what kind of project you're working on,
59
59
  what test file you're trying to run, and what the fastest way is to run that.
60
60
  email: marten@veldthuis.com
@@ -76,11 +76,16 @@ files:
76
76
  - bin/soundcheck
77
77
  - features/soundcheck.feature
78
78
  - features/step_definitions/steps.rb
79
+ - fixtures/ruby-bundler-rspec/Gemfile
80
+ - fixtures/ruby-bundler-rspec/Gemfile.lock
81
+ - fixtures/ruby-bundler-rspec/spec/spec_helper.rb
82
+ - fixtures/ruby-bundler-rspec/spec/with_spec_helper_spec.rb
83
+ - fixtures/ruby-bundler-rspec/spec/without_spec_helper_spec.rb
84
+ - fixtures/ruby-rspec/spec/spec_helper.rb
85
+ - fixtures/ruby-rspec/spec/with_spec_helper_spec.rb
86
+ - fixtures/ruby-rspec/spec/without_spec_helper_spec.rb
79
87
  - lib/soundcheck.rb
80
88
  - soundcheck.gemspec
81
- - spec/fixtures/ruby/rspec/spec/spec_helper.rb
82
- - spec/fixtures/ruby/rspec/spec/with_spec_helper_spec.rb
83
- - spec/fixtures/ruby/rspec/spec/without_spec_helper_spec.rb
84
89
  - spec/soundcheck_spec.rb
85
90
  homepage: http://github.com/marten/soundcheck
86
91
  licenses:
@@ -97,7 +102,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
97
102
  version: '0'
98
103
  segments:
99
104
  - 0
100
- hash: 3910485601409575450
105
+ hash: -4368845081355427010
101
106
  required_rubygems_version: !ruby/object:Gem::Requirement
102
107
  none: false
103
108
  requirements: