ppackage 2.4.1 → 2.4.3

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.
Files changed (2) hide show
  1. package/index.js +10 -10
  2. package/package.json +2 -2
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
 
@@ -80,7 +82,7 @@ let modes = {
80
82
  if(repository)
81
83
  set(this.meta, "extra.repository", {type : "git", url : repository});
82
84
 
83
- fs.writeFileSync(this.file, JSON.stringify(this.meta, null, 2));
85
+ fs.writeFileSync(this.file, JSON.stringify(this.meta, null, 2) + "\n");
84
86
  files.push(this.file);
85
87
  }
86
88
  },
@@ -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 {DOCKER_LABEL_VERSION : version, DOCKER_LABEL_REPOSITORY : repository} = this.meta.labels;
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}) {
@@ -116,7 +119,7 @@ let modes = {
116
119
  if(repository)
117
120
  this.meta.repository = {type : "git", url : repository};
118
121
 
119
- fs.writeFileSync(this.file, JSON.stringify(this.meta, null, 2));
122
+ fs.writeFileSync(this.file, JSON.stringify(this.meta, null, 2) + "\n");
120
123
  files.push(this.file);
121
124
  }
122
125
 
@@ -164,20 +167,17 @@ class ppackage {
164
167
 
165
168
  async version(version = false, notag = false) {
166
169
 
167
- let current_repository, inconsistant_repo = false;
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
- if(!current_repository)
174
- current_repository = line.repository;
175
-
176
- inconsistant_repo |= line.repository != current_repository;
176
+ repositories.push(line.repository);
177
177
  }
178
178
 
179
- if(inconsistant_repo)
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();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ppackage",
3
- "version": "2.4.1",
3
+ "version": "2.4.3",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -32,4 +32,4 @@
32
32
  },
33
33
  "author": "",
34
34
  "license": "ISC"
35
- }
35
+ }