soundcheck 0.0.2 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -6,7 +6,7 @@ source "http://rubygems.org"
6
6
  # Add dependencies to develop your gem here.
7
7
  # Include everything needed to run rake, tests, features, etc.
8
8
  group :development do
9
- gem "rspec", "~> 2.3.0"
9
+ gem "rspec"
10
10
  gem "jeweler", "~> 1.6.4"
11
11
  gem "rcov", ">= 0"
12
12
  gem "cucumber"
data/Gemfile.lock CHANGED
@@ -19,14 +19,14 @@ GEM
19
19
  json (1.6.1)
20
20
  rake (0.9.2.2)
21
21
  rcov (0.9.11)
22
- rspec (2.3.0)
23
- rspec-core (~> 2.3.0)
24
- rspec-expectations (~> 2.3.0)
25
- rspec-mocks (~> 2.3.0)
26
- rspec-core (2.3.1)
27
- rspec-expectations (2.3.0)
22
+ rspec (2.7.0)
23
+ rspec-core (~> 2.7.0)
24
+ rspec-expectations (~> 2.7.0)
25
+ rspec-mocks (~> 2.7.0)
26
+ rspec-core (2.7.1)
27
+ rspec-expectations (2.7.0)
28
28
  diff-lcs (~> 1.1.2)
29
- rspec-mocks (2.3.0)
29
+ rspec-mocks (2.7.0)
30
30
  term-ansicolor (1.0.7)
31
31
 
32
32
  PLATFORMS
@@ -36,4 +36,4 @@ DEPENDENCIES
36
36
  cucumber
37
37
  jeweler (~> 1.6.4)
38
38
  rcov
39
- rspec (~> 2.3.0)
39
+ rspec
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.2
1
+ 0.1.0
data/bin/soundcheck CHANGED
@@ -1,4 +1,22 @@
1
1
  #!/usr/bin/env ruby
2
-
2
+ require 'optparse'
3
3
  require 'soundcheck'
4
- exec Soundcheck.new(ARGV[0]).command_to_run
4
+
5
+ options = {}
6
+ option_parser = OptionParser.new do |opts|
7
+ opts.banner = "Usage: soundcheck [options] [file or path]"
8
+
9
+ opts.on("--fast", "Run fast specs only") do |v|
10
+ options[:fast] = v
11
+ end
12
+
13
+ opts.on("--help", "Show this info") do |v|
14
+ puts opts
15
+ exit
16
+ end
17
+ end
18
+
19
+ option_parser.parse!(ARGV)
20
+ cmd = Soundcheck.new(ARGV[0], options).command_to_run
21
+ puts cmd
22
+ exec cmd
@@ -2,7 +2,11 @@ Feature: Soundcheck
2
2
  In order to run my tests quickly
3
3
  I want to require as little as possible
4
4
 
5
+ Scenario: Command line help
6
+ When I run "soundcheck --help"
7
+ Then I should see "Usage: soundcheck"
8
+
5
9
  Scenario: Ruby and RSpec
6
10
  Given the "ruby-bundler-rspec" fixture
7
- When I run soundcheck with "spec"
11
+ When I run "soundcheck spec"
8
12
  Then it should have passed
@@ -4,10 +4,14 @@ Given /^the "([^"]*)" fixture$/ do |fixture_path|
4
4
  Dir.chdir(File.join(SOUNDCHECK_ROOT, "fixtures", fixture_path))
5
5
  end
6
6
 
7
- When /^I run soundcheck with "([^"]*)"$/ do |spec_file|
8
- puts output = `ruby -I#{File.join(SOUNDCHECK_ROOT, "lib")} #{File.join(SOUNDCHECK_ROOT, "bin", "soundcheck")} #{spec_file}`
7
+ When /^I run "soundcheck ([^"]*)"$/ do |args|
8
+ @output = `ruby -I#{File.join(SOUNDCHECK_ROOT, "lib")} #{File.join(SOUNDCHECK_ROOT, "bin", "soundcheck")} #{args}`
9
9
  end
10
10
 
11
11
  Then /^it should have passed$/ do
12
12
  $?.exitstatus.should == 0
13
+ end
14
+
15
+ Then /^I should see "([^"]*)"$/ do |text|
16
+ @output.should include(text)
13
17
  end
data/lib/soundcheck.rb CHANGED
@@ -1,21 +1,27 @@
1
1
  class Soundcheck
2
2
  attr_accessor :path
3
3
 
4
- def initialize(path = "spec")
5
- @path = path || "spec"
4
+ def initialize(path = "spec", options = {})
5
+ @options = options
6
+
7
+ if options[:fast]
8
+ @path = `grep -r -L 'spec_helper' #{path || "spec"} | grep '_spec.rb'`.strip.gsub("\n", " ")
9
+ else
10
+ @path = path || "spec"
11
+ end
6
12
  end
7
13
 
8
14
  def command_to_run
9
15
  if has_gemfile?
10
16
  if requires_spec_helper?
11
- return "rspec #{@path}"
17
+ return "rspec --drb #{@path}"
12
18
  else
13
- return "bundle exec rspec #{@path}"
19
+ return "bundle exec rspec --drb #{@path}"
14
20
  end
15
21
  end
16
22
 
17
23
  # Assume rspec
18
- "rspec #{@path}"
24
+ "rspec --drb #{@path}"
19
25
  end
20
26
 
21
27
  def requires_spec_helper?
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.2"
8
+ s.version = "0.1.0"
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-28"
12
+ s.date = "2011-10-30"
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"]
@@ -44,25 +44,25 @@ Gem::Specification.new do |s|
44
44
  s.homepage = "http://github.com/marten/soundcheck"
45
45
  s.licenses = ["MIT"]
46
46
  s.require_paths = ["lib"]
47
- s.rubygems_version = "1.8.10"
47
+ s.rubygems_version = "1.8.11"
48
48
  s.summary = "Automatically runs correct test command"
49
49
 
50
50
  if s.respond_to? :specification_version then
51
51
  s.specification_version = 3
52
52
 
53
53
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
54
- s.add_development_dependency(%q<rspec>, ["~> 2.3.0"])
54
+ s.add_development_dependency(%q<rspec>, [">= 0"])
55
55
  s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
56
56
  s.add_development_dependency(%q<rcov>, [">= 0"])
57
57
  s.add_development_dependency(%q<cucumber>, [">= 0"])
58
58
  else
59
- s.add_dependency(%q<rspec>, ["~> 2.3.0"])
59
+ s.add_dependency(%q<rspec>, [">= 0"])
60
60
  s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
61
61
  s.add_dependency(%q<rcov>, [">= 0"])
62
62
  s.add_dependency(%q<cucumber>, [">= 0"])
63
63
  end
64
64
  else
65
- s.add_dependency(%q<rspec>, ["~> 2.3.0"])
65
+ s.add_dependency(%q<rspec>, [">= 0"])
66
66
  s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
67
67
  s.add_dependency(%q<rcov>, [">= 0"])
68
68
  s.add_dependency(%q<cucumber>, [">= 0"])
@@ -3,8 +3,8 @@ require File.expand_path(File.dirname(__FILE__) + '/../lib/soundcheck')
3
3
  CURRENT_PWD = Dir.pwd
4
4
  FIXTURES_ROOT = File.expand_path(File.dirname(__FILE__) + '/../fixtures')
5
5
 
6
- def cmd_for(path = nil)
7
- Soundcheck.new(path).command_to_run
6
+ def cmd_for(path = nil, options = {})
7
+ Soundcheck.new(path, options).command_to_run
8
8
  end
9
9
 
10
10
  describe "Soundcheck" do
@@ -13,22 +13,26 @@ describe "Soundcheck" do
13
13
  before(:all) { Dir.chdir(FIXTURES_ROOT + '/ruby-rspec') }
14
14
 
15
15
  it "should not use bundler when no Gemfile exists" do
16
- cmd_for.should == "rspec spec"
16
+ cmd_for.should == "rspec --drb spec"
17
17
  end
18
18
 
19
19
  context "using bundler" do
20
20
  before(:all) { Dir.chdir(FIXTURES_ROOT + '/ruby-bundler-rspec') }
21
21
 
22
22
  it "should return 'bundle exec rspec spec' when run with no arguments" do
23
- cmd_for.should == "bundle exec rspec spec"
23
+ cmd_for.should == "bundle exec rspec --drb spec"
24
+ end
25
+
26
+ it "should run only fast specs" do
27
+ cmd_for("spec", fast: true).should == "rspec --drb spec/without_spec_helper_spec.rb"
24
28
  end
25
29
 
26
30
  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"
31
+ cmd_for('spec/with_spec_helper_spec.rb').should == "bundle exec rspec --drb spec/with_spec_helper_spec.rb"
28
32
  end
29
33
 
30
34
  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"
35
+ cmd_for('spec/without_spec_helper_spec.rb').should == "rspec --drb spec/without_spec_helper_spec.rb"
32
36
  end
33
37
  end
34
38
  end
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.2
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,22 +9,22 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-10-28 00:00:00.000000000Z
12
+ date: 2011-10-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &21299080 !ruby/object:Gem::Requirement
16
+ requirement: &16457840 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
- - - ~>
19
+ - - ! '>='
20
20
  - !ruby/object:Gem::Version
21
- version: 2.3.0
21
+ version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *21299080
24
+ version_requirements: *16457840
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: jeweler
27
- requirement: &21298600 !ruby/object:Gem::Requirement
27
+ requirement: &16456220 !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: *21298600
35
+ version_requirements: *16456220
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rcov
38
- requirement: &21298000 !ruby/object:Gem::Requirement
38
+ requirement: &16477960 !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: *21298000
46
+ version_requirements: *16477960
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: cucumber
49
- requirement: &21297400 !ruby/object:Gem::Requirement
49
+ requirement: &16477140 !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: *21297400
57
+ version_requirements: *16477140
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
@@ -102,7 +102,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
102
102
  version: '0'
103
103
  segments:
104
104
  - 0
105
- hash: -4368845081355427010
105
+ hash: -696700120744123179
106
106
  required_rubygems_version: !ruby/object:Gem::Requirement
107
107
  none: false
108
108
  requirements:
@@ -111,7 +111,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
111
111
  version: '0'
112
112
  requirements: []
113
113
  rubyforge_project:
114
- rubygems_version: 1.8.10
114
+ rubygems_version: 1.8.11
115
115
  signing_key:
116
116
  specification_version: 3
117
117
  summary: Automatically runs correct test command