loris 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/README.rdoc +9 -0
- data/Rakefile +41 -0
- data/TODO +21 -0
- data/VERSION +1 -0
- data/bin/loris +15 -0
- data/cucumber.yml +1 -0
- data/examples/self_test/jsl.conf +1 -0
- data/examples/self_test/spec/spec.rhino.js +6 -0
- data/features/javascript_lint.feature +34 -0
- data/features/run.feature +36 -0
- data/features/step_definitons/all.rb +69 -0
- data/features/support/env.rb +145 -0
- data/lib/always_continuer.rb +7 -0
- data/lib/browser_finder.rb +23 -0
- data/lib/file_actioner.rb +16 -0
- data/lib/file_finder.rb +31 -0
- data/lib/filters/ends_with_filter.rb +17 -0
- data/lib/filters/extension_filter.rb +20 -0
- data/lib/filters/file_filter.rb +14 -0
- data/lib/filters/modified_filter.rb +21 -0
- data/lib/icons/error.png +0 -0
- data/lib/icons/failure.png +0 -0
- data/lib/icons/info.png +0 -0
- data/lib/icons/success.png +0 -0
- data/lib/icons/warning.png +0 -0
- data/lib/js-test-driver/JsTestDriver-1.1.jar +0 -0
- data/lib/js-test-driver/plugins/coverage-1.1.jar +0 -0
- data/lib/loris.rb +170 -0
- data/lib/outputs/growl_output.rb +26 -0
- data/lib/outputs/output_collection.rb +23 -0
- data/lib/outputs/shell_output.rb +17 -0
- data/lib/outputs/unix_console_clearing_output.rb +13 -0
- data/lib/outputs/windows_console_clearing_output.rb +13 -0
- data/lib/pinger.rb +23 -0
- data/lib/poller.rb +16 -0
- data/lib/sleep_waiter.rb +11 -0
- data/lib/task_manager.rb +45 -0
- data/lib/tasks/command_line_task.rb +28 -0
- data/lib/tasks/javascript_lint/javascript_lint_parser.rb +45 -0
- data/lib/tasks/javascript_lint/javascript_lint_runner.rb +25 -0
- data/lib/tasks/js_test_driver/js_test_driver_config.rb +22 -0
- data/lib/tasks/js_test_driver/js_test_driver_parser.rb +28 -0
- data/lib/tasks/js_test_driver/js_test_driver_runner.rb +28 -0
- data/lib/tasks/js_test_driver/js_test_driver_server.rb +38 -0
- data/lib/tasks/jspec/jspec_parser.rb +30 -0
- data/lib/tasks/jspec/jspec_runner.rb +25 -0
- data/lib/tasks/list_task.rb +34 -0
- data/lib/tasks/rspec/rspec_parser.rb +25 -0
- data/lib/tasks/rspec/rspec_runner.rb +25 -0
- data/lib/unix_process.rb +7 -0
- data/lib/windows_process.rb +12 -0
- data/loris.gemspec +133 -0
- data/loris.tmproj +232 -0
- data/spec/file_actioner_spec.rb +41 -0
- data/spec/file_finder_spec.rb +73 -0
- data/spec/filters/ends_with_filter_spec.rb +26 -0
- data/spec/filters/file_filter_spec.rb +28 -0
- data/spec/filters/modified_filter_spec.rb +47 -0
- data/spec/growl_output_spec.rb +33 -0
- data/spec/list_task_spec.rb +58 -0
- data/spec/poller_spec.rb +28 -0
- data/spec/shell_output_spec.rb +25 -0
- data/spec/task_manager_spec.rb +64 -0
- data/spec/tasks/javascript_lint/javascript_lint_runner_spec.rb +90 -0
- data/spec/tasks/js_test_driver/js_test_driver_runner_spec.rb +92 -0
- data/spec/tasks/jspec/jspec_parser_spec.rb +28 -0
- data/spec/tasks/jspec/jspec_runner_spec.rb +78 -0
- metadata +174 -0
@@ -0,0 +1,25 @@
|
|
1
|
+
class RSpecParser
|
2
|
+
|
3
|
+
def parse_result(detail)
|
4
|
+
summary_line = detail.grep( /\d+ examples?, \d+ failures?/ )[0]
|
5
|
+
|
6
|
+
if summary_line.nil?
|
7
|
+
# error
|
8
|
+
error_info = (detail + "\nUnknown Error!").to_a[0].strip
|
9
|
+
return :error, 'Error', error_info
|
10
|
+
end
|
11
|
+
|
12
|
+
if summary_line =~ /([1-9]+) failures?/
|
13
|
+
num_errors = $1
|
14
|
+
|
15
|
+
items = detail.split("\n\n")
|
16
|
+
|
17
|
+
error_info = items[1].split("\n")[1]
|
18
|
+
return :failure, num_errors + ' Errors', error_info
|
19
|
+
end
|
20
|
+
|
21
|
+
return :success, 'All specs pass', ''
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
class RSpecRunner
|
2
|
+
|
3
|
+
def initialize(dir, ruby_filter, spec_filter)
|
4
|
+
@dir = dir
|
5
|
+
@ruby_filter = ruby_filter
|
6
|
+
@spec_filter = spec_filter
|
7
|
+
end
|
8
|
+
|
9
|
+
def name
|
10
|
+
return 'RSpec'
|
11
|
+
end
|
12
|
+
|
13
|
+
def execute
|
14
|
+
return `spec . 2>&1`
|
15
|
+
end
|
16
|
+
|
17
|
+
def is_configured?(all_files)
|
18
|
+
return !(all_files.detect { |file| @spec_filter.filter(file) }).nil?
|
19
|
+
end
|
20
|
+
|
21
|
+
def should_run?(modified_files)
|
22
|
+
return !(modified_files.detect { |file| @ruby_filter.filter(file) }).nil?
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
data/lib/unix_process.rb
ADDED
data/loris.gemspec
ADDED
@@ -0,0 +1,133 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{loris}
|
8
|
+
s.version = "0.0.12"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Karl O'Keeffe"]
|
12
|
+
s.date = %q{2009-10-02}
|
13
|
+
s.default_executable = %q{loris}
|
14
|
+
s.description = %q{Automatically run javascript unit tests}
|
15
|
+
s.email = %q{loris@monket.net}
|
16
|
+
s.executables = ["loris"]
|
17
|
+
s.extra_rdoc_files = [
|
18
|
+
"README.rdoc"
|
19
|
+
]
|
20
|
+
s.files = [
|
21
|
+
".gitignore",
|
22
|
+
"README.rdoc",
|
23
|
+
"Rakefile",
|
24
|
+
"TODO",
|
25
|
+
"VERSION",
|
26
|
+
"bin/loris",
|
27
|
+
"cucumber.yml",
|
28
|
+
"examples/self_test/jsl.conf",
|
29
|
+
"examples/self_test/spec/spec.rhino.js",
|
30
|
+
"features/javascript_lint.feature",
|
31
|
+
"features/run.feature",
|
32
|
+
"features/step_definitons/all.rb",
|
33
|
+
"features/support/env.rb",
|
34
|
+
"lib/always_continuer.rb",
|
35
|
+
"lib/browser_finder.rb",
|
36
|
+
"lib/file_actioner.rb",
|
37
|
+
"lib/file_finder.rb",
|
38
|
+
"lib/filters/ends_with_filter.rb",
|
39
|
+
"lib/filters/extension_filter.rb",
|
40
|
+
"lib/filters/file_filter.rb",
|
41
|
+
"lib/filters/modified_filter.rb",
|
42
|
+
"lib/icons/error.png",
|
43
|
+
"lib/icons/failure.png",
|
44
|
+
"lib/icons/info.png",
|
45
|
+
"lib/icons/success.png",
|
46
|
+
"lib/icons/warning.png",
|
47
|
+
"lib/js-test-driver/JsTestDriver-1.1.jar",
|
48
|
+
"lib/js-test-driver/plugins/coverage-1.1.jar",
|
49
|
+
"lib/loris.rb",
|
50
|
+
"lib/outputs/growl_output.rb",
|
51
|
+
"lib/outputs/output_collection.rb",
|
52
|
+
"lib/outputs/shell_output.rb",
|
53
|
+
"lib/outputs/unix_console_clearing_output.rb",
|
54
|
+
"lib/outputs/windows_console_clearing_output.rb",
|
55
|
+
"lib/pinger.rb",
|
56
|
+
"lib/poller.rb",
|
57
|
+
"lib/sleep_waiter.rb",
|
58
|
+
"lib/task_manager.rb",
|
59
|
+
"lib/tasks/command_line_task.rb",
|
60
|
+
"lib/tasks/javascript_lint/javascript_lint_parser.rb",
|
61
|
+
"lib/tasks/javascript_lint/javascript_lint_runner.rb",
|
62
|
+
"lib/tasks/js_test_driver/js_test_driver_config.rb",
|
63
|
+
"lib/tasks/js_test_driver/js_test_driver_parser.rb",
|
64
|
+
"lib/tasks/js_test_driver/js_test_driver_runner.rb",
|
65
|
+
"lib/tasks/js_test_driver/js_test_driver_server.rb",
|
66
|
+
"lib/tasks/jspec/jspec_parser.rb",
|
67
|
+
"lib/tasks/jspec/jspec_runner.rb",
|
68
|
+
"lib/tasks/list_task.rb",
|
69
|
+
"lib/tasks/rspec/rspec_parser.rb",
|
70
|
+
"lib/tasks/rspec/rspec_runner.rb",
|
71
|
+
"lib/unix_process.rb",
|
72
|
+
"lib/windows_process.rb",
|
73
|
+
"loris.gemspec",
|
74
|
+
"loris.tmproj",
|
75
|
+
"spec/file_actioner_spec.rb",
|
76
|
+
"spec/file_finder_spec.rb",
|
77
|
+
"spec/filters/ends_with_filter_spec.rb",
|
78
|
+
"spec/filters/file_filter_spec.rb",
|
79
|
+
"spec/filters/modified_filter_spec.rb",
|
80
|
+
"spec/growl_output_spec.rb",
|
81
|
+
"spec/list_task_spec.rb",
|
82
|
+
"spec/poller_spec.rb",
|
83
|
+
"spec/shell_output_spec.rb",
|
84
|
+
"spec/task_manager_spec.rb",
|
85
|
+
"spec/tasks/javascript_lint/javascript_lint_runner_spec.rb",
|
86
|
+
"spec/tasks/js_test_driver/js_test_driver_runner_spec.rb",
|
87
|
+
"spec/tasks/jspec/jspec_parser_spec.rb",
|
88
|
+
"spec/tasks/jspec/jspec_runner_spec.rb"
|
89
|
+
]
|
90
|
+
s.homepage = %q{http://github.com/karl/loris}
|
91
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
92
|
+
s.require_paths = ["lib"]
|
93
|
+
s.rubygems_version = %q{1.3.5}
|
94
|
+
s.summary = %q{Automatically run javascript unit tests}
|
95
|
+
s.test_files = [
|
96
|
+
"spec/file_actioner_spec.rb",
|
97
|
+
"spec/file_finder_spec.rb",
|
98
|
+
"spec/filters/ends_with_filter_spec.rb",
|
99
|
+
"spec/filters/file_filter_spec.rb",
|
100
|
+
"spec/filters/modified_filter_spec.rb",
|
101
|
+
"spec/growl_output_spec.rb",
|
102
|
+
"spec/list_task_spec.rb",
|
103
|
+
"spec/poller_spec.rb",
|
104
|
+
"spec/shell_output_spec.rb",
|
105
|
+
"spec/task_manager_spec.rb",
|
106
|
+
"spec/tasks/javascript_lint/javascript_lint_runner_spec.rb",
|
107
|
+
"spec/tasks/js_test_driver/js_test_driver_runner_spec.rb",
|
108
|
+
"spec/tasks/jspec/jspec_parser_spec.rb",
|
109
|
+
"spec/tasks/jspec/jspec_runner_spec.rb"
|
110
|
+
]
|
111
|
+
|
112
|
+
if s.respond_to? :specification_version then
|
113
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
114
|
+
s.specification_version = 3
|
115
|
+
|
116
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
117
|
+
s.add_runtime_dependency(%q<visionmedia-bind>, [">= 0.2.6"])
|
118
|
+
s.add_runtime_dependency(%q<karl-growl>, [">= 1.0.3"])
|
119
|
+
s.add_runtime_dependency(%q<extensions>, [">= 0.6.0"])
|
120
|
+
s.add_runtime_dependency(%q<win32-process>, [">= 0.6.1"])
|
121
|
+
else
|
122
|
+
s.add_dependency(%q<visionmedia-bind>, [">= 0.2.6"])
|
123
|
+
s.add_dependency(%q<karl-growl>, [">= 1.0.3"])
|
124
|
+
s.add_dependency(%q<extensions>, [">= 0.6.0"])
|
125
|
+
s.add_dependency(%q<win32-process>, [">= 0.6.1"])
|
126
|
+
end
|
127
|
+
else
|
128
|
+
s.add_dependency(%q<visionmedia-bind>, [">= 0.2.6"])
|
129
|
+
s.add_dependency(%q<karl-growl>, [">= 1.0.3"])
|
130
|
+
s.add_dependency(%q<extensions>, [">= 0.6.0"])
|
131
|
+
s.add_dependency(%q<win32-process>, [">= 0.6.1"])
|
132
|
+
end
|
133
|
+
end
|
data/loris.tmproj
ADDED
@@ -0,0 +1,232 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
3
|
+
<plist version="1.0">
|
4
|
+
<dict>
|
5
|
+
<key>currentDocument</key>
|
6
|
+
<string>Rakefile</string>
|
7
|
+
<key>documents</key>
|
8
|
+
<array>
|
9
|
+
<dict>
|
10
|
+
<key>expanded</key>
|
11
|
+
<true/>
|
12
|
+
<key>name</key>
|
13
|
+
<string>loris</string>
|
14
|
+
<key>regexFolderFilter</key>
|
15
|
+
<string>!.*/(\.[^/]*|CVS|_darcs|_MTN|\{arch\}|blib|.*~\.nib|.*\.(framework|app|pbproj|pbxproj|xcode(proj)?|bundle))$</string>
|
16
|
+
<key>selected</key>
|
17
|
+
<true/>
|
18
|
+
<key>sourceDirectory</key>
|
19
|
+
<string></string>
|
20
|
+
</dict>
|
21
|
+
</array>
|
22
|
+
<key>fileHierarchyDrawerWidth</key>
|
23
|
+
<integer>200</integer>
|
24
|
+
<key>metaData</key>
|
25
|
+
<dict>
|
26
|
+
<key>README.rdoc</key>
|
27
|
+
<dict>
|
28
|
+
<key>caret</key>
|
29
|
+
<dict>
|
30
|
+
<key>column</key>
|
31
|
+
<integer>71</integer>
|
32
|
+
<key>line</key>
|
33
|
+
<integer>2</integer>
|
34
|
+
</dict>
|
35
|
+
<key>firstVisibleColumn</key>
|
36
|
+
<integer>0</integer>
|
37
|
+
<key>firstVisibleLine</key>
|
38
|
+
<integer>0</integer>
|
39
|
+
</dict>
|
40
|
+
<key>Rakefile</key>
|
41
|
+
<dict>
|
42
|
+
<key>caret</key>
|
43
|
+
<dict>
|
44
|
+
<key>column</key>
|
45
|
+
<integer>5</integer>
|
46
|
+
<key>line</key>
|
47
|
+
<integer>3</integer>
|
48
|
+
</dict>
|
49
|
+
<key>firstVisibleColumn</key>
|
50
|
+
<integer>0</integer>
|
51
|
+
<key>firstVisibleLine</key>
|
52
|
+
<integer>0</integer>
|
53
|
+
</dict>
|
54
|
+
<key>TODO</key>
|
55
|
+
<dict>
|
56
|
+
<key>caret</key>
|
57
|
+
<dict>
|
58
|
+
<key>column</key>
|
59
|
+
<integer>0</integer>
|
60
|
+
<key>line</key>
|
61
|
+
<integer>14</integer>
|
62
|
+
</dict>
|
63
|
+
<key>firstVisibleColumn</key>
|
64
|
+
<integer>0</integer>
|
65
|
+
<key>firstVisibleLine</key>
|
66
|
+
<integer>0</integer>
|
67
|
+
</dict>
|
68
|
+
<key>lib/filters/ends_with_filter.rb</key>
|
69
|
+
<dict>
|
70
|
+
<key>caret</key>
|
71
|
+
<dict>
|
72
|
+
<key>column</key>
|
73
|
+
<integer>29</integer>
|
74
|
+
<key>line</key>
|
75
|
+
<integer>9</integer>
|
76
|
+
</dict>
|
77
|
+
<key>firstVisibleColumn</key>
|
78
|
+
<integer>0</integer>
|
79
|
+
<key>firstVisibleLine</key>
|
80
|
+
<integer>0</integer>
|
81
|
+
</dict>
|
82
|
+
<key>lib/filters/extension_filter.rb</key>
|
83
|
+
<dict>
|
84
|
+
<key>caret</key>
|
85
|
+
<dict>
|
86
|
+
<key>column</key>
|
87
|
+
<integer>3</integer>
|
88
|
+
<key>line</key>
|
89
|
+
<integer>19</integer>
|
90
|
+
</dict>
|
91
|
+
<key>columnSelection</key>
|
92
|
+
<false/>
|
93
|
+
<key>firstVisibleColumn</key>
|
94
|
+
<integer>0</integer>
|
95
|
+
<key>firstVisibleLine</key>
|
96
|
+
<integer>0</integer>
|
97
|
+
<key>selectFrom</key>
|
98
|
+
<dict>
|
99
|
+
<key>column</key>
|
100
|
+
<integer>0</integer>
|
101
|
+
<key>line</key>
|
102
|
+
<integer>0</integer>
|
103
|
+
</dict>
|
104
|
+
<key>selectTo</key>
|
105
|
+
<dict>
|
106
|
+
<key>column</key>
|
107
|
+
<integer>3</integer>
|
108
|
+
<key>line</key>
|
109
|
+
<integer>19</integer>
|
110
|
+
</dict>
|
111
|
+
</dict>
|
112
|
+
<key>lib/filters/file_filter.rb</key>
|
113
|
+
<dict>
|
114
|
+
<key>caret</key>
|
115
|
+
<dict>
|
116
|
+
<key>column</key>
|
117
|
+
<integer>0</integer>
|
118
|
+
<key>line</key>
|
119
|
+
<integer>7</integer>
|
120
|
+
</dict>
|
121
|
+
<key>columnSelection</key>
|
122
|
+
<false/>
|
123
|
+
<key>firstVisibleColumn</key>
|
124
|
+
<integer>0</integer>
|
125
|
+
<key>firstVisibleLine</key>
|
126
|
+
<integer>0</integer>
|
127
|
+
<key>selectFrom</key>
|
128
|
+
<dict>
|
129
|
+
<key>column</key>
|
130
|
+
<integer>33</integer>
|
131
|
+
<key>line</key>
|
132
|
+
<integer>7</integer>
|
133
|
+
</dict>
|
134
|
+
<key>selectTo</key>
|
135
|
+
<dict>
|
136
|
+
<key>column</key>
|
137
|
+
<integer>0</integer>
|
138
|
+
<key>line</key>
|
139
|
+
<integer>7</integer>
|
140
|
+
</dict>
|
141
|
+
</dict>
|
142
|
+
<key>lib/filters/modified_filter.rb</key>
|
143
|
+
<dict>
|
144
|
+
<key>caret</key>
|
145
|
+
<dict>
|
146
|
+
<key>column</key>
|
147
|
+
<integer>0</integer>
|
148
|
+
<key>line</key>
|
149
|
+
<integer>4</integer>
|
150
|
+
</dict>
|
151
|
+
<key>firstVisibleColumn</key>
|
152
|
+
<integer>0</integer>
|
153
|
+
<key>firstVisibleLine</key>
|
154
|
+
<integer>0</integer>
|
155
|
+
</dict>
|
156
|
+
<key>lib/loris.rb</key>
|
157
|
+
<dict>
|
158
|
+
<key>caret</key>
|
159
|
+
<dict>
|
160
|
+
<key>column</key>
|
161
|
+
<integer>78</integer>
|
162
|
+
<key>line</key>
|
163
|
+
<integer>101</integer>
|
164
|
+
</dict>
|
165
|
+
<key>firstVisibleColumn</key>
|
166
|
+
<integer>0</integer>
|
167
|
+
<key>firstVisibleLine</key>
|
168
|
+
<integer>73</integer>
|
169
|
+
</dict>
|
170
|
+
<key>lib/tasks/rspec/rspec_runner.rb</key>
|
171
|
+
<dict>
|
172
|
+
<key>caret</key>
|
173
|
+
<dict>
|
174
|
+
<key>column</key>
|
175
|
+
<integer>61</integer>
|
176
|
+
<key>line</key>
|
177
|
+
<integer>13</integer>
|
178
|
+
</dict>
|
179
|
+
<key>firstVisibleColumn</key>
|
180
|
+
<integer>0</integer>
|
181
|
+
<key>firstVisibleLine</key>
|
182
|
+
<integer>0</integer>
|
183
|
+
</dict>
|
184
|
+
<key>lib/tasks/rspec/rspec_task.rb</key>
|
185
|
+
<dict>
|
186
|
+
<key>caret</key>
|
187
|
+
<dict>
|
188
|
+
<key>column</key>
|
189
|
+
<integer>42</integer>
|
190
|
+
<key>line</key>
|
191
|
+
<integer>41</integer>
|
192
|
+
</dict>
|
193
|
+
<key>firstVisibleColumn</key>
|
194
|
+
<integer>0</integer>
|
195
|
+
<key>firstVisibleLine</key>
|
196
|
+
<integer>0</integer>
|
197
|
+
</dict>
|
198
|
+
<key>spec/filters/ends_with_filter_spec.rb</key>
|
199
|
+
<dict>
|
200
|
+
<key>caret</key>
|
201
|
+
<dict>
|
202
|
+
<key>column</key>
|
203
|
+
<integer>43</integer>
|
204
|
+
<key>line</key>
|
205
|
+
<integer>9</integer>
|
206
|
+
</dict>
|
207
|
+
<key>firstVisibleColumn</key>
|
208
|
+
<integer>0</integer>
|
209
|
+
<key>firstVisibleLine</key>
|
210
|
+
<integer>0</integer>
|
211
|
+
</dict>
|
212
|
+
</dict>
|
213
|
+
<key>openDocuments</key>
|
214
|
+
<array>
|
215
|
+
<string>TODO</string>
|
216
|
+
<string>README.rdoc</string>
|
217
|
+
<string>lib/tasks/rspec/rspec_task.rb</string>
|
218
|
+
<string>lib/tasks/rspec/rspec_runner.rb</string>
|
219
|
+
<string>lib/filters/ends_with_filter.rb</string>
|
220
|
+
<string>Rakefile</string>
|
221
|
+
<string>spec/filters/ends_with_filter_spec.rb</string>
|
222
|
+
<string>lib/loris.rb</string>
|
223
|
+
<string>lib/filters/modified_filter.rb</string>
|
224
|
+
<string>lib/filters/file_filter.rb</string>
|
225
|
+
<string>lib/filters/extension_filter.rb</string>
|
226
|
+
</array>
|
227
|
+
<key>showFileHierarchyDrawer</key>
|
228
|
+
<false/>
|
229
|
+
<key>windowFrame</key>
|
230
|
+
<string>{{0, 0}, {1436, 878}}</string>
|
231
|
+
</dict>
|
232
|
+
</plist>
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'lib/file_actioner.rb'
|
2
|
+
|
3
|
+
describe FileActioner do
|
4
|
+
|
5
|
+
it "Should get filtered files and send them to action" do
|
6
|
+
files = {
|
7
|
+
:all => ['/path/to.file'],
|
8
|
+
:filtered => ['/path/to.file']
|
9
|
+
}
|
10
|
+
|
11
|
+
ff = mock('file finder')
|
12
|
+
ff.should_receive(:find).and_return(files)
|
13
|
+
|
14
|
+
tm = mock('TaskManager')
|
15
|
+
tm.should_receive(:run).with(files)
|
16
|
+
|
17
|
+
fa = FileActioner.new(ff, tm)
|
18
|
+
fa.run
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should not run the actions if no filtered files" do
|
23
|
+
files = {
|
24
|
+
:all => ['/path/to.file'],
|
25
|
+
:filtered => []
|
26
|
+
}
|
27
|
+
|
28
|
+
ff = mock('file finder')
|
29
|
+
ff.should_receive(:find).and_return(files)
|
30
|
+
|
31
|
+
tm = mock('TaskManager')
|
32
|
+
tm.should_not_receive(:run)
|
33
|
+
|
34
|
+
fa = FileActioner.new(ff, tm)
|
35
|
+
fa.run
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
|
@@ -0,0 +1,73 @@
|
|
1
|
+
require 'lib/file_finder'
|
2
|
+
|
3
|
+
describe FileFinder do
|
4
|
+
|
5
|
+
before do
|
6
|
+
finder = mock('finder')
|
7
|
+
finder.should_receive(:find).with('/monkey').and_yield('/monkey/modified.txt').and_yield('/monkey/modified-2.txt').and_yield('/monkey/not-modified.txt')
|
8
|
+
|
9
|
+
@filter = mock('filter')
|
10
|
+
@filter.should_receive(:filter).at_most(1).with('/monkey/modified.txt').and_return(true)
|
11
|
+
@filter.should_receive(:filter).at_most(1).with('/monkey/modified-2.txt').and_return(true)
|
12
|
+
@filter.should_receive(:filter).at_most(1).with('/monkey/not-modified.txt').and_return(false)
|
13
|
+
|
14
|
+
@filter2 = mock('filter')
|
15
|
+
@filter2.should_receive(:filter).at_most(1).with('/monkey/modified.txt').and_return(true)
|
16
|
+
@filter2.should_receive(:filter).at_most(1).with('/monkey/modified-2.txt').and_return(false)
|
17
|
+
@filter2.should_receive(:filter).at_most(1).with('/monkey/not-modified.txt').and_return(true)
|
18
|
+
|
19
|
+
dir = '/monkey'
|
20
|
+
@ff = FileFinder.new(finder, dir)
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'with no filters, should return all files' do
|
24
|
+
result = {
|
25
|
+
:all => ['/monkey/modified.txt', '/monkey/modified-2.txt', '/monkey/not-modified.txt'],
|
26
|
+
:filtered => ['/monkey/modified.txt', '/monkey/modified-2.txt', '/monkey/not-modified.txt']
|
27
|
+
}
|
28
|
+
|
29
|
+
files = @ff.find
|
30
|
+
files.should == result
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'with filter, should return only filtered' do
|
34
|
+
result = {
|
35
|
+
:all => ['/monkey/modified.txt', '/monkey/modified-2.txt', '/monkey/not-modified.txt'],
|
36
|
+
:filtered => ['/monkey/modified.txt', '/monkey/modified-2.txt']
|
37
|
+
}
|
38
|
+
|
39
|
+
@filter.should_receive(:complete)
|
40
|
+
|
41
|
+
@ff.add_filter(@filter)
|
42
|
+
files = @ff.find
|
43
|
+
|
44
|
+
files.should == result
|
45
|
+
end
|
46
|
+
|
47
|
+
it 'should be able to accept multiple filters' do
|
48
|
+
result = {
|
49
|
+
:all => ['/monkey/modified.txt', '/monkey/modified-2.txt', '/monkey/not-modified.txt'],
|
50
|
+
:filtered => ['/monkey/modified.txt']
|
51
|
+
}
|
52
|
+
|
53
|
+
@filter.should_receive(:complete)
|
54
|
+
@filter2.should_receive(:complete)
|
55
|
+
|
56
|
+
@ff.add_filter(@filter)
|
57
|
+
@ff.add_filter(@filter2)
|
58
|
+
files = @ff.find
|
59
|
+
|
60
|
+
files.should == result
|
61
|
+
end
|
62
|
+
|
63
|
+
it 'should call filter.complete methods at the end of find' do
|
64
|
+
@filter.should_receive(:complete)
|
65
|
+
@filter2.should_receive(:complete)
|
66
|
+
|
67
|
+
@ff.add_filter(@filter)
|
68
|
+
@ff.add_filter(@filter2)
|
69
|
+
files = @ff.find
|
70
|
+
|
71
|
+
end
|
72
|
+
|
73
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'lib/filters/ends_with_filter'
|
2
|
+
|
3
|
+
describe EndsWithFilter do
|
4
|
+
|
5
|
+
before do
|
6
|
+
end
|
7
|
+
|
8
|
+
it 'should return true if ends with text' do
|
9
|
+
@path = '/path/to/file_spec.rb'
|
10
|
+
filter = EndsWithFilter.new('_spec.rb')
|
11
|
+
filter.filter(@path).should be_true
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'should return true if ends with text in a different case' do
|
15
|
+
@path = '/path/to/file_Spec.RB'
|
16
|
+
filter = EndsWithFilter.new('_spec.rb')
|
17
|
+
filter.filter(@path).should be_true
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'should return false if does not end with text' do
|
21
|
+
@path = '/path/to/file_spec.rbx'
|
22
|
+
filter = EndsWithFilter.new('_spec.rb')
|
23
|
+
filter.filter(@path).should be_false
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'lib/filters/file_filter'
|
2
|
+
|
3
|
+
describe FileFilter do
|
4
|
+
|
5
|
+
before do
|
6
|
+
end
|
7
|
+
|
8
|
+
it 'should return true if a file' do
|
9
|
+
@path = '/path/to.file'
|
10
|
+
@file = mock('File class')
|
11
|
+
@file.should_receive(:file?).with(@path).and_return(true)
|
12
|
+
|
13
|
+
filter = FileFilter.new(@file)
|
14
|
+
|
15
|
+
filter.filter(@path).should be_true
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'should return false if a directory' do
|
19
|
+
@path = '/path/to/dir'
|
20
|
+
@file = mock('File class')
|
21
|
+
@file.should_receive(:file?).with(@path).and_return(false)
|
22
|
+
|
23
|
+
filter = FileFilter.new(@file)
|
24
|
+
|
25
|
+
filter.filter(@path).should be_false
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'lib/filters/modified_filter'
|
2
|
+
require 'time'
|
3
|
+
|
4
|
+
describe ModifiedFilter do
|
5
|
+
|
6
|
+
before do
|
7
|
+
@path = '/path/to.file'
|
8
|
+
@file = mock('File class')
|
9
|
+
@file.should_receive(:mtime).any_number_of_times.with(@path).and_return(Time.parse('2000/01/01'))
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'should return true if no last modified date set' do
|
13
|
+
filter = ModifiedFilter.new(@file)
|
14
|
+
|
15
|
+
filter.filter(@path).should be_true
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'should return false if file modified before given last modified date' do
|
19
|
+
last_modified = Time.parse('2000/01/02')
|
20
|
+
filter = ModifiedFilter.new(@file, last_modified)
|
21
|
+
|
22
|
+
filter.filter(@path).should be_false
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'should remember the last modified date on complete method' do
|
26
|
+
filter = ModifiedFilter.new(@file)
|
27
|
+
filter.filter(@path)
|
28
|
+
|
29
|
+
filter.complete
|
30
|
+
|
31
|
+
filter.filter(@path).should be_false
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'should remember the last modified date and recognise changed date on file' do
|
35
|
+
@file = mock('File class')
|
36
|
+
@file.should_receive(:mtime).with(@path).and_return(Time.parse('2000/01/01'))
|
37
|
+
@file.should_receive(:mtime).with(@path).and_return(Time.parse('2000/01/03'))
|
38
|
+
|
39
|
+
filter = ModifiedFilter.new(@file)
|
40
|
+
filter.filter(@path)
|
41
|
+
|
42
|
+
filter.complete
|
43
|
+
|
44
|
+
filter.filter(@path).should be_true
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'lib/outputs/growl_output.rb'
|
2
|
+
|
3
|
+
describe GrowlOutput do
|
4
|
+
|
5
|
+
it "should not notify if growl is not installed" do
|
6
|
+
result = {}
|
7
|
+
|
8
|
+
growl = mock('Growl')
|
9
|
+
growl.should_receive(:installed?).and_return(false)
|
10
|
+
|
11
|
+
growl_output = GrowlOutput.new(growl)
|
12
|
+
growl_output.add_result(result)
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should call original add_result method" do
|
16
|
+
result = {
|
17
|
+
:state => :success,
|
18
|
+
:title => 'Example Title',
|
19
|
+
:summary => 'Example Summary',
|
20
|
+
:detail => 'Detail goes here...'
|
21
|
+
}
|
22
|
+
|
23
|
+
growl = mock('Growl')
|
24
|
+
growl.should_receive(:installed?).and_return(true)
|
25
|
+
growl.should_receive(:notify)
|
26
|
+
|
27
|
+
growl_output = GrowlOutput.new(growl)
|
28
|
+
growl_output.add_result(result)
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
|