better logging; run_once check for pull state

master
garrettmills 4 years ago
parent f5b84b530c
commit ba8119903e
No known key found for this signature in database
GPG Key ID: 6ACD58D6ADACFC6E

@ -27,6 +27,7 @@ class Routine extends Injectable {
let step_no = 1 let step_no = 1
for ( const step of result.steps ) { for ( const step of result.steps ) {
if ( with_logging ) this.output.info('', 0)
this.output.info(`(${step_no}/${result.steps.length}) ${step.step.display()}`, with_logging ? 0 : 10) this.output.info(`(${step_no}/${result.steps.length}) ${step.step.display()}`, with_logging ? 0 : 10)
step_no += 1 step_no += 1

@ -13,10 +13,13 @@ class PermissionState extends State {
} }
async check() { async check() {
const path = await this._path() try {
const permissions = `${await path.permissions()}`.trim() const path = await this._path()
const target = `${this._config.level}`.trim() const permissions = `${await path.permissions()}`.trim()
return permissions === target const target = `${this._config.level}`.trim()
return permissions === target
} catch (e) {}
return false
} }
async reverse() { async reverse() {

@ -1,6 +1,8 @@
const AbstractGitState = require('./AbstractGitState') const AbstractGitState = require('./AbstractGitState')
class PullState extends AbstractGitState { class PullState extends AbstractGitState {
#ran_once = false
static get services() { static get services() {
return [...super.services, 'output'] return [...super.services, 'output']
} }
@ -9,11 +11,12 @@ class PullState extends AbstractGitState {
if ( !(await this.check()) ) { if ( !(await this.check()) ) {
const repo = await this._repo() const repo = await this._repo()
await repo.pull(this._config.target) await repo.pull(this._config.target)
this.#ran_once = true
} }
} }
async check() { async check() {
return true // TODO support a better check here return this.#ran_once // TODO support a better check here
} }
async reverse() { async reverse() {

Loading…
Cancel
Save