Skip to content

Commit

Permalink
fix: refactored template to source/BakeVariable
Browse files Browse the repository at this point in the history
  • Loading branch information
whilke committed Jan 18, 2019
1 parent 8391134 commit 9d9b405
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
9 changes: 5 additions & 4 deletions ingredient/ingredient-arm/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,18 @@ export class CustomArmIngredient extends BaseIngredient {

public async Execute(): Promise<void> {

let chk = fs.existsSync(this._ingredient.properties.template)
let source: string = this._ingredient.properties.source.value(this._ctx)
let chk = fs.existsSync(source)
if (!chk) {
this._logger.error('could not locate arm template: ' + this._ingredient.properties.template)
this._logger.error('could not locate arm template: ' + source)
return
}

let util = IngredientManager.getIngredientFunction("coreutils", this._ctx)

try {

this._logger.log('starting custom arm deployment for template: ' + this._ingredient.properties.template)
this._logger.log('starting custom arm deployment for template: ' + source)

//build the properties as a standard object.
let props : any = {
Expand All @@ -36,7 +37,7 @@ export class CustomArmIngredient extends BaseIngredient {
this._logger.log('param: ' + p)
})

let buffer = fs.readFileSync(this._ingredient.properties.template)
let buffer = fs.readFileSync(source)
let contents = buffer.toString()
let deployment = <Deployment>{
properties : <DeploymentProperties>{
Expand Down
10 changes: 6 additions & 4 deletions ingredient/ingredient-script/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,19 @@ export class CustomScriptIngredient extends BaseIngredient {

public async Execute(): Promise<void> {

let chk = fs.existsSync(this._ingredient.properties.template)
let source: string = this._ingredient.properties.source.value(this._ctx)

let chk = fs.existsSync(source)
if (!chk) {
this._logger.error('could not locate custom script: ' + this._ingredient.properties.template)
this._logger.error('could not locate custom script: ' + source)
return
}

let buffer = fs.readFileSync(this._ingredient.properties.template)
let buffer = fs.readFileSync(source)
let contents = buffer.toString()

try {
this._logger.log("Executing custom script: " + this._ingredient.properties.template)
this._logger.log("Executing custom script: " + source)

contents = ts.transpile(contents)

Expand Down

0 comments on commit 9d9b405

Please sign in to comment.