✨ Replace test project by adding content to the create project
This commit is contained in:
-117
@@ -33,7 +33,6 @@ class App
|
|||||||
{
|
{
|
||||||
this.setSocket()
|
this.setSocket()
|
||||||
this.setProjects()
|
this.setProjects()
|
||||||
this.setTest()
|
|
||||||
},
|
},
|
||||||
() =>
|
() =>
|
||||||
{
|
{
|
||||||
@@ -291,122 +290,6 @@ class App
|
|||||||
{
|
{
|
||||||
this.watcher = new Watcher(this.config)
|
this.watcher = new Watcher(this.config)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Set Test
|
|
||||||
*/
|
|
||||||
setTest()
|
|
||||||
{
|
|
||||||
if(!this.config.test)
|
|
||||||
{
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log('app'.green.bold + ' - ' + 'start test folder'.cyan)
|
|
||||||
|
|
||||||
// Default project
|
|
||||||
const project = this.projects.createProject('Test project')
|
|
||||||
this.site.createProject(project.slug, path.join(__dirname, '../test/demo-folder/'))
|
|
||||||
|
|
||||||
// // Same name projects
|
|
||||||
// let project_2 = this.projects.createProject('dummy')
|
|
||||||
// let project_3 = this.projects.createProject('dummy')
|
|
||||||
// let project_4 = this.projects.createProject('dummy')
|
|
||||||
// let project_5 = this.projects.createProject('dummy')
|
|
||||||
|
|
||||||
// Some file
|
|
||||||
// project.files.createVersion('./folder-test/test-4.css', fs.readFileSync('../test/demo-folder/folder-1/test-4.css', 'utf8'))
|
|
||||||
// project.files.createVersion('./folder-test/depth-test/test-3.js', fs.readFileSync('../test/demo-folder/folder-2/test-3.js', 'utf8'))
|
|
||||||
// project.files.createVersion('./folder-test/depth-test/test-3.js', fs.readFileSync('../test/demo-folder/folder-2/test-3-diff-1.js', 'utf8'))
|
|
||||||
// project.files.createVersion('./folder-test/depth-test/test-3.js', fs.readFileSync('../test/demo-folder/folder-2/test-3-diff-2.js', 'utf8'))
|
|
||||||
// project.files.createVersion('./folder-test/depth-test/test-3.js', fs.readFileSync('../test/demo-folder/folder-2/test-3-diff-3.js', 'utf8'))
|
|
||||||
// project.files.createVersion('./folder-test/depth-test/test-3.js', fs.readFileSync('../test/demo-folder/folder-2/test-3-diff-4.js', 'utf8'))
|
|
||||||
// project.files.createVersion('./folder-test/test-1.html', fs.readFileSync('../test/demo-folder/test-1.html', 'utf8'))
|
|
||||||
// project.files.createVersion('./folder-test/test-2.php', fs.readFileSync('../test/demo-folder/test-2.php', 'utf8'))
|
|
||||||
// project.files.createVersion('./folder-test/big-one.txt', 'line\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline')
|
|
||||||
// project.files.createVersion('./folder-test/loooooooooooooooooooooooooooooooong-one.txt', 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz')
|
|
||||||
|
|
||||||
project.files.createVersion('./icons/test.js', 'Test icon')
|
|
||||||
project.files.createVersion('./icons/test.html', 'Test icon')
|
|
||||||
project.files.createVersion('./icons/test.sass', 'Test icon')
|
|
||||||
project.files.createVersion('./icons/test.scss', 'Test icon')
|
|
||||||
project.files.createVersion('./icons/test.less', 'Test icon')
|
|
||||||
project.files.createVersion('./icons/test.stylus', 'Test icon')
|
|
||||||
project.files.createVersion('./icons/test.styl', 'Test icon')
|
|
||||||
project.files.createVersion('./icons/test.css', 'Test icon')
|
|
||||||
project.files.createVersion('./icons/test.php', 'Test icon')
|
|
||||||
project.files.createVersion('./icons/test.json', 'Test icon')
|
|
||||||
project.files.createVersion('./icons/test.jade', 'Test icon')
|
|
||||||
project.files.createVersion('./icons/test.pug', 'Test icon')
|
|
||||||
project.files.createVersion('./icons/test.md', 'Test icon')
|
|
||||||
project.files.createVersion('./icons/test.sql', 'Test icon')
|
|
||||||
project.files.createVersion('./icons/test.htaccess', 'Test icon')
|
|
||||||
project.files.createVersion('./icons/test.htpasswd', 'Test icon')
|
|
||||||
project.files.createVersion('./icons/test.yml', 'Test icon')
|
|
||||||
project.files.createVersion('./icons/test.svg', 'Test icon')
|
|
||||||
project.files.createVersion('./icons/test.eot', 'Test icon')
|
|
||||||
project.files.createVersion('./icons/test.ttf', 'Test icon')
|
|
||||||
project.files.createVersion('./icons/test.woff', 'Test icon')
|
|
||||||
project.files.createVersion('./icons/test.woff2', 'Test icon')
|
|
||||||
project.files.createVersion('./icons/test.jpeg', 'Test icon')
|
|
||||||
project.files.createVersion('./icons/test.jpg', 'Test icon')
|
|
||||||
project.files.createVersion('./icons/test.tiff', 'Test icon')
|
|
||||||
project.files.createVersion('./icons/test.gif', 'Test icon')
|
|
||||||
project.files.createVersion('./icons/test.bmp', 'Test icon')
|
|
||||||
project.files.createVersion('./icons/test.png', 'Test icon')
|
|
||||||
project.files.createVersion('./icons/test.webp', 'Test icon')
|
|
||||||
project.files.createVersion('./icons/test.mpeg', 'Test icon')
|
|
||||||
project.files.createVersion('./icons/test.mpg', 'Test icon')
|
|
||||||
project.files.createVersion('./icons/test.mp4', 'Test icon')
|
|
||||||
project.files.createVersion('./icons/test.amv', 'Test icon')
|
|
||||||
project.files.createVersion('./icons/test.wmv', 'Test icon')
|
|
||||||
project.files.createVersion('./icons/test.mov', 'Test icon')
|
|
||||||
project.files.createVersion('./icons/test.avi', 'Test icon')
|
|
||||||
project.files.createVersion('./icons/test.ogv', 'Test icon')
|
|
||||||
project.files.createVersion('./icons/test.mkv', 'Test icon')
|
|
||||||
project.files.createVersion('./icons/test.webm', 'Test icon')
|
|
||||||
project.files.createVersion('./icons/test.mp3', 'Test icon')
|
|
||||||
project.files.createVersion('./icons/test.wav', 'Test icon')
|
|
||||||
project.files.createVersion('./icons/test.ogg', 'Test icon')
|
|
||||||
project.files.createVersion('./icons/test.raw', 'Test icon')
|
|
||||||
project.files.createVersion('./icons/test.zip', 'Test icon')
|
|
||||||
project.files.createVersion('./icons/test.rar', 'Test icon')
|
|
||||||
project.files.createVersion('./icons/test.7z', 'Test icon')
|
|
||||||
project.files.createVersion('./icons/test.gz', 'Test icon')
|
|
||||||
project.files.createVersion('./icons/test.txt', 'Test icon')
|
|
||||||
project.files.createVersion('./icons/test.coffee', 'Test icon')
|
|
||||||
project.files.createVersion('./icons/test.gitignore', 'Test icon')
|
|
||||||
project.files.createVersion('./icons/test.gitkeep', 'Test icon')
|
|
||||||
project.files.createVersion('./icons/test.xml', 'Test icon')
|
|
||||||
project.files.createVersion('./icons/test.twig', 'Test icon')
|
|
||||||
project.files.createVersion('./icons/test.c', 'Test icon')
|
|
||||||
project.files.createVersion('./icons/test.h', 'Test icon')
|
|
||||||
project.files.createVersion('./icons/test.pwet', 'Test icon')
|
|
||||||
|
|
||||||
// project.files.createVersion('./toto/tata/lorem.txt', '123456789')
|
|
||||||
// project.files.createVersion('./toto/tata/lorem.txt', '1aze')
|
|
||||||
// project.files.createVersion('./toto/tata/ipsum.txt', 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Mollitia asperiores iure, animi voluptatibus ut officiis. Molestias, quod perferendis hic totam doloremque, porro aperiam enim tenetur, maxime inventore consequuntur nisi in?')
|
|
||||||
|
|
||||||
// Adding file versions
|
|
||||||
let counting = 0
|
|
||||||
setInterval(function()
|
|
||||||
{
|
|
||||||
project.files.createVersion('./folder-test/multi-version.txt', 'test: ' + counting++)
|
|
||||||
}, 2000)
|
|
||||||
|
|
||||||
// Creating and deleting file
|
|
||||||
let toggle = true
|
|
||||||
setInterval(function()
|
|
||||||
{
|
|
||||||
if(toggle)
|
|
||||||
project.files.create('./folder-test/toggle.txt', 'content')
|
|
||||||
else
|
|
||||||
project.files.delete('./folder-test/toggle.txt', 'content')
|
|
||||||
|
|
||||||
toggle = !toggle
|
|
||||||
}, 3000)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = App
|
module.exports = App
|
||||||
|
|||||||
+172
-6
@@ -13,17 +13,27 @@ class Project
|
|||||||
constructor(_config, _options)
|
constructor(_config, _options)
|
||||||
{
|
{
|
||||||
this.config = _config
|
this.config = _config
|
||||||
|
|
||||||
this.zipNeedsUpdate = true
|
|
||||||
this.name = _options.name
|
|
||||||
this.path = _options.path
|
this.path = _options.path
|
||||||
this.excludeRegex = new RegExp(_options.excludeRegex)
|
|
||||||
this.slug = slug(this.name, { lower: true })
|
|
||||||
|
|
||||||
|
this.setName(_options.name)
|
||||||
this.setSocket()
|
this.setSocket()
|
||||||
|
|
||||||
|
this.excludeRegex = new RegExp(_options.excludeRegex)
|
||||||
|
this.zipNeedsUpdate = true
|
||||||
this.files = new Files(this.config, { projectSocket: this.projectSocket })
|
this.files = new Files(this.config, { projectSocket: this.projectSocket })
|
||||||
this.date = new Date()
|
this.date = new Date()
|
||||||
|
|
||||||
|
// Add test contents
|
||||||
|
if(this.config.test)
|
||||||
|
{
|
||||||
|
this.addTestContents()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
setName(_name)
|
||||||
|
{
|
||||||
|
this.name = _name
|
||||||
|
this.slug = slug(this.name, { lower: true })
|
||||||
}
|
}
|
||||||
|
|
||||||
setSocket()
|
setSocket()
|
||||||
@@ -90,6 +100,162 @@ class Project
|
|||||||
|
|
||||||
return this.zipBuffer
|
return this.zipBuffer
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Add Test contents
|
||||||
|
*/
|
||||||
|
addTestContents()
|
||||||
|
{
|
||||||
|
console.log('project'.green.bold + ' - ' + 'add test contents'.cyan)
|
||||||
|
|
||||||
|
// Add some with true contents
|
||||||
|
this.files.createVersion('./test/file.css', `
|
||||||
|
body {
|
||||||
|
margin:0;
|
||||||
|
padding:0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toto .tata > span {
|
||||||
|
background:url('kikoo.png') top left repeat-x;
|
||||||
|
}
|
||||||
|
`)
|
||||||
|
this.files.createVersion('./test/file.js', `
|
||||||
|
'use strict'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test
|
||||||
|
*/
|
||||||
|
class ClassName extends AnotherClass
|
||||||
|
{
|
||||||
|
constructor( argument )
|
||||||
|
{
|
||||||
|
// code...
|
||||||
|
}
|
||||||
|
|
||||||
|
test()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`)
|
||||||
|
this.files.createVersion('./test/file.php', `
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test
|
||||||
|
*/
|
||||||
|
class ClassName extends AnotherClass
|
||||||
|
{
|
||||||
|
|
||||||
|
function __construct( argument )
|
||||||
|
{
|
||||||
|
// code...
|
||||||
|
}
|
||||||
|
|
||||||
|
function test()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`)
|
||||||
|
this.files.createVersion('./test/file.html', `
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Document</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<section>
|
||||||
|
Bonjour
|
||||||
|
<form action="#">
|
||||||
|
<input type="text">
|
||||||
|
</form>
|
||||||
|
</section>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
`)
|
||||||
|
|
||||||
|
// Add some with icons
|
||||||
|
this.files.createVersion('./test/icons/test.js', 'Test icon')
|
||||||
|
this.files.createVersion('./test/icons/test.html', 'Test icon')
|
||||||
|
this.files.createVersion('./test/icons/test.sass', 'Test icon')
|
||||||
|
this.files.createVersion('./test/icons/test.scss', 'Test icon')
|
||||||
|
this.files.createVersion('./test/icons/test.less', 'Test icon')
|
||||||
|
this.files.createVersion('./test/icons/test.stylus', 'Test icon')
|
||||||
|
this.files.createVersion('./test/icons/test.styl', 'Test icon')
|
||||||
|
this.files.createVersion('./test/icons/test.css', 'Test icon')
|
||||||
|
this.files.createVersion('./test/icons/test.php', 'Test icon')
|
||||||
|
this.files.createVersion('./test/icons/test.json', 'Test icon')
|
||||||
|
this.files.createVersion('./test/icons/test.jade', 'Test icon')
|
||||||
|
this.files.createVersion('./test/icons/test.pug', 'Test icon')
|
||||||
|
this.files.createVersion('./test/icons/test.md', 'Test icon')
|
||||||
|
this.files.createVersion('./test/icons/test.sql', 'Test icon')
|
||||||
|
this.files.createVersion('./test/icons/test.htaccess', 'Test icon')
|
||||||
|
this.files.createVersion('./test/icons/test.htpasswd', 'Test icon')
|
||||||
|
this.files.createVersion('./test/icons/test.yml', 'Test icon')
|
||||||
|
this.files.createVersion('./test/icons/test.svg', 'Test icon')
|
||||||
|
this.files.createVersion('./test/icons/test.eot', 'Test icon')
|
||||||
|
this.files.createVersion('./test/icons/test.ttf', 'Test icon')
|
||||||
|
this.files.createVersion('./test/icons/test.woff', 'Test icon')
|
||||||
|
this.files.createVersion('./test/icons/test.woff2', 'Test icon')
|
||||||
|
this.files.createVersion('./test/icons/test.jpeg', 'Test icon')
|
||||||
|
this.files.createVersion('./test/icons/test.jpg', 'Test icon')
|
||||||
|
this.files.createVersion('./test/icons/test.tiff', 'Test icon')
|
||||||
|
this.files.createVersion('./test/icons/test.gif', 'Test icon')
|
||||||
|
this.files.createVersion('./test/icons/test.bmp', 'Test icon')
|
||||||
|
this.files.createVersion('./test/icons/test.png', 'Test icon')
|
||||||
|
this.files.createVersion('./test/icons/test.webp', 'Test icon')
|
||||||
|
this.files.createVersion('./test/icons/test.mpeg', 'Test icon')
|
||||||
|
this.files.createVersion('./test/icons/test.mpg', 'Test icon')
|
||||||
|
this.files.createVersion('./test/icons/test.mp4', 'Test icon')
|
||||||
|
this.files.createVersion('./test/icons/test.amv', 'Test icon')
|
||||||
|
this.files.createVersion('./test/icons/test.wmv', 'Test icon')
|
||||||
|
this.files.createVersion('./test/icons/test.mov', 'Test icon')
|
||||||
|
this.files.createVersion('./test/icons/test.avi', 'Test icon')
|
||||||
|
this.files.createVersion('./test/icons/test.ogv', 'Test icon')
|
||||||
|
this.files.createVersion('./test/icons/test.mkv', 'Test icon')
|
||||||
|
this.files.createVersion('./test/icons/test.webm', 'Test icon')
|
||||||
|
this.files.createVersion('./test/icons/test.mp3', 'Test icon')
|
||||||
|
this.files.createVersion('./test/icons/test.wav', 'Test icon')
|
||||||
|
this.files.createVersion('./test/icons/test.ogg', 'Test icon')
|
||||||
|
this.files.createVersion('./test/icons/test.raw', 'Test icon')
|
||||||
|
this.files.createVersion('./test/icons/test.zip', 'Test icon')
|
||||||
|
this.files.createVersion('./test/icons/test.rar', 'Test icon')
|
||||||
|
this.files.createVersion('./test/icons/test.7z', 'Test icon')
|
||||||
|
this.files.createVersion('./test/icons/test.gz', 'Test icon')
|
||||||
|
this.files.createVersion('./test/icons/test.txt', 'Test icon')
|
||||||
|
this.files.createVersion('./test/icons/test.coffee', 'Test icon')
|
||||||
|
this.files.createVersion('./test/icons/test.gitignore', 'Test icon')
|
||||||
|
this.files.createVersion('./test/icons/test.gitkeep', 'Test icon')
|
||||||
|
this.files.createVersion('./test/icons/test.xml', 'Test icon')
|
||||||
|
this.files.createVersion('./test/icons/test.twig', 'Test icon')
|
||||||
|
this.files.createVersion('./test/icons/test.c', 'Test icon')
|
||||||
|
this.files.createVersion('./test/icons/test.h', 'Test icon')
|
||||||
|
this.files.createVersion('./test/icons/test.pwet', 'Test icon')
|
||||||
|
|
||||||
|
// Adding file versions
|
||||||
|
let counting = 0
|
||||||
|
setInterval(() =>
|
||||||
|
{
|
||||||
|
this.files.createVersion('./test/versions.txt', 'test: ' + counting++)
|
||||||
|
}, 2000)
|
||||||
|
|
||||||
|
// Creating and deleting file
|
||||||
|
let toggle = true
|
||||||
|
setInterval(() =>
|
||||||
|
{
|
||||||
|
if(toggle)
|
||||||
|
{
|
||||||
|
this.files.create('./test/toggle.txt', 'content')
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.files.delete('./test/toggle.txt', 'content')
|
||||||
|
}
|
||||||
|
|
||||||
|
toggle = !toggle
|
||||||
|
}, 3000)
|
||||||
|
}
|
||||||
|
|
||||||
describe()
|
describe()
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-1
@@ -50,7 +50,7 @@ class Projects
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Update project name
|
// Update project name
|
||||||
project.set_name(_name + ' ' + newNumber)
|
project.setName(_options.name + ' ' + newNumber)
|
||||||
|
|
||||||
// Try to found
|
// Try to found
|
||||||
sameNameProject = this.all[project.slug]
|
sameNameProject = this.all[project.slug]
|
||||||
|
|||||||
+1
-2
@@ -7,8 +7,7 @@
|
|||||||
},
|
},
|
||||||
"main": "bin/index.js",
|
"main": "bin/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"demo-folder": "cd test/demo-folder && node ../../bin 'Demo folder'",
|
"demo-folder": "cd test/demo-folder && node ../../bin 'Demo folder' --test"
|
||||||
"test-project": "node ./bin --debug 1 --test"
|
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|||||||
Reference in New Issue
Block a user