@@ -211,6 +211,8 @@ export default Service.extend({
211211
212212 this . addBoilerPlateFiles ( out , gist ) ;
213213
214+ this . deleteTempFiles ( processedFiles ) ;
215+
214216 return this . twiddleJson . getTwiddleJson ( gist )
215217 . then ( twiddleJSON => {
216218 this . addConfig ( out , gist , twiddleJSON ) ;
@@ -253,10 +255,12 @@ export default Service.extend({
253255 let newJsFilePath = prefix + '/' + jsHash + '.js' ;
254256 let newHbsFilePath = prefix + '/' + hbsHash + '.hbs' ;
255257 let newJsFile = this . store . createRecord ( 'gist-file' , {
258+ isTemp : true ,
256259 filePath : newJsFilePath ,
257260 content : jsFile . get ( 'content' )
258261 } ) ;
259262 let newHbsFile = this . store . createRecord ( 'gist-file' , {
263+ isTemp : true ,
260264 filePath : newHbsFilePath ,
261265 content : hbsFile . get ( 'content' )
262266 } ) ;
@@ -269,6 +273,7 @@ export default Service.extend({
269273 if ( jsFileName === 'index' ) {
270274 let dirName = prefix . substr ( prefix . lastIndexOf ( '/' ) ) ;
271275 newEmittedFile = this . store . createRecord ( 'gist-file' , {
276+ isTemp : true ,
272277 filePath : prefix + '.js' ,
273278 content : `
274279 import Component from './${ dirName } /${ jsHash } ';
@@ -279,6 +284,7 @@ export default Service.extend({
279284 } ) ;
280285 } else {
281286 newEmittedFile = this . store . createRecord ( 'gist-file' , {
287+ isTemp : true ,
282288 filePath : prefix + '/' + jsFileName + '.js' ,
283289 content : `
284290 import Component from './${ jsHash } ';
@@ -298,6 +304,7 @@ export default Service.extend({
298304 let hbsHash = md5 ( hbsFilePath ) ;
299305 let newHbsFilePath = prefix + '/' + hbsHash + '.hbs' ;
300306 let newHbsFile = this . store . createRecord ( 'gist-file' , {
307+ isTemp : true ,
301308 filePath : newHbsFilePath ,
302309 content : hbsFile . get ( 'content' )
303310 } ) ;
@@ -307,6 +314,7 @@ export default Service.extend({
307314 if ( hbsFileName === 'index' ) {
308315 let dirName = prefix . substr ( prefix . lastIndexOf ( '/' ) ) ;
309316 newEmittedFile = this . store . createRecord ( 'gist-file' , {
317+ isTemp : true ,
310318 filePath : prefix + '.js' ,
311319 content : `
312320 import Template from './${ dirName } /${ hbsHash } ';
@@ -316,6 +324,7 @@ export default Service.extend({
316324 } ) ;
317325 } else {
318326 newEmittedFile = this . store . createRecord ( 'gist-file' , {
327+ isTemp : true ,
319328 filePath : prefix + '/' + hbsFileName + '.js' ,
320329 content : `
321330 import Template from './${ hbsHash } ';
@@ -592,6 +601,14 @@ export default Service.extend({
592601
593602 setTesting ( gist , enabled = true ) {
594603 this . twiddleJson . setTesting ( gist , enabled ) ;
604+ } ,
605+
606+ deleteTempFiles ( files ) {
607+ files . forEach ( file => {
608+ if ( file . isTemp ) {
609+ run ( ( ) => pushDeletion ( this . store , 'gist-file' , file . get ( 'fileName' ) ) ) ;
610+ }
611+ } ) ;
595612 }
596613} ) ;
597614
0 commit comments