Skip to content

Commit

Permalink
поддержка YAML конфигов
Browse files Browse the repository at this point in the history
  • Loading branch information
vol4ok committed Feb 9, 2012
1 parent a9d5835 commit 53452f1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/nbuild/builder.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ util = require 'util'
_ = require 'underscore'
path = require 'path'
CSON = require 'CSON'
YAML = require 'js-yaml'
{deepExtend} = require './helpers'

{normalize, basename, dirname, extname, join, existsSync, relative} = path

YAML_REGEX = /^\s*#YAML/i
CSON_REGEX = /^\s*#CSON/i
VARIABLE_REGEX = /\$\(([\S]+?)\)/g
JSON_CMD_REGEX = /^\$json\(([\S]+?)\)$/i
Expand Down Expand Up @@ -148,7 +150,10 @@ class Builder
data = fs.readFileSync(configFile, 'utf-8')
parse = {}
try
if CSON_REGEX.test(data)
if YAML_REGEX.test(data)
parse = YAML.load(data)
console.log parse
else if CSON_REGEX.test(data)
parse = CSON.parse(data)
else
parse = JSON.parse(data)
Expand Down

0 comments on commit 53452f1

Please sign in to comment.