autowatchr 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +6 -1
- data/VERSION +1 -1
- data/autowatchr.gemspec +2 -2
- data/lib/autowatchr.rb +18 -3
- data/test/helper.rb +0 -2
- data/test/test_autowatchr.rb +21 -0
- data/test.watchr +1 -0
- metadata +2 -2
data/README.rdoc
CHANGED
@@ -16,6 +16,7 @@ Provides some autotest-like behavior for watchr (http://github.com/mynyml/watchr
|
|
16
16
|
|
17
17
|
* Cucumber support
|
18
18
|
* Expose algorithm to map test classes to test files
|
19
|
+
* Add INT signal trapping
|
19
20
|
|
20
21
|
== Example use
|
21
22
|
|
@@ -31,13 +32,17 @@ test.watchr
|
|
31
32
|
=== Configuration options
|
32
33
|
* command
|
33
34
|
* An ERB template for the command
|
34
|
-
* Default: <tt>"<%= ruby %> -I<%= include %> <%= predicate %>"</tt>
|
35
|
+
* Default: <tt>"<%= ruby %> -I<%= include %> <% list_of_requires.each { |lib| %>-r<%= lib %> <% } %><%= predicate %>"</tt>
|
35
36
|
* ruby
|
36
37
|
* The ruby executable to use
|
37
38
|
* Default: <tt>"ruby"</tt>
|
38
39
|
* include
|
39
40
|
* Paths to include (with -I)
|
40
41
|
* Default: <tt>".:#{self.lib_dir}:#{self.test_dir}"</tt>
|
42
|
+
* require
|
43
|
+
* Libraries to include (with -r)
|
44
|
+
* Can either be a string or an array (Ex: <tt>config.require = %w{rubygems active_support}</tt>)
|
45
|
+
* Default: <tt>nil</tt>
|
41
46
|
* lib_dir
|
42
47
|
* The lib path, where your library lives
|
43
48
|
* Default: <tt>"lib"</tt>
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.4
|
data/autowatchr.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{autowatchr}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Jeremy Stephens"]
|
12
|
-
s.date = %q{2009-10-
|
12
|
+
s.date = %q{2009-10-28}
|
13
13
|
s.description = %q{Provides some autotest-like behavior for watchr (http://github.com/mynyml/watchr).}
|
14
14
|
s.email = %q{viking415@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
data/lib/autowatchr.rb
CHANGED
@@ -2,8 +2,9 @@ require 'erb'
|
|
2
2
|
|
3
3
|
class Autowatchr
|
4
4
|
class Config
|
5
|
-
attr_writer :command, :ruby, :include, :
|
6
|
-
:test_re, :failed_results_re, :completed_re, :failing_only,
|
5
|
+
attr_writer :command, :ruby, :include, :require, :lib_dir, :test_dir,
|
6
|
+
:lib_re, :test_re, :failed_results_re, :completed_re, :failing_only,
|
7
|
+
:run_suite
|
7
8
|
|
8
9
|
def initialize(options = {})
|
9
10
|
@failing_only = @run_suite = true
|
@@ -17,7 +18,7 @@ class Autowatchr
|
|
17
18
|
end
|
18
19
|
|
19
20
|
def command
|
20
|
-
@command ||= "<%= ruby %> -I<%= include %> <%= predicate %>"
|
21
|
+
@command ||= "<%= ruby %> -I<%= include %> <% list_of_requires.each { |lib| %>-r<%= lib %> <% } %><%= predicate %>"
|
21
22
|
end
|
22
23
|
|
23
24
|
def ruby
|
@@ -28,6 +29,20 @@ class Autowatchr
|
|
28
29
|
@include ||= ".:#{self.lib_dir}:#{self.test_dir}"
|
29
30
|
end
|
30
31
|
|
32
|
+
def require
|
33
|
+
@require
|
34
|
+
end
|
35
|
+
|
36
|
+
def list_of_requires
|
37
|
+
if @require.nil? || @require.empty?
|
38
|
+
[]
|
39
|
+
elsif @require.is_a?(Array)
|
40
|
+
@require
|
41
|
+
else
|
42
|
+
[@require]
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
31
46
|
def lib_dir
|
32
47
|
@lib_dir ||= "lib"
|
33
48
|
end
|
data/test/helper.rb
CHANGED
data/test/test_autowatchr.rb
CHANGED
@@ -63,6 +63,7 @@ class TestAutowatchr < Test::Unit::TestCase
|
|
63
63
|
end
|
64
64
|
assert_equal "ruby", aw.config.ruby
|
65
65
|
assert_equal ".:lib:test", aw.config.include
|
66
|
+
assert_equal nil, aw.config.require
|
66
67
|
assert_equal "lib", aw.config.lib_dir
|
67
68
|
assert_equal "test", aw.config.test_dir
|
68
69
|
assert_equal '^lib.*/.*\.rb$', aw.config.lib_re
|
@@ -95,6 +96,26 @@ class TestAutowatchr < Test::Unit::TestCase
|
|
95
96
|
end
|
96
97
|
end
|
97
98
|
|
99
|
+
def test_run_lib_file_with_require
|
100
|
+
expected_cmd = "/usr/local/bin/ruby -I.:#{@lib_dir}:#{@test_dir} -rrubygems #{@test_dir}/test_foo.rb"
|
101
|
+
Autowatchr.any_instance.expects_system_call(expected_cmd, "foo")
|
102
|
+
|
103
|
+
silence_stream(STDOUT) do
|
104
|
+
aw = new_autowatchr(:require => 'rubygems')
|
105
|
+
aw.run_lib_file("#{@lib_dir}/foo.rb")
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
def test_run_lib_file_with_mulitple_requires
|
110
|
+
expected_cmd = "/usr/local/bin/ruby -I.:#{@lib_dir}:#{@test_dir} -rrubygems -rblah #{@test_dir}/test_foo.rb"
|
111
|
+
Autowatchr.any_instance.expects_system_call(expected_cmd, "foo")
|
112
|
+
|
113
|
+
silence_stream(STDOUT) do
|
114
|
+
aw = new_autowatchr(:require => %w{rubygems blah})
|
115
|
+
aw.run_lib_file("#{@lib_dir}/foo.rb")
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
98
119
|
def test_running_multiple_test_files
|
99
120
|
expected_cmd = "/usr/local/bin/ruby -I.:#{@lib_dir}:#{@test_dir} -e \"%w[#{@test_dir}/test_bar.rb #{@test_dir}/test_foo.rb].each do |f| require f end\""
|
100
121
|
Autowatchr.any_instance.expects_system_call(expected_cmd, "all")
|
data/test.watchr
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: autowatchr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Stephens
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-10-
|
12
|
+
date: 2009-10-28 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|