mirror of
https://github.com/balena-io/balena-cli.git
synced 2024-12-28 09:38:51 +00:00
Reimplement app init with resin.vcs
This commit is contained in:
parent
8d5bba9558
commit
596446835a
@ -63,15 +63,24 @@ exports.remove = (id) ->
|
|||||||
|
|
||||||
exports.init = (id) ->
|
exports.init = (id) ->
|
||||||
|
|
||||||
|
currentDirectory = process.cwd()
|
||||||
|
|
||||||
async.waterfall [
|
async.waterfall [
|
||||||
|
|
||||||
|
(callback) ->
|
||||||
|
resin.vcs.wasInitialized(currentDirectory, callback)
|
||||||
|
|
||||||
|
(wasInitialized, callback) ->
|
||||||
|
if wasInitialized
|
||||||
|
error = new Error('Project is already a resin application.')
|
||||||
|
return callback(error)
|
||||||
|
return callback()
|
||||||
|
|
||||||
(callback) ->
|
(callback) ->
|
||||||
resin.models.application.get(id, callback)
|
resin.models.application.get(id, callback)
|
||||||
|
|
||||||
(application, callback) ->
|
(application, callback) ->
|
||||||
path = require('path')
|
resin.vcs.initApplication(application, currentDirectory, callback)
|
||||||
repository = new gitCli.Repository(path.join(process.cwd(), '.git'))
|
|
||||||
repository.addRemote('resin', application.git_repository, callback)
|
|
||||||
|
|
||||||
], (error) ->
|
], (error) ->
|
||||||
resin.errors.handle(error) if error?
|
resin.errors.handle(error) if error?
|
||||||
|
Loading…
Reference in New Issue
Block a user