Skip to content
This repository has been archived by the owner on May 12, 2020. It is now read-only.

Commit

Permalink
Fixed #33
Browse files Browse the repository at this point in the history
  • Loading branch information
suda committed Nov 20, 2014
1 parent 965aabc commit 8daaf02
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
10 changes: 9 additions & 1 deletion lib/spark-dev.coffee
Expand Up @@ -150,6 +150,11 @@ module.exports =
type: 'boolean'
default: true

# Files ignored when compiling
filesExcludedFromCompile:
type: 'string'
default: '.ds_store, .jpg, .gif, .png, .include, .ignore, Thumbs.db, .git, .bin'

# Require view's module and initialize it
initView: (name) ->
_s ?= require 'underscore.string'
Expand Down Expand Up @@ -357,8 +362,11 @@ module.exports =

rootPath = atom.project.getPaths()[0]
files = fs.listTreeSync(rootPath)
notSourceExtensions = atom.config.get('spark-dev.filesExcludedFromCompile').split ','
notSourceExtensions = (_s.trim(extension).toLowerCase() for extension in notSourceExtensions)

files = files.filter (file) ->
return !(utilities.getFilenameExt(file).toLowerCase() in settings.notSourceExtensions) &&
return !(utilities.getFilenameExt(file).toLowerCase() in notSourceExtensions) &&
!fs.isDirectorySync(file)

process.chdir rootPath
Expand Down
20 changes: 17 additions & 3 deletions spec/spark-dev-spec.coffee
Expand Up @@ -245,30 +245,44 @@ describe 'Main Tests', ->
SettingsHelper.setCredentials 'foo@bar.baz', '0123456789abcdef0123456789abcdef'

SparkStub.stubSuccess 'compileCode'
@originalFilesExcludedFromCompile = atom.config.get 'spark-dev.filesExcludedFromCompile'
atom.config.set 'spark-dev.filesExcludedFromCompile', '.ds_store, .jpg, .gif, .png, .include, .ignore, Thumbs.db, .git, .bin'

sparkIde.compileCloud()
# Check if local storage is set to working
expect(SettingsHelper.get('compile-status')).toEqual({working:true})

expect(spark.compileCode).toHaveBeenCalled()

expectedFiles = ['foo.ino', 'inner/bar.cpp', 'lib.cpp', 'lib.h']

expect(spark.compileCode).toHaveBeenCalledWith(expectedFiles)

waitsFor ->
!sparkIde.compileCloudPromise

runs ->
atom.config.set 'spark-dev.filesExcludedFromCompile', '.ds_store, .jpg, .ino, .bin'
spark.compileCode.reset()
sparkIde.compileCloud()

expect(spark.compileCode).toHaveBeenCalled()
expectedFiles = ['inner/bar.cpp', 'lib.cpp', 'lib.h']
expect(spark.compileCode).toHaveBeenCalledWith(expectedFiles)

waitsFor ->
!sparkIde.compileCloudPromise

runs ->
SettingsHelper.set 'compile-status', null
SettingsHelper.clearCredentials()
atom.project.setPaths oldPaths
atom.config.set 'spark-dev.filesExcludedFromCompile', @originalFilesExcludedFromCompile

# Remove firmware files
for file in fs.listSync(__dirname + '/data/sampleproject')
if utilities.getFilenameExt(file).toLowerCase() == '.bin'
fs.unlinkSync file

fit 'checks successful compile', ->
it 'checks successful compile', ->
SettingsHelper.setCredentials 'foo@bar.baz', '0123456789abcdef0123456789abcdef'
SparkStub.stubSuccess 'compileCode'
SparkStub.stubSuccess 'downloadBinary'
Expand Down

0 comments on commit 8daaf02

Please sign in to comment.