tdd 1.0.2 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.rvmrc +1 -0
- data/README.md +5 -2
- data/bin/tdd +36 -19
- data/lib/tdd/command_line_parser.rb +14 -8
- data/lib/tdd/version.rb +1 -1
- metadata +48 -70
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 20e79babe2b62d70cb06aae7b1c682df2e11fdf8
|
4
|
+
data.tar.gz: 564fe1b94cbbbc28b344971933b52dbc95ccf982
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: abf0f3410651e706106d1a949abab7c9899392eeebb7e0ddfd8d39494def645680c94ad5cfd4aa594c1133ea4d947ea59380dfe7d2e202f671c2333ead9d083f
|
7
|
+
data.tar.gz: ad6bde4cf394d5767ea419cacf465fa67e14e6e9e26daab0e3a0dd717cd2205507ad51ce89414104707b27a2ea104d6c062f7846e5416d197bee876afbf18004
|
data/.rvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm use ruby-2.0.0-p0@tdd --create
|
data/README.md
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
tdd
|
2
2
|
===
|
3
3
|
|
4
|
+
[](http://badge.fury.io/rb/tdd)
|
5
|
+
[](https://codeclimate.com/github/ubermajestix/tdd)
|
6
|
+
|
4
7
|
Watch files and run test/unit or rspec tests when those files change.
|
5
8
|
|
6
9
|
Is it awesome?
|
@@ -28,8 +31,8 @@ Use with rake:
|
|
28
31
|
|
29
32
|
You can pass arguments you would normally pass to `ruby -Itest` or `rspec`
|
30
33
|
|
31
|
-
$ tdd test/unit/some_unit_test.rb -n /some_test_name/
|
32
|
-
$ tdd spec/some_spec.rb:42 --fail-fast
|
34
|
+
$ tdd -- test/unit/some_unit_test.rb -n /some_test_name/
|
35
|
+
$ tdd -- spec/some_spec.rb:42 --fail-fast
|
33
36
|
|
34
37
|
By default, tdd will watch files in app, lib, config, test, and spec
|
35
38
|
directories, if they exist, and run your test command if any file being
|
data/bin/tdd
CHANGED
@@ -36,33 +36,46 @@ Use with rake:
|
|
36
36
|
|
37
37
|
You can pass arguments you would normally pass to `ruby -Itest` or `rspec`
|
38
38
|
|
39
|
-
$ tdd test/unit/some_unit_test.rb -n /some_test_name/
|
40
|
-
$ tdd spec/some_spec.rb:42 --fail-fast
|
39
|
+
$ tdd -- test/unit/some_unit_test.rb -n /some_test_name/
|
40
|
+
$ tdd -- spec/some_spec.rb:42 --fail-fast
|
41
41
|
|
42
|
-
By default, tdd will
|
43
|
-
|
44
|
-
watched changes.
|
42
|
+
By default, tdd will glob for files that match your test file and run your test
|
43
|
+
command if any file being watched changes.
|
45
44
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
45
|
+
$ tdd test/unit/some_class_test.rb
|
46
|
+
Running: ruby -I test test/unit/some_class_test.rb
|
47
|
+
Watching:
|
48
|
+
/Users/ubermajestix/work/awesome_app/lib/some_class.rb
|
49
|
+
/Users/ubermajestix/work/awesome_app/test/unit/some_class_test.rb
|
50
|
+
##########################################
|
50
51
|
|
51
|
-
You can
|
52
|
-
|
52
|
+
You can specify additional files to watch (note the double dashes `--`
|
53
|
+
separating the files to watch from the test file and options):
|
53
54
|
|
54
|
-
$ tdd
|
55
|
+
$ tdd lib/other_class.rb config/setup.rb -- test/unit/some_class_test.rb -n/some_test_name/
|
56
|
+
Running: ruby -I test test/unit/some_class_test.rb -n/some_test_name/
|
57
|
+
Watching:
|
58
|
+
/Users/ubermajestix/work/awesome_app/config/setup.rb
|
59
|
+
/Users/ubermajestix/work/awesome_app/lib/some_class.rb
|
60
|
+
/Users/ubermajestix/work/awesome_app/lib/other_class.rb
|
61
|
+
/Users/ubermajestix/work/awesome_app/test/unit/some_class_test.rb
|
62
|
+
##########################################
|
55
63
|
|
56
|
-
This will look for `some_unit.rb` in your project and watch it for changes,
|
57
|
-
along with the test file.
|
58
64
|
|
59
65
|
In a Rails project you can ask tdd to watch view and controller files
|
60
66
|
related to a functional or controller test:
|
61
67
|
|
62
|
-
$ tdd controller --
|
68
|
+
$ tdd controller -- spec/controllers/users_controller_spec.rb
|
69
|
+
Running: rspec spec/controllers/users_controller_spec.rb
|
70
|
+
Watching:
|
71
|
+
/Users/ubermajestix/work/awesome_rails_app/app/controllers/users_controller.rb
|
72
|
+
/Users/ubermajestix/work/awesome_rails_app/app/views/index.html.erb
|
73
|
+
/Users/ubermajestix/work/awesome_rails_app/app/views/show.html.erb
|
74
|
+
/Users/ubermajestix/work/awesome_rails_app/app/views/edit.html.erb
|
75
|
+
/Users/ubermajestix/work/awesome_rails_app/app/views/_fields.html.erb
|
76
|
+
/Users/ubermajestix/work/awesome_rails_app/spec/controllers/users_controller_spec.rb
|
77
|
+
##########################################
|
63
78
|
|
64
|
-
will watch all view files in app/views/users, the users_controller and the
|
65
|
-
test file for changes.
|
66
79
|
|
67
80
|
__
|
68
81
|
|
@@ -98,8 +111,10 @@ test file for changes.
|
|
98
111
|
|
99
112
|
def print_a_summary_of_watched_files
|
100
113
|
puts "Running: #{ @command }"
|
101
|
-
if @paths.length >
|
102
|
-
|
114
|
+
if @paths.length > 25
|
115
|
+
current_dir = Dir.pwd
|
116
|
+
dirs = @paths.map{|p| p.gsub(Dir.pwd + "/", '').split('/').first + "/"}.uniq
|
117
|
+
puts "Watching #{@paths.length} files in #{dirs.join(' ')}"
|
103
118
|
else
|
104
119
|
puts "Watching:"
|
105
120
|
puts @paths.join("\n")
|
@@ -141,10 +156,12 @@ test file for changes.
|
|
141
156
|
cmd = entry ? @command.gsub(/@/, entry) : @command
|
142
157
|
puts line
|
143
158
|
say("# starting test run #{ n } @ #{ Time.now.strftime('%H:%M:%S') } - #{ cmd }", :color => :magenta)
|
159
|
+
# TODO if blink1 installed - change its color to purple until the tests are over
|
144
160
|
puts
|
145
161
|
system(cmd)
|
146
162
|
puts
|
147
163
|
say("# finished test run #{ n } @ #{ Time.now.strftime('%H:%M:%S') } - #{ $?.exitstatus }", :color => :yellow)
|
164
|
+
# TODO if blink1 installed - change its color to yellow and fade out after 30seconds.
|
148
165
|
puts
|
149
166
|
n.succ!
|
150
167
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
class Tdd::CommandLineParser
|
2
2
|
def self.parse
|
3
3
|
parser = self.new
|
4
|
-
[parser.paths, parser.test_command]
|
4
|
+
[parser.paths.flatten, parser.test_command]
|
5
5
|
end
|
6
6
|
|
7
7
|
attr_accessor :paths, :test_framework
|
@@ -12,11 +12,12 @@ class Tdd::CommandLineParser
|
|
12
12
|
@paths = ARGV[0 ... pos]
|
13
13
|
@test_args = ARGV[pos + 1 .. -1].join(' ')
|
14
14
|
else
|
15
|
-
@paths =
|
15
|
+
@paths = []
|
16
16
|
@test_args = ARGV[0..-1].join(' ')
|
17
17
|
end
|
18
18
|
@test_file = @test_args.scan(/^.+.rb/).first
|
19
|
-
|
19
|
+
glob_for_test_file_matches
|
20
|
+
parse_all_files_mode
|
20
21
|
parse_controller_mode
|
21
22
|
parse_test_framework
|
22
23
|
end
|
@@ -33,11 +34,16 @@ class Tdd::CommandLineParser
|
|
33
34
|
exit 1
|
34
35
|
end
|
35
36
|
|
36
|
-
def
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
37
|
+
def glob_for_test_file_matches
|
38
|
+
return unless @test_file
|
39
|
+
search = File.basename(@test_file).gsub(/(_spec|_test)/, '')
|
40
|
+
@paths << Dir.glob("**/#{search}")
|
41
|
+
@paths << @test_file
|
42
|
+
end
|
43
|
+
|
44
|
+
def parse_all_files_mode
|
45
|
+
if @paths.first == 'all'
|
46
|
+
@paths = %w[app lib config test spec]
|
41
47
|
end
|
42
48
|
end
|
43
49
|
|
data/lib/tdd/version.rb
CHANGED
metadata
CHANGED
@@ -1,63 +1,53 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: tdd
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 1
|
8
|
-
- 0
|
9
|
-
- 2
|
10
|
-
version: 1.0.2
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2.0.0
|
11
5
|
platform: ruby
|
12
|
-
authors:
|
6
|
+
authors:
|
13
7
|
- Tyler Montgomery
|
14
8
|
autorequire:
|
15
9
|
bindir: bin
|
16
10
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
11
|
+
date: 2013-04-27 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
21
14
|
name: main
|
22
|
-
|
23
|
-
|
24
|
-
none: false
|
25
|
-
requirements:
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
26
17
|
- - ~>
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
|
29
|
-
segments:
|
30
|
-
- 5
|
31
|
-
- 0
|
32
|
-
version: "5.0"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '5.0'
|
33
20
|
type: :runtime
|
34
|
-
version_requirements: *id001
|
35
|
-
- !ruby/object:Gem::Dependency
|
36
|
-
name: rb-fsevent
|
37
21
|
prerelease: false
|
38
|
-
|
39
|
-
|
40
|
-
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '5.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rb-fsevent
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
41
31
|
- - ~>
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
|
44
|
-
segments:
|
45
|
-
- 0
|
46
|
-
- 9
|
47
|
-
version: "0.9"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0.9'
|
48
34
|
type: :runtime
|
49
|
-
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0.9'
|
50
41
|
description: Fire up that tdd loop
|
51
|
-
email:
|
42
|
+
email:
|
52
43
|
- tyler.a.montgomery@gmail.com
|
53
|
-
executables:
|
44
|
+
executables:
|
54
45
|
- tdd
|
55
46
|
extensions: []
|
56
|
-
|
57
47
|
extra_rdoc_files: []
|
58
|
-
|
59
|
-
files:
|
48
|
+
files:
|
60
49
|
- .gitignore
|
50
|
+
- .rvmrc
|
61
51
|
- Gemfile
|
62
52
|
- LICENSE
|
63
53
|
- README.md
|
@@ -67,39 +57,27 @@ files:
|
|
67
57
|
- lib/tdd/command_line_parser.rb
|
68
58
|
- lib/tdd/version.rb
|
69
59
|
- tdd.gemspec
|
70
|
-
homepage:
|
60
|
+
homepage: ''
|
71
61
|
licenses: []
|
72
|
-
|
62
|
+
metadata: {}
|
73
63
|
post_install_message:
|
74
64
|
rdoc_options: []
|
75
|
-
|
76
|
-
require_paths:
|
65
|
+
require_paths:
|
77
66
|
- lib
|
78
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
none: false
|
89
|
-
requirements:
|
90
|
-
- - ">="
|
91
|
-
- !ruby/object:Gem::Version
|
92
|
-
hash: 3
|
93
|
-
segments:
|
94
|
-
- 0
|
95
|
-
version: "0"
|
67
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - '>='
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '0'
|
72
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
96
77
|
requirements: []
|
97
|
-
|
98
78
|
rubyforge_project:
|
99
|
-
rubygems_version:
|
79
|
+
rubygems_version: 2.0.0
|
100
80
|
signing_key:
|
101
|
-
specification_version:
|
102
|
-
summary:
|
81
|
+
specification_version: 4
|
82
|
+
summary: ''
|
103
83
|
test_files: []
|
104
|
-
|
105
|
-
has_rdoc:
|