ppackage 2.4.1 → 2.4.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/index.js +8 -8
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -9,6 +9,8 @@ const args = require('nyks/process/parseArgs')();
|
|
|
9
9
|
const passthru = require('nyks/child_process/passthru');
|
|
10
10
|
const wait = require('nyks/child_process/wait');
|
|
11
11
|
const trim = require('mout/string/trim');
|
|
12
|
+
const unique = require('mout/array/unique');
|
|
13
|
+
|
|
12
14
|
const set = require('mout/object/set');
|
|
13
15
|
const drain = require('nyks/stream/drain');
|
|
14
16
|
|
|
@@ -89,7 +91,8 @@ let modes = {
|
|
|
89
91
|
analyze : function () {
|
|
90
92
|
const body = fs.readFileSync(this.file, 'utf-8');
|
|
91
93
|
this.meta = Dockerfile.parse(body);
|
|
92
|
-
let
|
|
94
|
+
let version = this.meta.labels[DOCKER_LABEL_VERSION];
|
|
95
|
+
let repository = this.meta.labels[DOCKER_LABEL_REPOSITORY];
|
|
93
96
|
return {version, repository};
|
|
94
97
|
},
|
|
95
98
|
commit : function({version, repository, files}) {
|
|
@@ -164,20 +167,17 @@ class ppackage {
|
|
|
164
167
|
|
|
165
168
|
async version(version = false, notag = false) {
|
|
166
169
|
|
|
167
|
-
let
|
|
170
|
+
let repositories = [];
|
|
168
171
|
|
|
169
172
|
let current_version;
|
|
170
173
|
for(let [, mode] of Object.entries(modes)) {
|
|
171
174
|
let line = mode.analyze.call(mode);
|
|
172
175
|
if(line.version) current_version = line.version;
|
|
173
|
-
|
|
174
|
-
current_repository = line.repository;
|
|
175
|
-
|
|
176
|
-
inconsistant_repo |= line.repository != current_repository;
|
|
176
|
+
repositories.push(line.repository);
|
|
177
177
|
}
|
|
178
178
|
|
|
179
|
-
if(
|
|
180
|
-
throw `Inconsitant repository detected, use ppackage repository first`;
|
|
179
|
+
if(unique(repositories).length != 1)
|
|
180
|
+
throw `Inconsitant repository ${unique(repositories).join(',')} detected, use ppackage repository first`;
|
|
181
181
|
|
|
182
182
|
|
|
183
183
|
let target_version = version || args.args.shift();
|