Skip to content

Commit 7089f25

Browse files
authored
Merge pull request #4877 from ethereum/gitui
GIT UI ( squashed )
2 parents 68afece + 94737fd commit 7089f25

File tree

119 files changed

+10154
-599
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

119 files changed

+10154
-599
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,6 @@ apps/remixdesktop/release/
6464
apps/remix-ide/src/assets/list.json
6565
apps/remix-ide/src/assets/esbuild.wasm
6666
apps/remixdesktop/build*
67-
logs
67+
apps/remixdesktop/reports/
68+
apps/remixdesktop/logs/
69+
logs

apps/remix-ide-e2e/src/commands/addFile.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@ import { NightwatchBrowser, NightwatchContractContent } from 'nightwatch'
22
import EventEmitter from 'events'
33

44
class AddFile extends EventEmitter {
5-
command(this: NightwatchBrowser, name: string, content: NightwatchContractContent): NightwatchBrowser {
5+
command(this: NightwatchBrowser, name: string, content: NightwatchContractContent, readMeFile?:string): NightwatchBrowser {
6+
if(!readMeFile)
7+
readMeFile = 'README.txt'
68
this.api.perform((done) => {
7-
addFile(this.api, name, content, () => {
9+
addFile(this.api, name, content, readMeFile, () => {
810
done()
911
this.emit('complete')
1012
})
@@ -13,7 +15,8 @@ class AddFile extends EventEmitter {
1315
}
1416
}
1517

16-
function addFile(browser: NightwatchBrowser, name: string, content: NightwatchContractContent, done: VoidFunction) {
18+
function addFile(browser: NightwatchBrowser, name: string, content: NightwatchContractContent, readMeFile:string, done: VoidFunction) {
19+
const readmeSelector = `li[data-id="treeViewLitreeViewItem${readMeFile}"]`
1720
browser
1821
.isVisible({
1922
selector: "//*[@data-id='sidePanelSwapitTitle' and contains(.,'File explorer')]",
@@ -25,9 +28,9 @@ function addFile(browser: NightwatchBrowser, name: string, content: NightwatchCo
2528
browser.clickLaunchIcon('filePanel')
2629
}
2730
})
28-
.scrollInto('li[data-id="treeViewLitreeViewItemREADME.txt"]')
29-
.waitForElementVisible('li[data-id="treeViewLitreeViewItemREADME.txt"]')
30-
.click('li[data-id="treeViewLitreeViewItemREADME.txt"]').pause(1000) // focus on root directory
31+
.scrollInto(readmeSelector)
32+
.waitForElementVisible(readmeSelector)
33+
.click(readmeSelector).pause(1000) // focus on root directory
3134
.isVisible({
3235
selector: `//*[@data-id="treeViewLitreeViewItem${name}"]`,
3336
locateStrategy: 'xpath',
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"scripts": {
3+
"start:server": "npx ts-node server.ts"
4+
},
5+
"dependencies": {
6+
"body-parser": "^1.20.2",
7+
"child_process": "^1.0.2",
8+
"express": "^4.19.2",
9+
"git-http-backend": "^1.1.2",
10+
"path": "^0.12.7",
11+
"zlib": "^1.0.5"
12+
}
13+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import * as http from 'http';
2+
import { spawn } from 'child_process';
3+
import * as path from 'path';
4+
let backend = require('git-http-backend');
5+
import * as zlib from 'zlib';
6+
7+
const directory = process.argv[2];
8+
9+
if (!directory) {
10+
console.error('Please provide a directory as a command line argument.');
11+
process.exit(1);
12+
}
13+
14+
const server = http.createServer((req, res) => {
15+
16+
// Set CORS headers
17+
res.setHeader('Access-Control-Allow-Origin', '*');
18+
res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS, PUT, PATCH, DELETE');
19+
res.setHeader('Access-Control-Allow-Headers', 'X-Requested-With,content-type');
20+
res.setHeader('Access-Control-Allow-Credentials', 'true');
21+
22+
if (req.method === 'OPTIONS') {
23+
// Handle preflight request
24+
res.writeHead(204);
25+
res.end();
26+
return;
27+
}
28+
29+
const repo = req.url?.split('/')[1];
30+
const dir = path.join(directory, 'git', repo || '');
31+
console.log(dir);
32+
const reqStream = req.headers['content-encoding'] === 'gzip' ? req.pipe(zlib.createGunzip()) : req;
33+
34+
reqStream.pipe(backend(req.url || '', (err, service) => {
35+
if (err) return res.end(err + '\n');
36+
37+
res.setHeader('content-type', service.type);
38+
console.log(service.action, repo, service.fields);
39+
40+
const ps = spawn(service.cmd, [...service.args, dir]);
41+
ps.stdout.pipe(service.createStream()).pipe(ps.stdin);
42+
43+
})).pipe(res);
44+
});
45+
46+
server.listen(6868, () => {
47+
console.log('Server is listening on port 6868');
48+
});
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
cd /tmp/
3+
rm -rf git/bare.git
4+
rm -rf git
5+
mkdir -p git
6+
cd git
7+
git clone --bare https://github.com/ethereum/awesome-remix bare.git

0 commit comments

Comments
 (0)