Add support for running routines via command line
This commit is contained in:
@@ -40,6 +40,10 @@ class CheckoutState extends AbstractGitState {
|
||||
check_message() {
|
||||
return this.failure_message()
|
||||
}
|
||||
|
||||
display() {
|
||||
return `Check out ref ${this._config.target} in repo ${this._config.path}...`
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = exports = CheckoutState
|
||||
|
||||
@@ -30,6 +30,10 @@ class CloneState extends AbstractGitState {
|
||||
check_message() {
|
||||
return this.failure_message()
|
||||
}
|
||||
|
||||
display() {
|
||||
return `Clone repo at ${this._config.source} to ${this._config.path}...`
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = exports = CloneState
|
||||
|
||||
36
app/classes/state/git/PullState.js
Normal file
36
app/classes/state/git/PullState.js
Normal file
@@ -0,0 +1,36 @@
|
||||
const AbstractGitState = require('./AbstractGitState')
|
||||
|
||||
class PullState extends AbstractGitState {
|
||||
static get services() {
|
||||
return [...super.services, 'output']
|
||||
}
|
||||
|
||||
async apply() {
|
||||
if ( !(await this.check()) ) {
|
||||
const repo = await this._repo()
|
||||
await repo.pull(this._config.target)
|
||||
}
|
||||
}
|
||||
|
||||
async check() {
|
||||
return true // TODO support a better check here
|
||||
}
|
||||
|
||||
async reverse() {
|
||||
this.output.warn('Pull state does not currently support automatic reversal.')
|
||||
}
|
||||
|
||||
failure_message() {
|
||||
return `The Git repo at "${this._config.path}" on host "${this._host.name}" will be pulled.`
|
||||
}
|
||||
|
||||
check_message() {
|
||||
return this.failure_message()
|
||||
}
|
||||
|
||||
display() {
|
||||
return `Pull refs in repo ${this._config.path}...`
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = exports = PullState
|
||||
@@ -33,6 +33,10 @@ class TagState extends AbstractGitState {
|
||||
check_message() {
|
||||
return this.failure_message()
|
||||
}
|
||||
|
||||
display() {
|
||||
return `Create tag ${this._config.tag} in repo ${this._config.path}...`
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = exports = TagState
|
||||
|
||||
Reference in New Issue
Block a user