@@ -3,6 +3,8 @@ Path = require 'path'
3
3
fs = require ' fs'
4
4
R = require ' reactive'
5
5
6
+ { ok , equal , deepEqual } = require ' assert'
7
+
6
8
{ EventEmitter } = require ' events'
7
9
8
10
{ R , Project } = require " ../#{ process .env .JSLIB or ' lib' } /session"
@@ -21,6 +23,9 @@ class FakeSession
21
23
once : ->
22
24
after : (func ) -> process .nextTick func
23
25
26
+ @pluginManager =
27
+ allCompilers : []
28
+
24
29
after : (func ) -> process .nextTick func
25
30
26
31
findCompilerById : (compilerId ) ->
@@ -138,3 +143,32 @@ describe "Project", ->
138
143
project .setMemento { disableLiveRefresh : 1 , bar : 42 }
139
144
140
145
assert .equal project .foo , 42
146
+
147
+
148
+ describe " rule system" , ->
149
+
150
+ it " should start new projects with a full set of supported rules" , ->
151
+ universe = new R.Universe ()
152
+ vfs = new TestVFS ()
153
+ session = new FakeSession ()
154
+ # TODO: add some kind of fuzzy dependency injection to collapse these stupid chains
155
+ session .pluginManager .allCompilers .push {
156
+ name : ' LESS'
157
+ id : ' less'
158
+ extensions : [' less' ]
159
+ destinationExt : ' css'
160
+ sourceSpecs : [" *.less" ]
161
+ }
162
+ session .pluginManager .allCompilers .push {
163
+ name : ' CoffeeScript'
164
+ id : ' coffeescript'
165
+ extensions : [' coffee' ]
166
+ destinationExt : ' js'
167
+ sourceSpecs : [" *.coffee" ]
168
+ }
169
+
170
+ project = universe .create (Project, { session, vfs, path : " /foo/bar" })
171
+ deepEqual project .ruleSet .memento (), [{ action : ' compile-less' , src : ' **/*.less' , dst : ' **/*.css' }, { action : ' compile-coffeescript' , src : ' **/*.coffee' , dst : ' **/*.js' }]
172
+
173
+ it " should use rules to determine compiler and output path"
174
+ it " should allow rules to be modified in the UI"
0 commit comments