soundcheck 0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.rspec +1 -0
- data/Gemfile +12 -0
- data/Gemfile.lock +27 -0
- data/LICENSE.txt +20 -0
- data/README.markdown +28 -0
- data/Rakefile +50 -0
- data/VERSION +1 -0
- data/bin/soundcheck +4 -0
- data/lib/soundcheck.rb +41 -0
- data/spec/fixtures/ruby/rspec/spec/with_spec_helper_spec.rb +1 -0
- data/spec/fixtures/ruby/rspec/spec/without_spec_helper_spec.rb +0 -0
- data/spec/soundcheck_spec.rb +32 -0
- metadata +98 -0
data/.document
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/Gemfile
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
# Add dependencies required to use your gem here.
|
3
|
+
# Example:
|
4
|
+
# gem "activesupport", ">= 2.3.5"
|
5
|
+
|
6
|
+
# Add dependencies to develop your gem here.
|
7
|
+
# Include everything needed to run rake, tests, features, etc.
|
8
|
+
group :development do
|
9
|
+
gem "rspec", "~> 2.3.0"
|
10
|
+
gem "jeweler", "~> 1.6.4"
|
11
|
+
gem "rcov", ">= 0"
|
12
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
diff-lcs (1.1.3)
|
5
|
+
git (1.2.5)
|
6
|
+
jeweler (1.6.4)
|
7
|
+
bundler (~> 1.0)
|
8
|
+
git (>= 1.2.5)
|
9
|
+
rake
|
10
|
+
rake (0.9.2)
|
11
|
+
rcov (0.9.11)
|
12
|
+
rspec (2.3.0)
|
13
|
+
rspec-core (~> 2.3.0)
|
14
|
+
rspec-expectations (~> 2.3.0)
|
15
|
+
rspec-mocks (~> 2.3.0)
|
16
|
+
rspec-core (2.3.1)
|
17
|
+
rspec-expectations (2.3.0)
|
18
|
+
diff-lcs (~> 1.1.2)
|
19
|
+
rspec-mocks (2.3.0)
|
20
|
+
|
21
|
+
PLATFORMS
|
22
|
+
ruby
|
23
|
+
|
24
|
+
DEPENDENCIES
|
25
|
+
jeweler (~> 1.6.4)
|
26
|
+
rcov
|
27
|
+
rspec (~> 2.3.0)
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2011 Marten Veldthuis
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.markdown
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
A smarter way to run your tests
|
2
|
+
===============================
|
3
|
+
|
4
|
+
This gem started as a Ruby version of 'script/test' from [Destroy All Software's
|
5
|
+
screencast number 10](http://destroyallsoftware.com/screencasts/catalog/fast-tests-with-and-without-rails).
|
6
|
+
|
7
|
+
The basic idea is that sometimes it's not necessary to run rspec through bundler,
|
8
|
+
and it's possible to save a whole bunch of time off your test runs if it isn't. This script
|
9
|
+
will attempt to determine whether you want the entire Gemfile required and ready, by looking
|
10
|
+
whether you reference `spec_helper`. For Rails applications, this is reasonable, because if
|
11
|
+
you require that file, you'll probably need all of Rails loaded. If you don't (as you can
|
12
|
+
often do when running a spec for something you put in `Rails.root.join("lib")`), it'll execute
|
13
|
+
"rspec $0", otherwise it'll execute "bundle exec rspec $0".
|
14
|
+
|
15
|
+
## Contributing to Soundcheck
|
16
|
+
|
17
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
18
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
19
|
+
* Fork the project
|
20
|
+
* Start a feature/bugfix branch
|
21
|
+
* Commit and push until you are happy with your contribution
|
22
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
23
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
24
|
+
|
25
|
+
## Copyright
|
26
|
+
|
27
|
+
Copyright (c) 2011 Marten Veldthuis. See LICENSE.txt for further details.
|
28
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
begin
|
6
|
+
Bundler.setup(:default, :development)
|
7
|
+
rescue Bundler::BundlerError => e
|
8
|
+
$stderr.puts e.message
|
9
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
+
exit e.status_code
|
11
|
+
end
|
12
|
+
require 'rake'
|
13
|
+
|
14
|
+
require 'jeweler'
|
15
|
+
Jeweler::Tasks.new do |gem|
|
16
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
17
|
+
gem.name = "soundcheck"
|
18
|
+
gem.homepage = "http://github.com/marten/soundcheck"
|
19
|
+
gem.license = "MIT"
|
20
|
+
gem.summary = %Q{Automatically runs correct test command}
|
21
|
+
gem.description = %Q{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.}
|
22
|
+
gem.email = "marten@veldthuis.com"
|
23
|
+
gem.authors = ["Marten Veldthuis"]
|
24
|
+
gem.executables = ["soundcheck"]
|
25
|
+
# dependencies defined in Gemfile
|
26
|
+
end
|
27
|
+
Jeweler::RubygemsDotOrgTasks.new
|
28
|
+
|
29
|
+
require 'rspec/core'
|
30
|
+
require 'rspec/core/rake_task'
|
31
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
32
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
33
|
+
end
|
34
|
+
|
35
|
+
RSpec::Core::RakeTask.new(:rcov) do |spec|
|
36
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
37
|
+
spec.rcov = true
|
38
|
+
end
|
39
|
+
|
40
|
+
task :default => :spec
|
41
|
+
|
42
|
+
require 'rake/rdoctask'
|
43
|
+
Rake::RDocTask.new do |rdoc|
|
44
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
45
|
+
|
46
|
+
rdoc.rdoc_dir = 'rdoc'
|
47
|
+
rdoc.title = "soundcheck #{version}"
|
48
|
+
rdoc.rdoc_files.include('README*')
|
49
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
50
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.0
|
data/bin/soundcheck
ADDED
data/lib/soundcheck.rb
ADDED
@@ -0,0 +1,41 @@
|
|
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
|
+
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
|
21
|
+
|
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'`
|
26
|
+
|
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
|
34
|
+
|
35
|
+
#command='rspec'
|
36
|
+
|
37
|
+
#if [ $need_rails ]; then
|
38
|
+
#command="ruby -S bundle exec $command"
|
39
|
+
#fi
|
40
|
+
|
41
|
+
#RAILS_ENV=test $command $filename
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'spec_helper'
|
File without changes
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../lib/soundcheck')
|
2
|
+
|
3
|
+
CURRENT_PWD = Dir.pwd
|
4
|
+
FIXTURES_ROOT = File.expand_path(File.dirname(__FILE__) + '/fixtures')
|
5
|
+
|
6
|
+
describe "Soundcheck" do
|
7
|
+
context "for a ruby project" do
|
8
|
+
context "using rspec" do
|
9
|
+
before(:all) { Dir.chdir(FIXTURES_ROOT + '/ruby/rspec') }
|
10
|
+
after(:all) { Dir.chdir(CURRENT_PWD) }
|
11
|
+
|
12
|
+
it "should return 'bundle exec rspec spec' when run with no arguments" do
|
13
|
+
Soundcheck.command_to_run().should == "bundle exec rspec spec"
|
14
|
+
end
|
15
|
+
|
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
|
+
|
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
|
23
|
+
|
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"
|
26
|
+
end
|
27
|
+
|
28
|
+
context "using minitest"
|
29
|
+
end
|
30
|
+
|
31
|
+
context "for a python project"
|
32
|
+
end
|
metadata
ADDED
@@ -0,0 +1,98 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: soundcheck
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Marten Veldthuis
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2011-10-14 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rspec
|
16
|
+
requirement: &13987580 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 2.3.0
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *13987580
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: jeweler
|
27
|
+
requirement: &13986900 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ~>
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 1.6.4
|
33
|
+
type: :development
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *13986900
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: rcov
|
38
|
+
requirement: &13985840 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
type: :development
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *13985840
|
47
|
+
description: Soundcheck tries to figure out what kind of project you're working on,
|
48
|
+
what test file you're trying to run, and what the fastest way is to run that.
|
49
|
+
email: marten@veldthuis.com
|
50
|
+
executables:
|
51
|
+
- soundcheck
|
52
|
+
extensions: []
|
53
|
+
extra_rdoc_files:
|
54
|
+
- LICENSE.txt
|
55
|
+
- README.markdown
|
56
|
+
files:
|
57
|
+
- .document
|
58
|
+
- .rspec
|
59
|
+
- Gemfile
|
60
|
+
- Gemfile.lock
|
61
|
+
- LICENSE.txt
|
62
|
+
- README.markdown
|
63
|
+
- Rakefile
|
64
|
+
- VERSION
|
65
|
+
- bin/soundcheck
|
66
|
+
- lib/soundcheck.rb
|
67
|
+
- spec/fixtures/ruby/rspec/spec/with_spec_helper_spec.rb
|
68
|
+
- spec/fixtures/ruby/rspec/spec/without_spec_helper_spec.rb
|
69
|
+
- spec/soundcheck_spec.rb
|
70
|
+
homepage: http://github.com/marten/soundcheck
|
71
|
+
licenses:
|
72
|
+
- MIT
|
73
|
+
post_install_message:
|
74
|
+
rdoc_options: []
|
75
|
+
require_paths:
|
76
|
+
- lib
|
77
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
78
|
+
none: false
|
79
|
+
requirements:
|
80
|
+
- - ! '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
segments:
|
84
|
+
- 0
|
85
|
+
hash: -1515417583058671491
|
86
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
|
+
none: false
|
88
|
+
requirements:
|
89
|
+
- - ! '>='
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: '0'
|
92
|
+
requirements: []
|
93
|
+
rubyforge_project:
|
94
|
+
rubygems_version: 1.8.10
|
95
|
+
signing_key:
|
96
|
+
specification_version: 3
|
97
|
+
summary: Automatically runs correct test command
|
98
|
+
test_files: []
|