Skip to content

Commit f075c5f

Browse files
Merge pull request #104 from Haeresis/develop
Fix serverPhysicalPath bad behavior.
2 parents d148d9e + 8fb0dd2 commit f075c5f

File tree

7 files changed

+56
-10
lines changed

7 files changed

+56
-10
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
## 1.7.1 ##
2+
3+
Bugfix:
4+
5+
- Find the real place of `node-atlas` module used by CLI or by API.
6+
7+
8+
19
## 1.7.0 ##
210

311
Enhancement:

bin/node-atlas.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ NA = function () {
137137
this.config = init.config;
138138
this.afterGeneration = init.afterGeneration;
139139
this.afterGenerates = init.afterGenerates;
140+
this.afterNewProject = init.afterNewProject;
140141
this.afterInitProject = init.afterInitProject;
141142
this.init = init.init;
142143
this.run = init.run;

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
/**
77
* @fileOverview NodeAtlas allows you to create and manage HTML assets or create multilingual websites/webapps easily with Node.js.
88
* @author {@link https://www.lesieur.name/ Bruno Lesieur}
9-
* @version 1.7.0
9+
* @version 1.7.1
1010
* @license {@link https://github.com/Haeresis/ResumeAtlas/blob/master/LICENSE/ GNU GENERAL PUBLIC LICENSE Version 2}
1111
* @module node-atlas
1212
* @requires {@link NA#modules.external:async}

lib/assets-generation.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,8 +280,8 @@ exports.generateStartingProject = function (fallback) {
280280
traverse.on('complete', function () {
281281
data.pathName = sourcePath;
282282
NA.log(NA.appLabels.initCopy.replace(/%([\-a-zA-Z0-9_]+)%/g, function (regex, matches) { return data[matches]; }));
283-
if (NA.afterInitProject) {
284-
NA.afterInitProject();
283+
if (NA.afterNewProject) {
284+
NA.afterNewProject();
285285
}
286286
});
287287

lib/configuration.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ exports.lineCommandConfiguration = function () {
1616
commander
1717

1818
/* Version of NodeAtlas currently in use with `--version` option. */
19-
.version("1.7.0")
19+
.version("1.7.1")
2020

2121
/* Automaticly run default browser with `--browse` options. If a param is setted, the param is added to the and of url. */
2222
.option(NA.appLabels.commander.browse.command, NA.appLabels.commander.browse.description, String)
@@ -63,7 +63,8 @@ exports.lineCommandConfiguration = function () {
6363
* @memberOf NA#
6464
*/
6565
exports.initGlobalVar = function () {
66-
var NA = this;
66+
var NA = this,
67+
path = NA.modules.path;
6768

6869
/**
6970
* Name of file which contains language error messages. The name of file is without extension.
@@ -81,9 +82,9 @@ exports.initGlobalVar = function () {
8182
* @alias serverPhysicalPath
8283
* @type {string}
8384
* @memberOf NA#
84-
* @default « The path where `node-atlas.js` is. »
85+
* @default « The path where `node-atlas` module is. »
8586
*/
86-
NA.serverPhysicalPath = process.argv[1];
87+
NA.serverPhysicalPath = path.join(__dirname, "..");
8788

8889
/**
8990
* All internationalize labels from `NA#appLanguage` file.

lib/init.js

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ exports.config = function (config) {
5757
* // or
5858
* // ...
5959
* }).run({
60-
* generates: true
60+
* generate: true
6161
* });
6262
* @return {Object} The NA instance for chained functions.
6363
*/
@@ -69,6 +69,31 @@ exports.afterGeneration = function (callback) {
6969
return NA;
7070
};
7171

72+
/**
73+
* Set private `NA#afterNewProject`.
74+
* @public
75+
* @function afterInitProject
76+
* @memberOf module:node-atlas~NA#
77+
* @param {function} Instruction to execute after initialization of template project.
78+
* @example require('node-atlas')().afterInitProject(function () {
79+
* // Update all files on a server...
80+
* // or
81+
* // Generate a documentation...
82+
* // or
83+
* // ...
84+
* }).run({
85+
* generate: true
86+
* });
87+
* @return {Object} The NA instance for chained functions.
88+
*/
89+
exports.afterInitProject = function (callback) {
90+
var NA = this;
91+
92+
NA.afterNewProject = callback;
93+
94+
return NA;
95+
};
96+
7297
/**
7398
* Initialize a NA instance.
7499
* @public

package.json

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "node-atlas",
33
"preferGlobal": true,
4-
"version": "1.7.0",
4+
"version": "1.7.1",
55
"author": {
66
"name": "Bruno Lesieur",
77
"email": "[email protected]"
@@ -79,7 +79,18 @@
7979
"lib/node-modules.js",
8080
"lib/web-server.js",
8181
"bin/node-atlas.js",
82-
"templates/*",
82+
"templates/hello-world/webconfig.json",
83+
"templates/hello-world/variations/common.json",
84+
"templates/hello-world/variations/index.json",
85+
"templates/hello-world/variations/en-us/common.json",
86+
"templates/hello-world/variations/en-us/index.json",
87+
"templates/hello-world/templates/error.htm",
88+
"templates/hello-world/templates/index.htm",
89+
"templates/hello-world/controllers/common.js",
90+
"templates/hello-world/controllers/index.js",
91+
"templates/hello-world/components/head.htm",
92+
"templates/hello-world/components/foot.htm",
93+
"templates/hello-world/assets/stylesheets/common.css",
8394
"LICENSE",
8495
"README.md",
8596
"CHANGELOG.md",

0 commit comments

Comments
 (0)