takuya 3 лет назад
Родитель
Сommit
ea782e72ac
1 измененных файлов с 4 добавлено и 7 удалено
  1. 4 7
      packages/app/src/server/service/plugin.ts

+ 4 - 7
packages/app/src/server/service/plugin.ts

@@ -1,5 +1,6 @@
 
 import { execSync } from 'child_process';
+import fs from 'fs';
 import path from 'path';
 
 import mongoose from 'mongoose';
@@ -45,17 +46,13 @@ export class PluginService {
 
     // TODO: detect plugins
     // save plugin metadata
-    const installedSamplePath = '/workspace/growi/packages/app/tmp/plugins/hogerepository/meta.json';
-    await this.savePluginMetaData(installedSamplePath);
+    const ghRepositoryName = ghUrl.split('/').slice(-1)[0];
+    const installedPath = path.join(downloadDir, ghRepositoryName, 'meta.json');
+    await this.savePluginMetaData(installedPath);
 
     return;
   }
 
-  parseRepositoryName(ghUrl: string): string {
-    ghUrl.slice();
-    return 'hoge';
-  }
-
   async savePluginMetaData(installedPath: string): Promise<void> {
     const metaData = this.getPluginMetaData(installedPath);
     const GrowiPlugin = mongoose.model('GrowiPlugin');