Selaa lähdekoodia

Fixes

master^2
guest 3 vuotta sitten
vanhempi
commit
940a4ac87e
2 muutettua tiedostoa jossa 751 lisäystä ja 670 poistoa
  1. 682
    660
      i.win.js
  2. 69
    10
      index.js

+ 682
- 660
i.win.js
File diff suppressed because it is too large
Näytä tiedosto


+ 69
- 10
index.js Näytä tiedosto

@@ -1580,9 +1580,9 @@ var op = {
var promise = new Promise((resolve, reject)=>{
existslink('config', function(err, data){
if(data) {
var p = nodeShellExec('rmdir', ['config'], { inherit: true, shell: true, env: process.env }
).catch((err) => { console.log('Ignoring benign error : ' + err); return true; })
return resolve(p);
var p = nodeShellExec('rmdir', ['config'], { inherit: true, shell: true, env: process.env })
.then(()=>{resolve(true)})
.catch((err) => { console.log('Ignoring benign error : ' + err); return resolve(true); })
}
else resolve(false)
})
@@ -1593,9 +1593,9 @@ var op = {
var promise = new Promise((resolve, reject)=>{
existslink('data', function(err, data){
if(data) {
var p = nodeShellExec('rmdir', ['data'], { inherit: true, shell: true, env: process.env }
).catch((err) => { console.log('Ignoring benign error : ' + err); return true; })
return resolve(p);
var p = nodeShellExec('rmdir', ['data'], { inherit: true, shell: true, env: process.env })
.then(()=>{resolve(true)})
.catch((err) => { console.log('Ignoring benign error : ' + err); return resolve(true); })
}
else resolve(false)
})
@@ -1760,7 +1760,7 @@ var op = {
tasks = tasks.concat(
[
() => {
var p = nodeShellExec('mklink', ['/J', 'data', runconfig.use + '-data'], {
var p = nodeShellExec('mklink', ['/J', 'data', runconfig.use + '-data' + '-' + process.env.NODE_ENV], {
inherit: true, shell: true
, cwd : instanceroot
, env: process.env
@@ -2419,7 +2419,7 @@ var __acquireConfig = function (selected, owner, clusternodename, configrepo, er

var __acquireData = function (selected, owner, clusternodename, datarepo, errHandler) {

datarepo = datarepo || selected.instanceName + '-config-' + selected.node_env;
datarepo = datarepo || selected.instanceName + '-data-' + selected.node_env;

var errorHandler = (e) => {
if(e.messages.join(' ').match(new RegExp (`fatal: unable to access '${selectedinstance.reposerver}/${owner}/${datarepo}.git/': Failed to connect to .*? port .*? after .*? ms: Timed out`))){
@@ -2439,8 +2439,8 @@ var __acquireData = function (selected, owner, clusternodename, datarepo, errHan

if(e.messages.join(' ').match(new RegExp (`fatal: repository '${selectedinstance.reposerver}/${owner}/${datarepo}.git/' not found`))){
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 )`
t : `install a temporary local data folder.
For more options. Request and use a personal username at chess@bbh.org.in )`
, e : 'exit' }

if(selectedinstance.username !== 'guest' && selectedinstance.username !== 'demo') {
@@ -3452,6 +3452,65 @@ const GIT = (function(){
return GIT
})();

function createInstanceData(target, source) {

var sourceinstance = source || target;
console.dir(sourceinstance)
var args = {
remotebase : sourceinstance.reposerver + '/chess/'
, sourcerepo : sourceinstance.repo || 'chess-data'
, targetrepo : `${target.instanceName}-data-${target.instanceType}${target.nodeName ? ('-' + target.nodeName) : ''}`
}

if(sourceinstance.local) {

var options = {
inherit: true, shell: true,
env: process.env
, cwd : instanceroot
, runas: processedArgs.runas
}
var 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
if(source.reposerver !== target.reposerver && source.username !== target.username) {
throw 'createInstanceData is possible only within the same repository server.'
}

var server = new URL(target.reposerver);
return GITEA.repository.fork( { hostname : server.host, protocol : server.protocol
, username : target.username, password : target.password
}
// , { repo : `${selectedinstance.instanceName}-config-${selectedinstance.instanceType}`}
, { repo : `${args.sourcerepo}`, owner : `${target.username}` }, {}, function( repository ){
return GITEA.repository.updateattributes( {
hostname : server.host, protocol : server.protocol
, username : target.username, password : target.password
}
, { repo : `${args.sourcerepo}`, owner : `${target.username}` }
, { name : `${args.targetrepo}`}
)
}
)
}
// 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 : ''}`}
// )
// return selectedinstance
}


function createInstance(target, source) {

var sourceinstance = source || target;

Loading…
Peruuta
Tallenna