loris 0.3.2 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.2
1
+ 0.4.0
data/lib/loris.rb CHANGED
@@ -29,8 +29,8 @@ require 'filters/starts_with_filter'
29
29
 
30
30
  require 'outputs/output_collection'
31
31
  require 'outputs/shell_output'
32
- require 'outputs/windows_console_clearing_output'
33
- require 'outputs/unix_console_clearing_output'
32
+ require 'outputs/windows_console_clearing_output'
33
+ require 'outputs/unix_console_clearing_output'
34
34
  require 'outputs/growl_output'
35
35
 
36
36
  require 'tasks/list_task'
@@ -68,30 +68,30 @@ end
68
68
  module Loris
69
69
  BINARY = File.expand_path(File.dirname(__FILE__) + '/../bin/loris')
70
70
  LIBDIR = File.expand_path(File.dirname(__FILE__) + '/../lib')
71
- RUBY_BINARY = File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name'])
72
-
71
+ RUBY_BINARY = File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name'])
72
+
73
73
  module CLI
74
-
74
+
75
75
  class Main
76
-
76
+
77
77
  class DummyActioner
78
-
78
+
79
79
  def initialize(actioner, stream)
80
80
  @actioner = actioner
81
81
  @stream = stream
82
82
  end
83
-
83
+
84
84
  def run
85
85
  @actioner.run
86
86
  @stream.puts '[Poll complete]'
87
87
  @stream.flush
88
88
  end
89
-
89
+
90
90
  end
91
-
91
+
92
92
  class << self
93
93
  def execute(args)
94
-
94
+
95
95
  # Get config variables
96
96
  debug = args.length > 0
97
97
  is_windows = RUBY_PLATFORM =~ /mswin32/
@@ -111,31 +111,31 @@ module Loris
111
111
  oc = OutputCollection.new
112
112
  oc.add(ShellOutput.new($stdout))
113
113
  oc.add(cco) unless debug
114
- oc.add(GrowlOutput.new(Growl)) unless debug
115
-
114
+ oc.add(GrowlOutput.new(Growl)) unless debug
115
+
116
116
  tm = TaskManager.new(oc)
117
117
  tm.add(ListTask.new) if debug
118
118
  tm.add(coffeescript_task(dir))
119
119
  tm.add(javascript_lint_task(dir))
120
120
  tm.add(google_lint_task(dir))
121
121
  tm.add(jasmine_node_task(dir))
122
- tm.add(jasmine_node_coverage_task(dir))
122
+ # tm.add(jasmine_node_coverage_task(dir))
123
123
  tm.add(CommandLineTask.new(JSpecRunner.new(dir, ExtensionFilter.new(File, 'js')), JSpecParser.new)) unless is_windows
124
124
  tm.add(jsTestDriverTask(dir))
125
125
  tm.add(CommandLineTask.new(RSpecRunner.new(dir, ExtensionFilter.new(File, 'rb'), EndsWithFilter.new('_spec.rb')), RSpecParser.new))
126
126
  tm.add(closure_compiler_task(dir))
127
127
 
128
- a = FileActioner.new(ff, tm)
129
-
128
+ a = FileActioner.new(ff, tm)
129
+
130
130
  da = DummyActioner.new(a, $stdout)
131
-
131
+
132
132
  p = Poller.new(w, c, debug ? da : a)
133
-
133
+
134
134
  # Start!
135
135
  p.start
136
136
 
137
137
  end
138
-
138
+
139
139
  def coffeescript_task(dir)
140
140
  return CommandLineTask.new(
141
141
  CoffeeScriptRunner.new(
@@ -147,11 +147,11 @@ module Loris
147
147
  CoffeeScriptParser.new(dir)
148
148
  )
149
149
  end
150
-
150
+
151
151
  def jasmine_node_task(dir)
152
152
  node = '/usr/local/bin/node'
153
153
  spec_dir = File.join(LIBDIR, 'jasmine-node')
154
-
154
+
155
155
  return CommandLineTask.new(
156
156
  JasmineNodeRunner.new(
157
157
  node,
@@ -163,7 +163,7 @@ module Loris
163
163
  JasmineNodeParser.new(dir)
164
164
  )
165
165
  end
166
-
166
+
167
167
  def jasmine_node_coverage_task(dir)
168
168
  node = '/usr/local/bin/node'
169
169
  spec_dir = File.join(LIBDIR, 'jasmine-node')
@@ -183,112 +183,112 @@ module Loris
183
183
  JasmineNodeParser.new(dir)
184
184
  )
185
185
  end
186
-
186
+
187
187
  # Refactor into factory
188
188
  def javascript_lint_task(dir)
189
189
  is_windows = RUBY_PLATFORM =~ /mswin32/
190
190
  binary = File.join(LIBDIR, 'javascript-lint' , is_windows ? 'jsl.exe' : 'jsl')
191
-
191
+
192
192
  return CommandLineTask.new(
193
193
  JavascriptLintRunner.new(
194
194
  binary,
195
- dir,
195
+ dir,
196
196
  ExtensionFilter.new(File, 'js')
197
- ),
197
+ ),
198
198
  JavascriptLintParser.new(dir)
199
- )
199
+ )
200
200
  end
201
-
201
+
202
202
  def google_lint_task(dir)
203
203
  binary = File.join(LIBDIR, 'google-lint' , 'gjslint')
204
204
  fix_style_binary = File.join(LIBDIR, 'google-lint' , 'fixjsstyle')
205
-
205
+
206
206
  return CommandLineTask.new(
207
207
  GoogleLintRunner.new(
208
208
  binary,
209
209
  fix_style_binary,
210
- dir,
210
+ dir,
211
211
  ExtensionFilter.new(File, 'js'),
212
212
  GoogleLintConfig.new(
213
- dir,
214
- YAML,
213
+ dir,
214
+ YAML,
215
215
  URI
216
216
  )
217
- ),
217
+ ),
218
218
  GoogleLintParser.new(dir)
219
- )
219
+ )
220
220
  end
221
-
221
+
222
222
  def closure_compiler_task(dir)
223
223
  jar = File.join(LIBDIR, 'closure-compiler' , 'closure-compiler.jar')
224
-
224
+
225
225
  return CommandLineTask.new(
226
226
  ClosureCompilerRunner.new(
227
227
  jar,
228
- dir,
228
+ dir,
229
229
  ExtensionFilter.new(File, 'js'),
230
230
  ClosureCompilerConfig.new(
231
- dir,
232
- YAML,
231
+ dir,
232
+ YAML,
233
233
  URI
234
234
  )
235
- ),
235
+ ),
236
236
  ClosureCompilerParser.new(dir)
237
- )
237
+ )
238
238
  end
239
-
240
-
239
+
240
+
241
241
  # Will need to be refactored into a factory
242
242
  def jsTestDriverTask(dir)
243
243
  require 'tasks/js_test_driver/js_test_driver_runner'
244
244
  require 'tasks/js_test_driver/js_test_driver_parser'
245
245
  require 'tasks/js_test_driver/js_test_driver_config'
246
- require 'tasks/js_test_driver/js_test_driver_server'
247
-
246
+ require 'tasks/js_test_driver/js_test_driver_server'
247
+
248
248
  jar = File.join(LIBDIR, 'js-test-driver/JsTestDriver-1.2.jar')
249
249
  is_windows = RUBY_PLATFORM =~ /mswin32/
250
-
251
- if is_windows
250
+
251
+ if is_windows
252
252
  require 'browser_finder'
253
253
  browser = BrowserFinder.new.getDefault
254
254
  else
255
255
  browser = 'open "%1"'
256
256
  end
257
-
257
+
258
258
  sleep_time = 3
259
-
259
+
260
260
  if is_windows
261
261
  require 'windows_process'
262
262
  else
263
263
  require 'unix_process'
264
264
  end
265
-
265
+
266
266
  return CommandLineTask.new(
267
267
  JsTestDriverRunner.new(
268
- dir,
269
- jar,
268
+ dir,
269
+ jar,
270
270
  ExtensionFilter.new(File, 'js'),
271
271
  JsTestDriverServer.new(
272
272
  JsTestDriverConfig.new(
273
- dir,
274
- YAML,
273
+ dir,
274
+ YAML,
275
275
  URI
276
- ),
277
- Pinger.new,
276
+ ),
277
+ Pinger.new,
278
278
  is_windows ? WindowsProcess.new : UnixProcess.new,
279
- jar,
279
+ jar,
280
280
  browser,
281
281
  sleep_time
282
282
  )
283
- ),
283
+ ),
284
284
  JsTestDriverParser.new
285
- )
285
+ )
286
286
  end
287
-
288
- end
287
+
288
+ end
289
289
 
290
290
  end
291
-
291
+
292
292
  end
293
-
293
+
294
294
  end
@@ -1,5 +1,5 @@
1
1
  class CoffeeScriptRunner
2
-
2
+
3
3
  def initialize(binary, dir, filter, dir_finder)
4
4
  @binary = binary
5
5
  @dir = dir
@@ -8,30 +8,30 @@ class CoffeeScriptRunner
8
8
 
9
9
  @js_dir = dir + '/src'
10
10
  end
11
-
11
+
12
12
  def name
13
13
  return 'CoffeeScript'
14
14
  end
15
-
15
+
16
16
  def execute
17
17
  output = []
18
-
18
+
19
19
  @coffee_dirs.each do |coffee_dir|
20
20
  js_dir = coffee_dir.sub '/coffee-', '/'
21
21
  output.push `#{@binary} --output "#{js_dir}" --compile "#{coffee_dir}" 2>&1`
22
22
  end
23
-
23
+
24
24
  return output.join "\n"
25
25
  end
26
-
26
+
27
27
  # TODO: Only return true if we can find the node binary
28
28
  def is_configured?(all_files)
29
29
  @coffee_dirs = (@coffeescript_dir_finder.find all_files).uniq
30
30
  return @coffee_dirs.length > 0
31
31
  end
32
-
32
+
33
33
  def should_run?(modified_files)
34
34
  return !(modified_files.detect { |file| @filter.filter(file) }).nil? || modified_files.include?(@config)
35
35
  end
36
-
36
+
37
37
  end
data/loris.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{loris}
8
- s.version = "0.3.2"
8
+ s.version = "0.4.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Karl O'Keeffe"]
12
- s.date = %q{2010-10-01}
12
+ s.date = %q{2010-10-29}
13
13
  s.default_executable = %q{loris}
14
14
  s.description = %q{Automatically run javascript unit tests}
15
15
  s.email = %q{loris@monket.net}
data/loris.tmproj CHANGED
@@ -3,7 +3,7 @@
3
3
  <plist version="1.0">
4
4
  <dict>
5
5
  <key>currentDocument</key>
6
- <string>lib/tasks/google_lint/google_lint_runner.rb</string>
6
+ <string>lib/loris.rb</string>
7
7
  <key>documents</key>
8
8
  <array>
9
9
  <dict>
@@ -21,19 +21,49 @@
21
21
  <integer>200</integer>
22
22
  <key>metaData</key>
23
23
  <dict>
24
+ <key>Rakefile</key>
25
+ <dict>
26
+ <key>caret</key>
27
+ <dict>
28
+ <key>column</key>
29
+ <integer>0</integer>
30
+ <key>line</key>
31
+ <integer>0</integer>
32
+ </dict>
33
+ <key>firstVisibleColumn</key>
34
+ <integer>0</integer>
35
+ <key>firstVisibleLine</key>
36
+ <integer>0</integer>
37
+ </dict>
24
38
  <key>lib/loris.rb</key>
25
39
  <dict>
26
40
  <key>caret</key>
27
41
  <dict>
28
42
  <key>column</key>
29
- <integer>31</integer>
43
+ <integer>20</integer>
30
44
  <key>line</key>
31
- <integer>208</integer>
45
+ <integer>213</integer>
32
46
  </dict>
47
+ <key>columnSelection</key>
48
+ <false/>
33
49
  <key>firstVisibleColumn</key>
34
50
  <integer>0</integer>
35
51
  <key>firstVisibleLine</key>
36
- <integer>177</integer>
52
+ <integer>181</integer>
53
+ <key>selectFrom</key>
54
+ <dict>
55
+ <key>column</key>
56
+ <integer>16</integer>
57
+ <key>line</key>
58
+ <integer>213</integer>
59
+ </dict>
60
+ <key>selectTo</key>
61
+ <dict>
62
+ <key>column</key>
63
+ <integer>20</integer>
64
+ <key>line</key>
65
+ <integer>213</integer>
66
+ </dict>
37
67
  </dict>
38
68
  <key>lib/outputs/growl_output.rb</key>
39
69
  <dict>
@@ -68,28 +98,90 @@
68
98
  <key>caret</key>
69
99
  <dict>
70
100
  <key>column</key>
71
- <integer>3</integer>
101
+ <integer>41</integer>
72
102
  <key>line</key>
73
- <integer>16</integer>
103
+ <integer>9</integer>
74
104
  </dict>
105
+ <key>columnSelection</key>
106
+ <false/>
75
107
  <key>firstVisibleColumn</key>
76
108
  <integer>0</integer>
77
109
  <key>firstVisibleLine</key>
78
110
  <integer>0</integer>
111
+ <key>selectFrom</key>
112
+ <dict>
113
+ <key>column</key>
114
+ <integer>12</integer>
115
+ <key>line</key>
116
+ <integer>9</integer>
117
+ </dict>
118
+ <key>selectTo</key>
119
+ <dict>
120
+ <key>column</key>
121
+ <integer>41</integer>
122
+ <key>line</key>
123
+ <integer>9</integer>
124
+ </dict>
79
125
  </dict>
80
126
  <key>lib/tasks/closure_compiler/closure_compiler_runner.rb</key>
127
+ <dict>
128
+ <key>caret</key>
129
+ <dict>
130
+ <key>column</key>
131
+ <integer>58</integer>
132
+ <key>line</key>
133
+ <integer>38</integer>
134
+ </dict>
135
+ <key>columnSelection</key>
136
+ <false/>
137
+ <key>firstVisibleColumn</key>
138
+ <integer>0</integer>
139
+ <key>firstVisibleLine</key>
140
+ <integer>0</integer>
141
+ <key>selectFrom</key>
142
+ <dict>
143
+ <key>column</key>
144
+ <integer>42</integer>
145
+ <key>line</key>
146
+ <integer>38</integer>
147
+ </dict>
148
+ <key>selectTo</key>
149
+ <dict>
150
+ <key>column</key>
151
+ <integer>58</integer>
152
+ <key>line</key>
153
+ <integer>38</integer>
154
+ </dict>
155
+ </dict>
156
+ <key>lib/tasks/coffeescript/coffeescript_runner.rb</key>
81
157
  <dict>
82
158
  <key>caret</key>
83
159
  <dict>
84
160
  <key>column</key>
85
161
  <integer>0</integer>
86
162
  <key>line</key>
87
- <integer>6</integer>
163
+ <integer>22</integer>
88
164
  </dict>
165
+ <key>columnSelection</key>
166
+ <false/>
89
167
  <key>firstVisibleColumn</key>
90
168
  <integer>0</integer>
91
169
  <key>firstVisibleLine</key>
92
170
  <integer>0</integer>
171
+ <key>selectFrom</key>
172
+ <dict>
173
+ <key>column</key>
174
+ <integer>0</integer>
175
+ <key>line</key>
176
+ <integer>18</integer>
177
+ </dict>
178
+ <key>selectTo</key>
179
+ <dict>
180
+ <key>column</key>
181
+ <integer>0</integer>
182
+ <key>line</key>
183
+ <integer>22</integer>
184
+ </dict>
93
185
  </dict>
94
186
  <key>lib/tasks/google_lint/google_lint_config.rb</key>
95
187
  <dict>
@@ -133,6 +225,36 @@
133
225
  <key>firstVisibleLine</key>
134
226
  <integer>0</integer>
135
227
  </dict>
228
+ <key>lib/tasks/javascript_lint/javascript_lint_runner.rb</key>
229
+ <dict>
230
+ <key>caret</key>
231
+ <dict>
232
+ <key>column</key>
233
+ <integer>11</integer>
234
+ <key>line</key>
235
+ <integer>14</integer>
236
+ </dict>
237
+ <key>columnSelection</key>
238
+ <false/>
239
+ <key>firstVisibleColumn</key>
240
+ <integer>0</integer>
241
+ <key>firstVisibleLine</key>
242
+ <integer>0</integer>
243
+ <key>selectFrom</key>
244
+ <dict>
245
+ <key>column</key>
246
+ <integer>70</integer>
247
+ <key>line</key>
248
+ <integer>14</integer>
249
+ </dict>
250
+ <key>selectTo</key>
251
+ <dict>
252
+ <key>column</key>
253
+ <integer>11</integer>
254
+ <key>line</key>
255
+ <integer>14</integer>
256
+ </dict>
257
+ </dict>
136
258
  <key>lib/tasks/list_task.rb</key>
137
259
  <dict>
138
260
  <key>caret</key>
@@ -147,6 +269,20 @@
147
269
  <key>firstVisibleLine</key>
148
270
  <integer>0</integer>
149
271
  </dict>
272
+ <key>loris.gemspec</key>
273
+ <dict>
274
+ <key>caret</key>
275
+ <dict>
276
+ <key>column</key>
277
+ <integer>0</integer>
278
+ <key>line</key>
279
+ <integer>0</integer>
280
+ </dict>
281
+ <key>firstVisibleColumn</key>
282
+ <integer>0</integer>
283
+ <key>firstVisibleLine</key>
284
+ <integer>0</integer>
285
+ </dict>
150
286
  <key>spec/filters/ends_with_filter_spec.rb</key>
151
287
  <dict>
152
288
  <key>caret</key>
@@ -165,11 +301,15 @@
165
301
  <key>openDocuments</key>
166
302
  <array>
167
303
  <string>lib/loris.rb</string>
304
+ <string>loris.gemspec</string>
168
305
  <string>lib/tasks/google_lint/google_lint_runner.rb</string>
306
+ <string>Rakefile</string>
169
307
  <string>lib/tasks/google_lint/google_lint_parser.rb</string>
170
308
  <string>lib/tasks/closure_compiler/closure_compiler_config.rb</string>
171
309
  <string>lib/tasks/google_lint/google_lint_config.rb</string>
172
310
  <string>lib/tasks/closure_compiler/closure_compiler_runner.rb</string>
311
+ <string>lib/tasks/coffeescript/coffeescript_runner.rb</string>
312
+ <string>lib/tasks/javascript_lint/javascript_lint_runner.rb</string>
173
313
  </array>
174
314
  <key>showFileHierarchyDrawer</key>
175
315
  <false/>
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: loris
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 15
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 3
9
- - 2
10
- version: 0.3.2
8
+ - 4
9
+ - 0
10
+ version: 0.4.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Karl O'Keeffe
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-10-01 00:00:00 +01:00
18
+ date: 2010-10-29 00:00:00 +01:00
19
19
  default_executable: loris
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency