Skip to content

Commit

Permalink
Pass default config to constructor.
Browse files Browse the repository at this point in the history
  • Loading branch information
moonwave99 committed May 30, 2016
1 parent c48c539 commit 8b5df40
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/index.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ module.exports = class Waffel extends EventEmitter
server: false
watch: false
watchInterval: 5000
config:
env: 'dev'
markdownOptions:
gfm: true
tables: true
Expand Down Expand Up @@ -95,7 +97,7 @@ module.exports = class Waffel extends EventEmitter
catch e then @error "Could not locate structureFile: #{@options.structureFile}", e
site = yaml.safeLoad structureFileContents

@config = site.config
@config = _.extend @options.config, site.config
@structure = site.structure

getRevision: =>
Expand Down
2 changes: 2 additions & 0 deletions test/default/_init.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ config = global.config =
localesFolder: 'locales'
destinationFolder: '../public_default'
structureFile: 'site_default.yml'
config:
env: 'test'

wfl = global.wfl = new Waffel global.config

Expand Down
3 changes: 3 additions & 0 deletions test/default/config.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ config = global.config
require 'should-promised'

describe 'Instantiate Waffel', ->
it 'should set environment', ->
should(wfl.config.env).be.equal global.config.config.env

it 'should set locations', ->
should(wfl.options.root).be.equal config.root

Expand Down

0 comments on commit 8b5df40

Please sign in to comment.