Skip to content

Commit

Permalink
fix: minor logging fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
edvald committed Apr 25, 2018
1 parent 5969914 commit bde56fa
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 8 deletions.
1 change: 0 additions & 1 deletion src/commands/auto-reload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ export class AutoReloadCommand extends Command {
})

registerCleanupFunction("clearAutoReloadWatches", () => {
ctx.log.info({ msg: "Clearing autoreload watches" })
watcher.end()
})

Expand Down
7 changes: 6 additions & 1 deletion src/commands/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,13 @@ export class BuildCommand extends Command<typeof buildArguments, typeof buildOpt

ctx.log.header({ emoji: "hammer", command: "build" })

return await ctx.processModules(modules, opts.watch, async (module) => {
const result = await ctx.processModules(modules, opts.watch, async (module) => {
await ctx.addTask(new BuildTask(ctx, module, opts.force))
})

ctx.log.info("")
ctx.log.header({ emoji: "heavy_check_mark", command: `Done!` })

return result
}
}
11 changes: 8 additions & 3 deletions src/commands/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,22 +44,27 @@ export class DeployCommand extends Command<typeof deployArgs, typeof deployOpts>
return {}
}

ctx.log.header({ emoji: "rocket", command: "Deploy" })

// TODO: make this a task
await ctx.configureEnvironment()

const watch = opts.watch
const force = opts.force
const forceBuild = opts["force-build"]

ctx.log.header({ emoji: "rocket", command: "Deploy" })

const modules = Array.from(new Set(values(services).map(s => s.module)))

return ctx.processModules(modules, watch, async (module) => {
const result = ctx.processModules(modules, watch, async (module) => {
const servicesToDeploy = values(await module.getServices()).filter(s => !!services[s.name])
for (const service of servicesToDeploy) {
await ctx.addTask(new DeployTask(ctx, service, force, forceBuild))
}
})

ctx.log.info("")
ctx.log.header({ emoji: "heavy_check_mark", command: `Done!` })

return result
}
}
4 changes: 2 additions & 2 deletions src/plugin-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -396,14 +396,14 @@ export function createPluginContext(garden: Garden): PluginContext {
// TODO: should the prefix here be different or set explicitly per run?
await watcher.watchModules(modules, "addTasksForAutoReload/",
async (changedModule) => {
ctx.log.info({ msg: `files changed for module ${changedModule.name}` })
ctx.log.debug({ msg: `Files changed for module ${changedModule.name}` })
await handleChanges(changedModule)
logErrors(await ctx.processTasks())
})

registerCleanupFunction("clearAutoReloadWatches", () => {
ctx.log.info({ msg: "Clearing autoreload watches" })
watcher.end()
ctx.log.info({ msg: "\nDone!" })
})

while (true) {
Expand Down
2 changes: 1 addition & 1 deletion src/watch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export async function watchModules(
const watcher = new FSWatcher(ctx.projectRoot)
await watcher.watchModules(modules, "addTasksForAutoReload/",
async (changedModule) => {
ctx.log.info({ msg: `files changed for module ${changedModule.name}` })
ctx.log.debug({ msg: `Files changed for module ${changedModule.name}` })
await handleChanges(changedModule)
await ctx.processTasks()
})
Expand Down

0 comments on commit bde56fa

Please sign in to comment.