editorconfig 0.11.3 → 0.12.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/ini.js CHANGED
@@ -1,65 +1,65 @@
1
- // Based on iniparser by shockie <https://npmjs.org/package/iniparser>
2
-
3
- /*
4
- * get the file handler
5
- */
6
- var fs = require('fs');
7
-
8
- /*
9
- * define the possible values:
10
- * section: [section]
11
- * param: key=value
12
- * comment: ;this is a comment
13
- */
14
- var regex = {
15
- section: /^\s*\[(([^#;]|\\#|\\;)+)\]\s*([#;].*)?$/,
16
- param: /^\s*([\w\.\-\_]+)\s*[=:]\s*(.*?)\s*([#;].*)?$/,
17
- comment: /^\s*[#;].*$/
18
- };
19
-
20
- /*
21
- * parses a .ini file
22
- * @param: {String} file, the location of the .ini file
23
- * @param: {Function} callback, the function that will be called when parsing is done
24
- * @return: none
25
- */
26
- module.exports.parse = function(file, callback){
27
- if(!callback){
28
- return;
29
- }
30
- fs.readFile(file, 'utf8', function(err, data){
31
- if(err){
32
- callback(err);
33
- }else{
34
- callback(null, parse(data));
35
- }
36
- });
37
- };
38
-
39
- module.exports.parseSync = function(file){
40
- return parse(fs.readFileSync(file, 'utf8'));
41
- };
42
-
43
- function parse(data){
44
- var sectionBody = {};
45
- var sectionName = null;
46
- var value = [[sectionName, sectionBody]];
47
- var lines = data.split(/\r\n|\r|\n/);
48
- lines.forEach(function(line){
49
- var match;
50
- if(regex.comment.test(line)){
51
- return;
52
- }else if(regex.param.test(line)){
53
- match = line.match(regex.param);
54
- sectionBody[match[1]] = match[2];
55
- }else if(regex.section.test(line)){
56
- match = line.match(regex.section);
57
- sectionName = match[1];
58
- sectionBody = {};
59
- value.push([sectionName, sectionBody]);
60
- }
61
- });
62
- return value;
63
- }
64
-
65
- module.exports.parseString = parse;
1
+ // Based on iniparser by shockie <https://npmjs.org/package/iniparser>
2
+
3
+ /*
4
+ * get the file handler
5
+ */
6
+ var fs = require('fs');
7
+
8
+ /*
9
+ * define the possible values:
10
+ * section: [section]
11
+ * param: key=value
12
+ * comment: ;this is a comment
13
+ */
14
+ var regex = {
15
+ section: /^\s*\[(([^#;]|\\#|\\;)+)\]\s*([#;].*)?$/,
16
+ param: /^\s*([\w\.\-\_]+)\s*[=:]\s*(.*?)\s*([#;].*)?$/,
17
+ comment: /^\s*[#;].*$/
18
+ };
19
+
20
+ /*
21
+ * parses a .ini file
22
+ * @param: {String} file, the location of the .ini file
23
+ * @param: {Function} callback, the function that will be called when parsing is done
24
+ * @return: none
25
+ */
26
+ module.exports.parse = function (file, callback) {
27
+ if (!callback) {
28
+ return;
29
+ }
30
+ fs.readFile(file, 'utf8', function (err, data) {
31
+ if (err) {
32
+ callback(err);
33
+ } else {
34
+ callback(null, parse(data));
35
+ }
36
+ });
37
+ };
38
+
39
+ module.exports.parseSync = function (file) {
40
+ return parse(fs.readFileSync(file, 'utf8'));
41
+ };
42
+
43
+ function parse (data) {
44
+ var sectionBody = {};
45
+ var sectionName = null;
46
+ var value = [[sectionName, sectionBody]];
47
+ var lines = data.split(/\r\n|\r|\n/);
48
+ lines.forEach(function (line) {
49
+ var match;
50
+ if (regex.comment.test(line)) {
51
+ return;
52
+ } else if (regex.param.test(line)) {
53
+ match = line.match(regex.param);
54
+ sectionBody[match[1]] = match[2];
55
+ } else if (regex.section.test(line)) {
56
+ match = line.match(regex.section);
57
+ sectionName = match[1];
58
+ sectionBody = {};
59
+ value.push([sectionName, sectionBody]);
60
+ }
61
+ });
62
+ return value;
63
+ }
64
+
65
+ module.exports.parseString = parse;
package/lib/version.js CHANGED
@@ -1,48 +1,48 @@
1
- function Version(version) {
2
- var args = arguments;
3
- this.components = typeof version === "string" ?
4
- version.split(".").map(function(x){return parseInt(x, 10);}) :
5
- Object.keys(arguments).map(function(k){return args[k];});
6
-
7
- var len = this.components.length;
8
- this.major = len ? this.components[0] : 0;
9
- this.minor = len > 1 ? this.components[1] : 0;
10
- this.build = len > 2 ? this.components[2] : 0;
11
- this.revision = len > 3 ? this.components[3] : 0;
12
-
13
- if (typeof version !== "string") {
14
- return;
15
- }
16
-
17
- var ext = version.split("-");
18
- if (ext.length === 2) {
19
- this.configuration = ext[1];
20
- }
21
- }
22
-
23
- Version.prototype = {
24
- toString: function() {
25
- var version = this.components.join(".");
26
- if (typeof this.configuration !== "undefined") {
27
- version += "-" + this.configuration;
28
- }
29
- return version;
30
- },
31
- gte: function(other){
32
- if (this.major < other.major) {
33
- return false;
34
- }
35
- if (this.minor < other.minor) {
36
- return false;
37
- }
38
- if (this.build < other.build) {
39
- return false;
40
- }
41
- if (this.revision < other.revision) {
42
- return false;
43
- }
44
- return true;
45
- }
46
- };
47
-
48
- module.exports = Version;
1
+ function Version(version) {
2
+ var args = arguments;
3
+ this.components = typeof version === "string" ?
4
+ version.split(".").map(function(x){return parseInt(x, 10);}) :
5
+ Object.keys(arguments).map(function(k){return args[k];});
6
+
7
+ var len = this.components.length;
8
+ this.major = len ? this.components[0] : 0;
9
+ this.minor = len > 1 ? this.components[1] : 0;
10
+ this.build = len > 2 ? this.components[2] : 0;
11
+ this.revision = len > 3 ? this.components[3] : 0;
12
+
13
+ if (typeof version !== "string") {
14
+ return;
15
+ }
16
+
17
+ var ext = version.split("-");
18
+ if (ext.length === 2) {
19
+ this.configuration = ext[1];
20
+ }
21
+ }
22
+
23
+ Version.prototype = {
24
+ toString: function() {
25
+ var version = this.components.join(".");
26
+ if (typeof this.configuration !== "undefined") {
27
+ version += "-" + this.configuration;
28
+ }
29
+ return version;
30
+ },
31
+ gte: function(other){
32
+ if (this.major < other.major) {
33
+ return false;
34
+ }
35
+ if (this.minor < other.minor) {
36
+ return false;
37
+ }
38
+ if (this.build < other.build) {
39
+ return false;
40
+ }
41
+ if (this.revision < other.revision) {
42
+ return false;
43
+ }
44
+ return true;
45
+ }
46
+ };
47
+
48
+ module.exports = Version;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "editorconfig",
3
- "version": "0.11.3",
3
+ "version": "0.12.2",
4
4
  "description": "EditorConfig File Locator and Interpreter for Node.js",
5
5
  "keywords": [
6
6
  "editorconfig",
@@ -18,7 +18,9 @@
18
18
  },
19
19
  "scripts": {
20
20
  "pretest": "cmake .",
21
- "test": "ctest ."
21
+ "test": "ctest .",
22
+ "test-verbose": "ctest -VV --output-on-failure .",
23
+ "codepaint": "codepainter xform -e **/**.js"
22
24
  },
23
25
  "repository": {
24
26
  "type": "git",
@@ -31,8 +33,12 @@
31
33
  "url": "http://editorconfig.mit-license.org/2012"
32
34
  },
33
35
  "dependencies": {
36
+ "bluebird": "^2.3.6",
34
37
  "commander": "~1.1.1",
35
38
  "lru-cache": "~2.0.0",
36
39
  "sigmund": "~1.0.0"
40
+ },
41
+ "devDependencies": {
42
+ "codepainter": "^0.4.4"
37
43
  }
38
44
  }
@@ -1,45 +0,0 @@
1
- # Install script for directory: Z:/Documents/GitHub/editorconfig-core-js
2
-
3
- # Set the install prefix
4
- IF(NOT DEFINED CMAKE_INSTALL_PREFIX)
5
- SET(CMAKE_INSTALL_PREFIX "C:/Program Files (x86)/editorconfig-core-js")
6
- ENDIF(NOT DEFINED CMAKE_INSTALL_PREFIX)
7
- STRING(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
8
-
9
- # Set the install configuration name.
10
- IF(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)
11
- IF(BUILD_TYPE)
12
- STRING(REGEX REPLACE "^[^A-Za-z0-9_]+" ""
13
- CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}")
14
- ELSE(BUILD_TYPE)
15
- SET(CMAKE_INSTALL_CONFIG_NAME "Release")
16
- ENDIF(BUILD_TYPE)
17
- MESSAGE(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"")
18
- ENDIF(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)
19
-
20
- # Set the component getting installed.
21
- IF(NOT CMAKE_INSTALL_COMPONENT)
22
- IF(COMPONENT)
23
- MESSAGE(STATUS "Install component: \"${COMPONENT}\"")
24
- SET(CMAKE_INSTALL_COMPONENT "${COMPONENT}")
25
- ELSE(COMPONENT)
26
- SET(CMAKE_INSTALL_COMPONENT)
27
- ENDIF(COMPONENT)
28
- ENDIF(NOT CMAKE_INSTALL_COMPONENT)
29
-
30
- IF(NOT CMAKE_INSTALL_LOCAL_ONLY)
31
- # Include the install script for each subdirectory.
32
- INCLUDE("Z:/Documents/GitHub/editorconfig-core-js/tests/cmake_install.cmake")
33
-
34
- ENDIF(NOT CMAKE_INSTALL_LOCAL_ONLY)
35
-
36
- IF(CMAKE_INSTALL_COMPONENT)
37
- SET(CMAKE_INSTALL_MANIFEST "install_manifest_${CMAKE_INSTALL_COMPONENT}.txt")
38
- ELSE(CMAKE_INSTALL_COMPONENT)
39
- SET(CMAKE_INSTALL_MANIFEST "install_manifest.txt")
40
- ENDIF(CMAKE_INSTALL_COMPONENT)
41
-
42
- FILE(WRITE "Z:/Documents/GitHub/editorconfig-core-js/${CMAKE_INSTALL_MANIFEST}" "")
43
- FOREACH(file ${CMAKE_INSTALL_MANIFEST_FILES})
44
- FILE(APPEND "Z:/Documents/GitHub/editorconfig-core-js/${CMAKE_INSTALL_MANIFEST}" "${file}\n")
45
- ENDFOREACH(file)