|
|
@@ -2294,17 +2294,25 @@ var __acquireConfig = function (selected, owner, clusternodename, configrepo, er |
|
|
|
} |
|
|
|
|
|
|
|
if(e.messages.join(' ').match(new RegExp (`fatal: repository '${selectedinstance.reposerver}/${owner}/${configrepo}.git/' not found`))){ |
|
|
|
return cli.prompt( { |
|
|
|
t : 'install a new temporary local instance with this name' |
|
|
|
, i : 'create a new instance with this name => will fork the default config under your username' |
|
|
|
, f : 'fork a new instance with this name for yourself for this node from another instance' |
|
|
|
, o : 'fork a new instance with this name for your organization from another instance' // prompt organization name... |
|
|
|
, c : 'create a custom config for yourself for this node' // prompt hostname as nodename |
|
|
|
, p : 'create a custom config for yourself ' |
|
|
|
, e : 'exit'} |
|
|
|
var choices = { |
|
|
|
t : `install a new temporary local instance with this name ( will not persist ). |
|
|
|
Use your own username for additional options. You can request for a username at chess@bbh.org.in )` |
|
|
|
, e : 'exit' } |
|
|
|
|
|
|
|
if(selectedinstance.username !== 'guest' && selectedinstance.username !== 'demo') { |
|
|
|
choices = utils.assign({ |
|
|
|
i : 'create a new instance with this name => will fork the default config under your username' |
|
|
|
, f : 'fork a new instance with this name for yourself for this node from another instance' |
|
|
|
, o : 'fork a new instance with this name for your organization from another instance' // prompt organization name... |
|
|
|
, c : 'create a custom config for yourself for this node' // prompt hostname as nodename |
|
|
|
, p : 'create a custom config for yourself ' |
|
|
|
}, choices) |
|
|
|
} |
|
|
|
|
|
|
|
return cli.prompt( choices |
|
|
|
, 'Config for instance not found. Would you like to ', 'e' ).then(propValue => { |
|
|
|
|
|
|
|
if(propValue === 't') return eNotImplemented() |
|
|
|
if(propValue === 't') return createInstance() |
|
|
|
if(propValue === 'i') return eNotImplemented() |
|
|
|
if(propValue === 'f') return eNotImplemented() |
|
|
|
if(propValue === 'o') return eNotImplemented() |
|
|
@@ -3308,23 +3316,40 @@ const GIT = (function(){ |
|
|
|
|
|
|
|
function createInstance(selectedinstance) { |
|
|
|
|
|
|
|
// http://try.gitea.io/api/v1/org/{org}/repos |
|
|
|
console.dir(selectedinstance) |
|
|
|
var server = new URL(selectedinstance.reposerver); |
|
|
|
return GITEA.repository.fork( { hostname : server.host, protocol : server.protocol |
|
|
|
, username : selectedinstance.username, password : selectedinstance.password |
|
|
|
} |
|
|
|
// , { repo : `${selectedinstance.instanceName}-config-${selectedinstance.instanceType}`} |
|
|
|
, { repo : `chess-config`, owner : 'chess' }, {}, function( repository ){ |
|
|
|
return GITEA.repository.updateattributes( { |
|
|
|
hostname : server.host, protocol : server.protocol |
|
|
|
, username : selectedinstance.username, password : selectedinstance.password |
|
|
|
} |
|
|
|
, { repo : `chess-config`, owner : selectedinstance.username } |
|
|
|
, { name : `${selectedinstance.instanceName}-config-${selectedinstance.instanceType}${selectedinstance.nodeName ? '-' + selectedinstance.nodeName : ''}`} |
|
|
|
) |
|
|
|
} |
|
|
|
) |
|
|
|
if(selectedinstance.local) { |
|
|
|
selectedinstance |
|
|
|
var args = { |
|
|
|
remotebase : selectedinstance.reposerver + '/chess/' |
|
|
|
, sourcerepo : 'chess-config' |
|
|
|
, targetrepo : `${selectedinstance.instanceName}-config-${selectedinstance.instanceType}` |
|
|
|
} |
|
|
|
|
|
|
|
cmdseq = ['git', ['clone', `${args.remotebase}${args.sourcerepo}`, `${args.targetrepo}`], options] |
|
|
|
|
|
|
|
return any(cmdseq.map(getshelltask)).then(() => { |
|
|
|
return true |
|
|
|
}) |
|
|
|
} |
|
|
|
else { |
|
|
|
// http://try.gitea.io/api/v1/org/{org}/repos |
|
|
|
|
|
|
|
var server = new URL(selectedinstance.reposerver); |
|
|
|
return GITEA.repository.fork( { hostname : server.host, protocol : server.protocol |
|
|
|
, username : selectedinstance.username, password : selectedinstance.password |
|
|
|
} |
|
|
|
// , { repo : `${selectedinstance.instanceName}-config-${selectedinstance.instanceType}`} |
|
|
|
, { repo : `chess-config`, owner : 'chess' }, {}, function( repository ){ |
|
|
|
return GITEA.repository.updateattributes( { |
|
|
|
hostname : server.host, protocol : server.protocol |
|
|
|
, username : selectedinstance.username, password : selectedinstance.password |
|
|
|
} |
|
|
|
, { repo : `chess-config`, owner : selectedinstance.username } |
|
|
|
, { name : `${selectedinstance.instanceName}-config-${selectedinstance.instanceType}${selectedinstance.nodeName ? '-' + selectedinstance.nodeName : ''}`} |
|
|
|
) |
|
|
|
} |
|
|
|
) |
|
|
|
} |
|
|
|
|
|
|
|
// GITEA.repository.updateattributes( { |
|
|
|
// hostname : server.host, protocol : server.protocol |