@@ -4,7 +4,7 @@ var readConfig = require("../read-config");
44var Variation = require ( "../variation" ) ;
55var Experiment = require ( "../experiment" ) ;
66var logger = require ( "../logger" ) ;
7- var OptimizelyClient = require ( "../ optimizely-client" ) ;
7+ var OptimizelyClient = require ( ' optimizely-node- client' ) ;
88
99module . exports = function ( folder , program ) {
1010 //find the variation
@@ -19,23 +19,26 @@ module.exports = function(folder, program) {
1919
2020 logger . log ( "info" , "pushing variation at " + folder ) ;
2121 readConfig ( "token" ) . then ( function ( token ) {
22- client = new OptimizelyClient ( token ) ;
23- //if we already have an id, then update
24- if ( variation . attributes . id ) {
25- variation . updateRemote ( client ) ;
26- } else {
27- //find the experiment
28- this . experiment = new Experiment ( { } , path . normalize ( variation . baseDir + "/.." ) ) ;
29- this . experiment . loadFromFile ( ) ;
30- if ( ! experiment . attributes . id ) {
31- logger . log ( "error" , "no id found for experiment. Please run push-experiment first" ) ;
32- return ;
22+ client = new OptimizelyClient ( token ) ;
23+ //if we already have an id, then update
24+ if ( variation . attributes . id ) {
25+ variation . updateRemote ( client ) ;
26+ } else {
27+ //find the experiment
28+ this . experiment = new Experiment ( { } , path . normalize ( variation . baseDir +
29+ "/.." ) ) ;
30+ this . experiment . loadFromFile ( ) ;
31+ if ( ! experiment . attributes . id ) {
32+ logger . log ( "error" ,
33+ "no id found for experiment. Please run push-experiment first"
34+ ) ;
35+ return ;
36+ }
37+ variation . createRemote ( client , experiment ) ;
3338 }
34- variation . createRemote ( client , experiment ) ;
35- }
36- } ) . catch ( function ( error ) {
37- // Handle any error from all above steps
38- logger . log ( "error" , error . stack ) ;
39- } )
40- . done ( ) ;
39+ } ) . catch ( function ( error ) {
40+ // Handle any error from all above steps
41+ logger . log ( "error" , error . stack ) ;
42+ } )
43+ . done ( ) ;
4144}
0 commit comments