Skip to content

Commit 4e08eda

Browse files
author
Waldemar Zurowski
committed
packageFileName is a proper closure
1 parent 3107842 commit 4e08eda

1 file changed

Lines changed: 9 additions & 11 deletions

File tree

lib/files.js

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,26 @@ var path = require('path');
22

33
module.exports = {
44
serviceFile: function (root, pkg) {
5-
return path.resolve(root, packageFileName(pkg) + '.service');
5+
return path.resolve(root, this.packageFileName(pkg) + '.service');
66
},
77
specsDirectory: function (root) {
88
return path.resolve(root, 'SPECS');
99
},
1010
specFile: function (root, pkg) {
11-
return path.resolve(root, packageFileName(pkg) + '.spec');
11+
return path.resolve(root, this.packageFileName(pkg) + '.spec');
1212
},
1313
sourcesDirectory: function (root) {
1414
return path.resolve(root, 'SOURCES');
1515
},
1616
sourcesArchive: function (root, pkg) {
1717
var sourcesDirectory = this.sourcesDirectory(root);
1818

19-
return path.resolve(sourcesDirectory, packageFileName(pkg) + '.tar.gz');
19+
return path.resolve(sourcesDirectory, this.packageFileName(pkg) + '.tar.gz');
2020
},
21-
packageFileName: packageFileName
21+
packageFileName: function (pkg) {
22+
return pkg.name[0] === '@'
23+
// scoped packages get special treatment
24+
? pkg.name.substr(1).replace(/\//g, '-')
25+
: pkg.name;
26+
}
2227
};
23-
24-
function packageFileName (pkg) {
25-
return pkg.name[0] === '@'
26-
// scoped packages get special treatment
27-
? pkg.name.substr(1).replace(/\//g, '-')
28-
: pkg.name;
29-
}

0 commit comments

Comments
 (0)