@@ -21,22 +21,22 @@ module.exports = {
21
21
name : 'ember-cli-deploy-json-config' ,
22
22
23
23
createDeployPlugin : function ( options ) {
24
- function _beginMessage ( ui , inputPattern , outputPattern ) {
25
- ui . write ( blue ( '| ' ) ) ;
26
- ui . writeLine ( blue ( '- generating `' + outputPattern + '` from `' + inputPattern + '`' ) ) ;
24
+ function _beginMessage ( ui , inputPath , outputPath ) {
25
+ ui . write ( blue ( '| ' ) ) ;
26
+ ui . writeLine ( blue ( '- generating `' + outputPath + '` from `' + inputPath + '`' ) ) ;
27
27
28
28
return Promise . resolve ( ) ;
29
29
}
30
30
31
- function _successMessage ( ui , outputPattern ) {
32
- ui . write ( blue ( '| ' ) ) ;
33
- ui . writeLine ( blue ( '- generated: `' + outputPattern + '`' ) ) ;
31
+ function _successMessage ( ui , outputPath ) {
32
+ ui . write ( blue ( '| ' ) ) ;
33
+ ui . writeLine ( blue ( '- generated: `' + outputPath + '`' ) ) ;
34
34
35
- return Promise . resolve ( outputPattern ) ;
35
+ return Promise . resolve ( ) ;
36
36
}
37
37
38
38
function _errorMessage ( ui , error ) {
39
- ui . write ( blue ( '| ' ) ) ;
39
+ ui . write ( blue ( '| ' ) ) ;
40
40
ui . write ( red ( '- ' + error + '`\n' ) ) ;
41
41
42
42
return Promise . reject ( error ) ;
@@ -62,20 +62,26 @@ module.exports = {
62
62
var ui = deployment . ui ;
63
63
var config = deployment . config [ this . name ] ;
64
64
var project = deployment . project ;
65
- var root = project . root ;
66
-
67
- var fileInputPattern = config . fileInputPattern ;
68
- var fileOutputPattern = config . fileOutputPattern ;
69
- var inputPath = path . join ( root , fileInputPattern ) ;
70
- var outputPath = path . join ( root , fileOutputPattern ) ;
71
65
72
- return _beginMessage ( ui , fileInputPattern , fileOutputPattern )
73
- . then ( readFile . bind ( readFile , inputPath ) )
66
+ var root = project . root ;
67
+ var distDir = context . distDir ;
68
+ var fileInputPattern = config . fileInputPattern ;
69
+ var fileOutputPattern = config . fileOutputPattern ;
70
+ var inputPath = path . join ( distDir , fileInputPattern ) ;
71
+ var outputPath = path . join ( distDir , fileOutputPattern ) ;
72
+ var absoluteInputPath = path . join ( root , inputPath ) ;
73
+ var absoluteOutputPath = path . join ( root , outputPath ) ;
74
+
75
+ return _beginMessage ( ui , inputPath , outputPath )
76
+ . then ( readFile . bind ( readFile , absoluteInputPath ) )
74
77
. then ( extractConfig . bind ( this ) )
75
- . then ( writeFile . bind ( writeFile , outputPath ) )
76
- . then ( _successMessage . bind ( this , ui , fileOutputPattern ) )
77
- . then ( function ( outputPattern ) {
78
- return { distFiles : [ outputPattern ] } ;
78
+ . then ( writeFile . bind ( writeFile , absoluteOutputPath ) )
79
+ . then ( _successMessage . bind ( this , ui , outputPath ) )
80
+ . then ( function ( ) {
81
+ ui . write ( blue ( '| ' ) ) ;
82
+ ui . writeLine ( blue ( '- added `' + fileOutputPattern + '` to `context.distFiles`' ) ) ;
83
+
84
+ return { distFiles : [ fileOutputPattern ] } ;
79
85
} )
80
86
. catch ( _errorMessage . bind ( this , ui ) ) ;
81
87
}
0 commit comments