restructure: Prefix `bin/` and `tests/` with `src/`

This is a follow-up to commit
2ea8ea1275.
This commit is contained in:
Richard Hansen 2021-02-04 18:43:27 -05:00 committed by John McLear
parent 2ea8ea1275
commit 8b28e00784
51 changed files with 182 additions and 170 deletions

View File

@ -24,11 +24,11 @@ jobs:
sudo apt install -y --no-install-recommends libreoffice libreoffice-pdfimport
- name: Install all dependencies and symlink for ep_etherpad-lite
run: bin/installDeps.sh
run: src/bin/installDeps.sh
# configures some settings and runs npm run test
- name: Run the backend tests
run: tests/frontend/travis/runnerBackend.sh
run: src/tests/frontend/travis/runnerBackend.sh
withplugins:
# run on pushes to any branch
@ -73,8 +73,8 @@ jobs:
# if npm correctly hoists the dependencies, the hoisting seems to confuse
# tools such as `npm outdated`, `npm update`, and some ESLint rules.
- name: Install all dependencies and symlink for ep_etherpad-lite
run: bin/installDeps.sh
run: src/bin/installDeps.sh
# configures some settings and runs npm run test
- name: Run the backend tests
run: tests/frontend/travis/runnerBackend.sh
run: src/tests/frontend/travis/runnerBackend.sh

View File

@ -21,6 +21,6 @@ jobs:
run: |
docker build -t etherpad:test .
docker run -d -p 9001:9001 etherpad:test
./bin/installDeps.sh
./src/bin/installDeps.sh
sleep 3 # delay for startup?
cd src && npm run test-container

View File

@ -17,10 +17,10 @@ jobs:
SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }}
SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }}
TRAVIS_JOB_NUMBER: ${{ github.run_id }}-${{ github.run_number }}-${{ github.job }}
run: tests/frontend/travis/sauce_tunnel.sh
run: src/tests/frontend/travis/sauce_tunnel.sh
- name: Install all dependencies and symlink for ep_etherpad-lite
run: bin/installDeps.sh
run: src/bin/installDeps.sh
- name: export GIT_HASH to env
id: environment
@ -37,7 +37,7 @@ jobs:
TRAVIS_JOB_NUMBER: ${{ github.run_id }}-${{ github.run_number }}-${{ github.job }}
GIT_HASH: ${{ steps.environment.outputs.sha_short }}
run: |
tests/frontend/travis/runner.sh
src/tests/frontend/travis/runner.sh
withplugins:
name: with plugins
@ -53,7 +53,7 @@ jobs:
SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }}
SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }}
TRAVIS_JOB_NUMBER: ${{ github.run_id }}-${{ github.run_number }}-${{ github.job }}
run: tests/frontend/travis/sauce_tunnel.sh
run: src/tests/frontend/travis/sauce_tunnel.sh
- name: Install Etherpad plugins
run: >
@ -79,7 +79,7 @@ jobs:
# if npm correctly hoists the dependencies, the hoisting seems to confuse
# tools such as `npm outdated`, `npm update`, and some ESLint rules.
- name: Install all dependencies and symlink for ep_etherpad-lite
run: bin/installDeps.sh
run: src/bin/installDeps.sh
- name: export GIT_HASH to env
id: environment
@ -90,7 +90,7 @@ jobs:
# XXX we should probably run all tests, because plugins could effect their results
- name: Remove standard frontend test files, so only plugin tests are run
run: rm tests/frontend/specs/*
run: rm src/tests/frontend/specs/*
- name: Run the frontend tests
shell: bash
@ -100,4 +100,4 @@ jobs:
TRAVIS_JOB_NUMBER: ${{ github.run_id }}-${{ github.run_number }}-${{ github.job }}
GIT_HASH: ${{ steps.environment.outputs.sha_short }}
run: |
tests/frontend/travis/runner.sh
src/tests/frontend/travis/runner.sh

View File

@ -18,13 +18,13 @@ jobs:
uses: actions/checkout@v2
- name: Install all dependencies and symlink for ep_etherpad-lite
run: bin/installDeps.sh
run: src/bin/installDeps.sh
- name: Install etherpad-load-test
run: sudo npm install -g etherpad-load-test
- name: Run load test
run: tests/frontend/travis/runnerLoadTest.sh
run: src/tests/frontend/travis/runnerLoadTest.sh
withplugins:
# run on pushes to any branch
@ -66,8 +66,8 @@ jobs:
# if npm correctly hoists the dependencies, the hoisting seems to confuse
# tools such as `npm outdated`, `npm update`, and some ESLint rules.
- name: Install all dependencies and symlink for ep_etherpad-lite
run: bin/installDeps.sh
run: src/bin/installDeps.sh
# configures some settings and runs npm run test
- name: Run load test
run: tests/frontend/travis/runnerLoadTest.sh
run: src/tests/frontend/travis/runnerLoadTest.sh

View File

@ -22,8 +22,8 @@ jobs:
- name: build docker image
run: |
docker build -f Dockerfile -t epl-debian-slim .
docker build -f tests/ratelimit/Dockerfile.nginx -t nginx-latest .
docker build -f tests/ratelimit/Dockerfile.anotherip -t anotherip .
docker build -f src/tests/ratelimit/Dockerfile.nginx -t nginx-latest .
docker build -f src/tests/ratelimit/Dockerfile.anotherip -t anotherip .
- name: run docker images
run: |
docker run --name etherpad-docker -p 9000:9001 --rm --network ep_net --ip 172.23.42.2 -e 'TRUST_PROXY=true' epl-debian-slim &
@ -31,9 +31,9 @@ jobs:
docker run --rm --network ep_net --ip 172.23.42.3 --name anotherip -dt anotherip
- name: install dependencies and create symlink for ep_etherpad-lite
run: bin/installDeps.sh
run: src/bin/installDeps.sh
- name: run rate limit test
run: |
cd tests/ratelimit
cd src/tests/ratelimit
./testlimits.sh

8
.gitignore vendored
View File

@ -3,11 +3,8 @@ node_modules
!settings.json.template
APIKEY.txt
SESSIONKEY.txt
bin/abiword.exe
bin/node.exe
etherpad-lite-win.zip
var/dirty.db
bin/convertSettings.json
*~
*.patch
npm-debug.log
@ -15,9 +12,12 @@ npm-debug.log
.ep_initialized
*.crt
*.key
bin/etherpad-1.deb
credentials.json
out/
.nyc_output
./package-lock.json
.idea
/src/bin/abiword.exe
/src/bin/convertSettings.json
/src/bin/etherpad-1.deb
/src/bin/node.exe

View File

@ -46,19 +46,19 @@ jobs:
name: "Test the Frontend without Plugins"
install:
- *set_loglevel_warn
- "tests/frontend/travis/sauce_tunnel.sh"
- "bin/installDeps.sh"
- "src/tests/frontend/travis/sauce_tunnel.sh"
- "src/bin/installDeps.sh"
- "export GIT_HASH=$(git rev-parse --verify --short HEAD)"
script:
- "./tests/frontend/travis/runner.sh"
- "./src/tests/frontend/travis/runner.sh"
- name: "Run the Backend tests without Plugins"
install:
- *install_libreoffice
- *set_loglevel_warn
- "bin/installDeps.sh"
- "src/bin/installDeps.sh"
- "cd src && npm install && cd -"
script:
- "tests/frontend/travis/runnerBackend.sh"
- "src/tests/frontend/travis/runnerBackend.sh"
- name: "Test the Dockerfile"
install:
- "cd src && npm install && cd -"
@ -69,24 +69,24 @@ jobs:
- name: "Load test Etherpad without Plugins"
install:
- *set_loglevel_warn
- "bin/installDeps.sh"
- "src/bin/installDeps.sh"
- "cd src && npm install && cd -"
- "npm install -g etherpad-load-test"
script:
- "tests/frontend/travis/runnerLoadTest.sh"
- "src/tests/frontend/travis/runnerLoadTest.sh"
# we can only frontend tests from the ether/ organization and not from forks.
# To request tests to be run ask a maintainer to fork your repo to ether/
- if: fork = false
name: "Test the Frontend Plugins only"
install:
- *set_loglevel_warn
- "tests/frontend/travis/sauce_tunnel.sh"
- "bin/installDeps.sh"
- "rm tests/frontend/specs/*"
- "src/tests/frontend/travis/sauce_tunnel.sh"
- "src/bin/installDeps.sh"
- "rm src/tests/frontend/specs/*"
- *install_plugins
- "export GIT_HASH=$(git rev-parse --verify --short HEAD)"
script:
- "./tests/frontend/travis/runner.sh"
- "./src/tests/frontend/travis/runner.sh"
- name: "Lint test package-lock.json"
install:
- "npm install lockfile-lint"
@ -96,11 +96,11 @@ jobs:
install:
- *install_libreoffice
- *set_loglevel_warn
- "bin/installDeps.sh"
- "src/bin/installDeps.sh"
- *install_plugins
- "cd src && npm install && cd -"
script:
- "tests/frontend/travis/runnerBackend.sh"
- "src/tests/frontend/travis/runnerBackend.sh"
- name: "Test the Dockerfile"
install:
- "cd src && npm install && cd -"
@ -111,24 +111,24 @@ jobs:
- name: "Load test Etherpad with Plugins"
install:
- *set_loglevel_warn
- "bin/installDeps.sh"
- "src/bin/installDeps.sh"
- *install_plugins
- "cd src && npm install && cd -"
- "npm install -g etherpad-load-test"
script:
- "tests/frontend/travis/runnerLoadTest.sh"
- "src/tests/frontend/travis/runnerLoadTest.sh"
- name: "Test rate limit"
install:
- "docker network create --subnet=172.23.42.0/16 ep_net"
- "docker build -f Dockerfile -t epl-debian-slim ."
- "docker build -f tests/ratelimit/Dockerfile.nginx -t nginx-latest ."
- "docker build -f tests/ratelimit/Dockerfile.anotherip -t anotherip ."
- "docker build -f src/tests/ratelimit/Dockerfile.nginx -t nginx-latest ."
- "docker build -f src/tests/ratelimit/Dockerfile.anotherip -t anotherip ."
- "docker run -p 8081:80 --rm --network ep_net --ip 172.23.42.1 -d nginx-latest"
- "docker run --name etherpad-docker -p 9000:9001 --rm --network ep_net --ip 172.23.42.2 -e 'TRUST_PROXY=true' epl-debian-slim &"
- "docker run --rm --network ep_net --ip 172.23.42.3 --name anotherip -dt anotherip"
- "./bin/installDeps.sh"
- "./src/bin/installDeps.sh"
script:
- "cd tests/ratelimit && bash testlimits.sh"
- "cd src/tests/ratelimit && bash testlimits.sh"
notifications:
irc:

View File

@ -35,7 +35,7 @@ WORKDIR /opt/etherpad-lite
COPY --chown=etherpad:0 ./ ./
# install node dependencies for Etherpad
RUN bin/installDeps.sh && \
RUN src/bin/installDeps.sh && \
rm -rf ~/.npm/_cacache
# Install the plugins, if ETHERPAD_PLUGINS is not empty.

View File

@ -9,8 +9,8 @@ UNAME := $(shell uname -s)
ensure_marked_is_installed:
set -eu; \
hash npm; \
if [ $(shell npm list --prefix bin/doc >/dev/null 2>/dev/null; echo $$?) -ne "0" ]; then \
npm ci --prefix=bin/doc; \
if [ $(shell npm list --prefix src/bin/doc >/dev/null 2>/dev/null; echo $$?) -ne "0" ]; then \
npm ci --prefix=src/bin/doc; \
fi
docs: ensure_marked_is_installed $(outdoc_files) $(docassets)
@ -21,7 +21,7 @@ out/doc/assets/%: doc/assets/%
out/doc/%.html: doc/%.md
mkdir -p $(@D)
node bin/doc/generate.js --format=html --template=doc/template.html $< > $@
node src/bin/doc/generate.js --format=html --template=doc/template.html $< > $@
ifeq ($(UNAME),Darwin)
sed -i '' 's/__VERSION__/${VERSION}/' $@
else

View File

@ -21,7 +21,9 @@ Etherpad is a real-time collaborative editor [scalable to thousands of simultane
```
curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
sudo apt install -y nodejs
git clone --branch master https://github.com/ether/etherpad-lite.git && cd etherpad-lite && bin/run.sh
git clone --branch master https://github.com/ether/etherpad-lite.git &&
cd etherpad-lite &&
src/bin/run.sh
```
### Manual install
@ -31,9 +33,10 @@ You'll need git and [node.js](https://nodejs.org) installed (minimum required No
1. Move to a folder where you want to install Etherpad. Clone the git repository: `git clone --branch master git://github.com/ether/etherpad-lite.git`
2. Change into the new directory containing the cloned source code: `cd etherpad-lite`
3. run `bin/run.sh` and open <http://127.0.0.1:9001> in your browser.
3. run `src/bin/run.sh` and open <http://127.0.0.1:9001> in your browser.
To update to the latest released version, execute `git pull origin`. The next start with `bin/run.sh` will update the dependencies.
To update to the latest released version, execute `git pull origin`. The next
start with `src/bin/run.sh` will update the dependencies.
[Next steps](#next-steps).
@ -53,11 +56,13 @@ You'll need [node.js](https://nodejs.org) and (optionally, though recommended) g
1. Grab the source, either
- download <https://github.com/ether/etherpad-lite/zipball/master>
- or `git clone --branch master https://github.com/ether/etherpad-lite.git`
2. With a "Run as administrator" command prompt execute `bin\installOnWindows.bat`
2. With a "Run as administrator" command prompt execute
`src\bin\installOnWindows.bat`
Now, run `start.bat` and open <http://localhost:9001> in your browser.
Update to the latest version with `git pull origin`, then run `bin\installOnWindows.bat`, again.
Update to the latest version with `git pull origin`, then run
`src\bin\installOnWindows.bat`, again.
If cloning to a subdirectory within another project, you may need to do the following:
@ -73,7 +78,9 @@ Find [here](doc/docker.md) information on running Etherpad in a container.
## Tweak the settings
You can modify the settings in `settings.json`.
If you need to handle multiple settings files, you can pass the path to a settings file to `bin/run.sh` using the `-s|--settings` option: this allows you to run multiple Etherpad instances from the same installation.
If you need to handle multiple settings files, you can pass the path to a
settings file to `src/bin/run.sh` using the `-s|--settings` option: this allows
you to run multiple Etherpad instances from the same installation.
Similarly, `--credentials` can be used to give a settings override file, `--apikey` to give a different APIKEY.txt file and `--sessionkey` to give a non-default SESSIONKEY.txt.
**Each configuration parameter can also be set via an environment variable**, using the syntax `"${ENV_VAR}"` or `"${ENV_VAR:default_value}"`. For details, refer to `settings.json.template`.
Once you have access to your `/admin` section settings can be modified through the web browser.
@ -115,9 +122,13 @@ Documentation can be found in `doc/`.
# Development
## Things you should know
You can debug Etherpad using `bin/debugRun.sh`.
You can run Etherpad quickly launching `bin/fastRun.sh`. It's convenient for developers and advanced users. Be aware that it will skip the dependencies update, so remember to run `bin/installDeps.sh` after installing a new dependency or upgrading version.
You can debug Etherpad using `src/bin/debugRun.sh`.
You can run Etherpad quickly launching `src/bin/fastRun.sh`. It's convenient for
developers and advanced users. Be aware that it will skip the dependencies
update, so remember to run `src/bin/installDeps.sh` after installing a new
dependency or upgrading version.
If you want to find out how Etherpad's `Easysync` works (the library that makes it really realtime), start with this [PDF](https://github.com/ether/etherpad-lite/raw/master/doc/easysync/easysync-full-description.pdf) (complex, but worth reading).

View File

@ -11,5 +11,5 @@ heading.
Every `.html` file is generated based on the corresponding
`.md` file in the `doc/api/` folder in the source tree. The
documentation is generated using the `bin/doc/generate.js` program.
documentation is generated using the `src/bin/doc/generate.js` program.
The HTML template is located at `doc/template.html`.

View File

@ -14,7 +14,7 @@ rm -rf ${DIST}
mkdir -p ${DIST}/
rm -rf ${SRC}
rsync -a bin/deb-src/ ${SRC}/
rsync -a src/bin/deb-src/ ${SRC}/
mkdir -p ${SYSROOT}/opt/
rsync --exclude '.git' -a . ${SYSROOT}/opt/etherpad/ --delete

View File

@ -32,7 +32,7 @@ rm -f etherpad-lite-win.zip
export NODE_ENV=production
log "do a normal unix install first..."
bin/installDeps.sh || exit 1
src/bin/installDeps.sh || exit 1
log "copy the windows settings template..."
cp settings.json.template settings.json
@ -43,8 +43,7 @@ rm -rf node_modules
mv node_modules_resolved node_modules
log "download windows node..."
cd bin
wget "https://nodejs.org/dist/latest-erbium/win-x86/node.exe" -O ../node.exe
wget "https://nodejs.org/dist/latest-erbium/win-x86/node.exe" -O node.exe
log "remove git history to reduce folder size"
rm -rf .git/objects

View File

@ -7,7 +7,7 @@
// unhandled rejection into an uncaught exception, which does cause Node.js to exit.
process.on('unhandledRejection', (err) => { throw err; });
if (process.argv.length !== 2) throw new Error('Use: node bin/checkAllPads.js');
if (process.argv.length !== 2) throw new Error('Use: node src/bin/checkAllPads.js');
(async () => {
// initialize the database

View File

@ -7,7 +7,7 @@
// unhandled rejection into an uncaught exception, which does cause Node.js to exit.
process.on('unhandledRejection', (err) => { throw err; });
if (process.argv.length !== 3) throw new Error('Use: node bin/checkPad.js $PADID');
if (process.argv.length !== 3) throw new Error('Use: node src/bin/checkPad.js $PADID');
// get the padID
const padId = process.argv[2];

View File

@ -7,7 +7,7 @@
// unhandled rejection into an uncaught exception, which does cause Node.js to exit.
process.on('unhandledRejection', (err) => { throw err; });
if (process.argv.length !== 3) throw new Error('Use: node bin/checkPadDeltas.js $PADID');
if (process.argv.length !== 3) throw new Error('Use: node src/bin/checkPadDeltas.js $PADID');
// get the padID
const padId = process.argv[2];

View File

@ -1,15 +1,11 @@
#!/bin/sh
# Move to the folder where ep-lite is installed
cd "$(dirname "$0")"/..
# Move to the Etherpad base directory.
MY_DIR=$(cd "${0%/*}" && pwd -P) || exit 1
cd "${MY_DIR}/../.." || exit 1
# Source constants and useful functions
. bin/functions.sh
#Was this script started in the bin folder? if yes move out
if [ -d "../bin" ]; then
cd "../"
fi
. src/bin/functions.sh
ignoreRoot=0
for ARG in "$@"
@ -35,7 +31,7 @@ fi
rm -rf src/node_modules
#Prepare the environment
bin/installDeps.sh "$@" || exit 1
src/bin/installDeps.sh "$@" || exit 1
#Move to the node folder and start
echo "Started Etherpad..."

View File

@ -134,7 +134,7 @@ function create_builds {
git clone $ETHER_WEB_REPO
echo "Creating windows build..."
cd etherpad-lite
bin/buildForWindows.sh
src/bin/buildForWindows.sh
[[ $? != 0 ]] && echo "Aborting: Error creating build for windows" && exit 1
echo "Creating docs..."
make docs

View File

@ -15,7 +15,7 @@ pre-start script
chown $EPUSER $EPLOGS ||true
chmod 0755 $EPLOGS ||true
chown -R $EPUSER $EPHOME/var ||true
$EPHOME/bin/installDeps.sh >> $EPLOGS/error.log || { stop; exit 1; }
$EPHOME/src/bin/installDeps.sh >> $EPLOGS/error.log || { stop; exit 1; }
end script
script

View File

@ -1,13 +1,14 @@
#!/bin/sh
# Move to the folder where ep-lite is installed
cd "$(dirname "$0")"/..
# Move to the Etherpad base directory.
MY_DIR=$(cd "${0%/*}" && pwd -P) || exit 1
cd "${MY_DIR}/../.." || exit 1
# Source constants and useful functions
. bin/functions.sh
. src/bin/functions.sh
# Prepare the environment
bin/installDeps.sh || exit 1
src/bin/installDeps.sh || exit 1
echo "If you are new to debugging Node.js with Chrome DevTools, take a look at this page:"
echo "https://medium.com/@paul_irish/debugging-node-js-nightlies-with-chrome-devtools-7c4a1b95ae27"

View File

@ -72,5 +72,5 @@ Each type of heading has a description block.
Run the following from the etherpad-lite root directory:
```sh
$ node bin/doc/generate doc/index.md --format=html --template=doc/template.html > out.html
```
$ node src/bin/doc/generate doc/index.md --format=html --template=doc/template.html > out.html
```

View File

@ -9,17 +9,14 @@
set -eu
# source: https://stackoverflow.com/questions/59895/how-to-get-the-source-directory-of-a-bash-script-from-within-the-script-itself#246128
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
# Move to the Etherpad base directory.
MY_DIR=$(cd "${0%/*}" && pwd -P) || exit 1
cd "${MY_DIR}/../.." || exit 1
# Source constants and useful functions
. ${DIR}/../bin/functions.sh
. src/bin/functions.sh
echo "Running directly, without checking/installing dependencies"
# move to the base Etherpad directory. This will be necessary until Etherpad
# learns to run from arbitrary CWDs.
cd "${DIR}/.."
# run Etherpad main class
node $(compute_node_args) "${DIR}/../node_modules/ep_etherpad-lite/node/server.js" "$@"
node $(compute_node_args) "node_modules/ep_etherpad-lite/node/server.js" "$@"

View File

@ -1,10 +1,11 @@
#!/bin/sh
# Move to the folder where ep-lite is installed
cd "$(dirname "$0")"/..
# Move to the Etherpad base directory.
MY_DIR=$(cd "${0%/*}" && pwd -P) || exit 1
cd "${MY_DIR}/../.." || exit 1
# Source constants and useful functions
. bin/functions.sh
. src/bin/functions.sh
# Is node installed?
# Not checking io.js, default installation creates a symbolic link to node

View File

@ -10,7 +10,7 @@ process.on('unhandledRejection', (err) => { throw err; });
// file before using this script, just to be safe.
// It might be necessary to run the script using more memory:
// `node --max-old-space-size=4096 bin/migrateDirtyDBtoRealDB.js`
// `node --max-old-space-size=4096 src/bin/migrateDirtyDBtoRealDB.js`
const dirtyDb = require('dirty');
const log4js = require('log4js');

View File

@ -6,25 +6,25 @@ This code will check your plugin for known usual issues and some suggestions for
improvements. No changes will be made to your project.
```
node bin/plugins/checkPlugin.js $PLUGIN_NAME$
node src/bin/plugins/checkPlugin.js $PLUGIN_NAME$
```
# Basic Example:
```
node bin/plugins/checkPlugin.js ep_webrtc
node src/bin/plugins/checkPlugin.js ep_webrtc
```
## Autofixing - will autofix any issues it can
```
node bin/plugins/checkPlugin.js ep_whatever autofix
node src/bin/plugins/checkPlugin.js ep_whatever autofix
```
## Autocommitting, push, npm minor patch and npm publish (highly dangerous)
```
node bin/plugins/checkPlugin.js ep_whatever autocommit
node src/bin/plugins/checkPlugin.js ep_whatever autocommit
```
# All the plugins
@ -41,7 +41,7 @@ cd ..
for dir in node_modules/ep_*; do
dir=${dir#node_modules/}
[ "$dir" != ep_etherpad-lite ] || continue
node bin/plugins/checkPlugin.js "$dir" autocommit
node src/bin/plugins/checkPlugin.js "$dir" autocommit
done
```

View File

@ -3,10 +3,10 @@
/*
* Usage -- see README.md
*
* Normal usage: node bin/plugins/checkPlugin.js ep_whatever
* Auto fix the things it can: node bin/plugins/checkPlugin.js ep_whatever autofix
* Normal usage: node src/bin/plugins/checkPlugin.js ep_whatever
* Auto fix the things it can: node src/bin/plugins/checkPlugin.js ep_whatever autofix
* Auto commit, push and publish to npm (highly dangerous):
* node bin/plugins/checkPlugin.js ep_whatever autocommit
* node src/bin/plugins/checkPlugin.js ep_whatever autocommit
*/
// As of v14, Node.js does not exit when there is an unhandled Promise rejection. Convert an
@ -118,7 +118,7 @@ fs.readdir(pluginPath, (err, rootFiles) => {
console.log('create one and set npm secret to auto publish to npm on commit');
if (autoFix) {
const npmpublish =
fs.readFileSync('bin/plugins/lib/npmpublish.yml', {encoding: 'utf8', flag: 'r'});
fs.readFileSync('src/bin/plugins/lib/npmpublish.yml', {encoding: 'utf8', flag: 'r'});
fs.mkdirSync(`${pluginPath}/.github/workflows`, {recursive: true});
fs.writeFileSync(path, npmpublish);
console.log("If you haven't already, setup autopublish for this plugin https://github.com/ether/etherpad-lite/wiki/Plugins:-Automatically-publishing-to-npm-on-commit-to-Github-Repo");
@ -134,14 +134,14 @@ fs.readdir(pluginPath, (err, rootFiles) => {
currVersionFile.substr(existingConfigLocation + 17, existingConfigLocation.length));
const reqVersionFile =
fs.readFileSync('bin/plugins/lib/npmpublish.yml', {encoding: 'utf8', flag: 'r'});
fs.readFileSync('src/bin/plugins/lib/npmpublish.yml', {encoding: 'utf8', flag: 'r'});
const reqConfigLocation = reqVersionFile.indexOf('##ETHERPAD_NPM_V=');
const reqValue =
parseInt(reqVersionFile.substr(reqConfigLocation + 17, reqConfigLocation.length));
if (!existingValue || (reqValue > existingValue)) {
const npmpublish =
fs.readFileSync('bin/plugins/lib/npmpublish.yml', {encoding: 'utf8', flag: 'r'});
fs.readFileSync('src/bin/plugins/lib/npmpublish.yml', {encoding: 'utf8', flag: 'r'});
fs.mkdirSync(`${pluginPath}/.github/workflows`, {recursive: true});
fs.writeFileSync(path, npmpublish);
}
@ -158,7 +158,7 @@ fs.readdir(pluginPath, (err, rootFiles) => {
console.log('create one and set npm secret to auto publish to npm on commit');
if (autoFix) {
const backendTests =
fs.readFileSync('bin/plugins/lib/backend-tests.yml', {encoding: 'utf8', flag: 'r'});
fs.readFileSync('src/bin/plugins/lib/backend-tests.yml', {encoding: 'utf8', flag: 'r'});
fs.mkdirSync(`${pluginPath}/.github/workflows`, {recursive: true});
fs.writeFileSync(path, backendTests);
}
@ -171,14 +171,14 @@ fs.readdir(pluginPath, (err, rootFiles) => {
currVersionFile.substr(existingConfigLocation + 17, existingConfigLocation.length));
const reqVersionFile =
fs.readFileSync('bin/plugins/lib/backend-tests.yml', {encoding: 'utf8', flag: 'r'});
fs.readFileSync('src/bin/plugins/lib/backend-tests.yml', {encoding: 'utf8', flag: 'r'});
const reqConfigLocation = reqVersionFile.indexOf('##ETHERPAD_NPM_V=');
const reqValue =
parseInt(reqVersionFile.substr(reqConfigLocation + 17, reqConfigLocation.length));
if (!existingValue || (reqValue > existingValue)) {
const backendTests =
fs.readFileSync('bin/plugins/lib/backend-tests.yml', {encoding: 'utf8', flag: 'r'});
fs.readFileSync('src/bin/plugins/lib/backend-tests.yml', {encoding: 'utf8', flag: 'r'});
fs.mkdirSync(`${pluginPath}/.github/workflows`, {recursive: true});
fs.writeFileSync(path, backendTests);
}
@ -283,7 +283,7 @@ fs.readdir(pluginPath, (err, rootFiles) => {
if (autoFix) {
console.log('Autofixing missing README.md file');
console.log('please edit the README.md file further to include plugin specific details.');
let readme = fs.readFileSync('bin/plugins/lib/README.md', {encoding: 'utf8', flag: 'r'});
let readme = fs.readFileSync('src/bin/plugins/lib/README.md', {encoding: 'utf8', flag: 'r'});
readme = readme.replace(/\[plugin_name\]/g, pluginName);
if (repository) {
const org = repository.split('/')[3];
@ -303,7 +303,7 @@ fs.readdir(pluginPath, (err, rootFiles) => {
console.log('Autofixing missing CONTRIBUTING.md file, please edit the CONTRIBUTING.md ' +
'file further to include plugin specific details.');
let contributing =
fs.readFileSync('bin/plugins/lib/CONTRIBUTING.md', {encoding: 'utf8', flag: 'r'});
fs.readFileSync('src/bin/plugins/lib/CONTRIBUTING.md', {encoding: 'utf8', flag: 'r'});
contributing = contributing.replace(/\[plugin_name\]/g, pluginName);
fs.writeFileSync(`${pluginPath}/CONTRIBUTING.md`, contributing);
}
@ -325,14 +325,16 @@ fs.readdir(pluginPath, (err, rootFiles) => {
console.warn('LICENSE.md file not found, please create');
if (autoFix) {
console.log('Autofixing missing LICENSE.md file, including Apache 2 license.');
let license = fs.readFileSync('bin/plugins/lib/LICENSE.md', {encoding: 'utf8', flag: 'r'});
let license =
fs.readFileSync('src/bin/plugins/lib/LICENSE.md', {encoding: 'utf8', flag: 'r'});
license = license.replace('[yyyy]', new Date().getFullYear());
license = license.replace('[name of copyright owner]', execSync('git config user.name'));
fs.writeFileSync(`${pluginPath}/LICENSE.md`, license);
}
}
let travisConfig = fs.readFileSync('bin/plugins/lib/travis.yml', {encoding: 'utf8', flag: 'r'});
let travisConfig =
fs.readFileSync('src/bin/plugins/lib/travis.yml', {encoding: 'utf8', flag: 'r'});
travisConfig = travisConfig.replace(/\[plugin_name\]/g, pluginName);
if (files.indexOf('.travis.yml') === -1) {
@ -371,7 +373,8 @@ fs.readdir(pluginPath, (err, rootFiles) => {
"ensure files aren't incorrectly commited to a repository.");
if (autoFix) {
console.log('Autofixing missing .gitignore file');
const gitignore = fs.readFileSync('bin/plugins/lib/gitignore', {encoding: 'utf8', flag: 'r'});
const gitignore =
fs.readFileSync('src/bin/plugins/lib/gitignore', {encoding: 'utf8', flag: 'r'});
fs.writeFileSync(`${pluginPath}/.gitignore`, gitignore);
}
} else {

View File

@ -113,7 +113,9 @@ Documentation should be kept up-to-date. This means, whenever you add a new API
You can build the docs e.g. produce html, using `make docs`. At some point in the future we will provide an online documentation. The current documentation in the github wiki should always reflect the state of `master` (!), since there are no docs in master, yet.
## Testing
Front-end tests are found in the `tests/frontend/` folder in the repository. Run them by pointing your browser to `<yourdomainhere>/tests/frontend`.
Front-end tests are found in the `src/tests/frontend/` folder in the repository.
Run them by pointing your browser to `<yourdomainhere>/tests/frontend`.
Back-end tests can be run from the `src` directory, via `npm test`.

View File

@ -30,7 +30,7 @@ jobs:
repository: ether/etherpad-lite
- name: Install all dependencies and symlink for ep_etherpad-lite
run: bin/installDeps.sh
run: src/bin/installDeps.sh
# clone this repository into node_modules/ep_plugin-name
- name: Checkout plugin repository
@ -45,7 +45,7 @@ jobs:
# configures some settings and runs npm run test
- name: Run the backend tests
run: tests/frontend/travis/runnerBackend.sh
run: src/tests/frontend/travis/runnerBackend.sh
##ETHERPAD_NPM_V=1
## NPM configuration automatically created using bin/plugins/updateAllPluginsScript.sh
## NPM configuration automatically created using src/bin/plugins/updateAllPluginsScript.sh

View File

@ -80,4 +80,4 @@ jobs:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
##ETHERPAD_NPM_V=2
## NPM configuration automatically created using bin/plugins/updateAllPluginsScript.sh
## NPM configuration automatically created using src/bin/plugins/updateAllPluginsScript.sh

View File

@ -12,7 +12,7 @@ install:
- "export GIT_HASH=$(git rev-parse --verify --short HEAD)"
#script:
# - "tests/frontend/travis/runner.sh"
# - "src/tests/frontend/travis/runner.sh"
env:
global:
@ -40,14 +40,14 @@ jobs:
- "cd etherpad"
- "mkdir -p node_modules"
- "mv ../[plugin_name] node_modules"
- "bin/installDeps.sh"
- "src/bin/installDeps.sh"
- "export GIT_HASH=$(git rev-parse --verify --short HEAD)"
- "cd src && npm install && cd -"
script:
- "tests/frontend/travis/runnerBackend.sh"
- "src/tests/frontend/travis/runnerBackend.sh"
- name: "Test the Frontend"
before_script:
- "tests/frontend/travis/sauce_tunnel.sh"
- "src/tests/frontend/travis/sauce_tunnel.sh"
install:
- "npm install"
- "mkdir [plugin_name]"
@ -56,10 +56,10 @@ jobs:
- "cd etherpad"
- "mkdir -p node_modules"
- "mv ../[plugin_name] node_modules"
- "bin/installDeps.sh"
- "src/bin/installDeps.sh"
- "export GIT_HASH=$(git rev-parse --verify --short HEAD)"
script:
- "tests/frontend/travis/runner.sh"
- "src/tests/frontend/travis/runner.sh"
notifications:
irc:
@ -67,4 +67,4 @@ notifications:
- "irc.freenode.org#etherpad-lite-dev"
##ETHERPAD_TRAVIS_V=9
## Travis configuration automatically created using bin/plugins/updateAllPluginsScript.sh
## Travis configuration automatically created using src/bin/plugins/updateAllPluginsScript.sh

View File

@ -4,7 +4,7 @@ do
echo $dir
if [[ $dir == *"ep_"* ]]; then
if [[ $dir != "ep_etherpad-lite" ]]; then
# node bin/plugins/checkPlugin.js $dir autofix autocommit autoupdate
# node src/bin/plugins/checkPlugin.js $dir autofix autocommit autoupdate
cd node_modules/$dir
git commit -m "Automatic update: bump update to re-run latest Etherpad tests" --allow-empty
git push origin master

View File

@ -10,7 +10,7 @@ do
# echo $0
if [[ $dir == *"ep_"* ]]; then
if [[ $dir != "ep_etherpad-lite" ]]; then
node bin/plugins/checkPlugin.js $dir autofix autocommit autoupdate
node src/bin/plugins/checkPlugin.js $dir autofix autocommit autoupdate
fi
fi
# echo $dir

View File

@ -5,5 +5,5 @@ set -e
for dir in node_modules/ep_*; do
dir=${dir#node_modules/}
[ "$dir" != ep_etherpad-lite ] || continue
node bin/plugins/checkPlugin.js "$dir" autofix autocommit autoupdate
node src/bin/plugins/checkPlugin.js "$dir" autofix autocommit autoupdate
done

View File

@ -10,7 +10,7 @@
process.on('unhandledRejection', (err) => { throw err; });
if (process.argv.length !== 4 && process.argv.length !== 5) {
throw new Error('Use: node bin/repairPad.js $PADID $REV [$NEWPADID]');
throw new Error('Use: node src/bin/repairPad.js $PADID $REV [$NEWPADID]');
}
const padId = process.argv[2];

View File

@ -12,10 +12,11 @@ const semver = require('semver');
Usage
node bin/release.js patch
node src/bin/release.js patch
*/
const usage = 'node bin/release.js [patch/minor/major] -- example: "node bin/release.js patch"';
const usage =
'node src/bin/release.js [patch/minor/major] -- example: "node src/bin/release.js patch"';
const release = process.argv[2];

View File

@ -10,7 +10,7 @@ process.on('unhandledRejection', (err) => { throw err; });
console.warn('WARNING: This script must not be used while etherpad is running!');
if (process.argv.length !== 3) throw new Error('Use: node bin/repairPad.js $PADID');
if (process.argv.length !== 3) throw new Error('Use: node src/bin/repairPad.js $PADID');
// get the padID
const padId = process.argv[2];

View File

@ -1,10 +1,11 @@
#!/bin/sh
# Move to the folder where ep-lite is installed
cd "$(dirname "$0")"/..
# Move to the Etherpad base directory.
MY_DIR=$(cd "${0%/*}" && pwd -P) || exit 1
cd "${MY_DIR}/../.." || exit 1
# Source constants and useful functions
. bin/functions.sh
. src/bin/functions.sh
ignoreRoot=0
for ARG in "$@"; do
@ -26,7 +27,7 @@ EOF
fi
# Prepare the environment
bin/installDeps.sh "$@" || exit 1
src/bin/installDeps.sh "$@" || exit 1
# Move to the node folder and start
log "Starting Etherpad..."

View File

@ -23,8 +23,9 @@ fatal() { error "$@"; exit 1; }
LAST_EMAIL_SEND=0
# Move to the folder where ep-lite is installed
cd "$(dirname "$0")"/..
# Move to the Etherpad base directory.
MY_DIR=$(try cd "${0%/*}" && try pwd -P) || exit 1
try cd "${MY_DIR}/../.."
# Check if a logfile parameter is set
LOG="$1"
@ -39,7 +40,7 @@ while true; do
[ -w "${LOG}" ] || fatal "Logfile '${LOG}' is not writeable"
# Start the application
bin/run.sh "$@" >>${LOG} 2>>${LOG}
src/bin/run.sh "$@" >>${LOG} 2>>${LOG}
TIME_FMT=$(date +%Y-%m-%dT%H:%M:%S%z)

View File

@ -91,4 +91,4 @@ exports.getPluginTests = async (callback) => {
return Promise.all(promises).then(() => pluginSpecs);
};
exports.getCoreTests = () => readdir('tests/frontend/specs');
exports.getCoreTests = () => readdir('src/tests/frontend/specs');

View File

@ -3,7 +3,7 @@
'use strict';
/**
* This module is started with bin/run.sh. It sets up a Express HTTP and a Socket.IO Server.
* This module is started with src/bin/run.sh. It sets up a Express HTTP and a Socket.IO Server.
* Static file Requests are answered directly from this module, Socket.IO messages are passed
* to MessageHandler and minfied requests are passed to minified.
*/

View File

@ -217,8 +217,8 @@
},
"scripts": {
"lint": "eslint .",
"test": "mocha --timeout 120000 --recursive ../tests/backend/specs ../node_modules/ep_*/static/tests/backend/specs",
"test-container": "mocha --timeout 5000 ../tests/container/specs/api"
"test": "mocha --timeout 120000 --recursive tests/backend/specs ../node_modules/ep_*/static/tests/backend/specs",
"test-container": "mocha --timeout 5000 tests/container/specs/api"
},
"version": "1.8.7",
"license": "Apache-2.0"

View File

@ -72,7 +72,8 @@ const flatten1 = (array) => array.reduce((a, b) => a.concat(b), []);
// there will be an unhandled promise rejection depending on whether the the subsequent attempt is a
// duplicate (same value or error) or different, respectively.
//
// See the tests in tests/backend/specs/hooks.js for examples of supported and prohibited behaviors.
// See the tests in src/tests/backend/specs/hooks.js for examples of supported and prohibited
// behaviors.
//
const callHookFnSync = (hook, context) => {
checkDeprecation(hook);
@ -226,7 +227,8 @@ exports.callAll = (hookName, context) => {
// effect except either an error message is logged or an Error object is thrown depending on whether
// the the subsequent attempt is a duplicate (same value or error) or different, respectively.
//
// See the tests in tests/backend/specs/hooks.js for examples of supported and prohibited behaviors.
// See the tests in src/tests/backend/specs/hooks.js for examples of supported and prohibited
// behaviors.
//
const callHookFnAsync = async (hook, context) => {
checkDeprecation(hook);

View File

@ -1,7 +1,7 @@
'use strict';
/*
* This file is copied & modified from <basedir>/tests/backend/specs/api/pad.js
* This file is copied & modified from <basedir>/src/tests/backend/specs/api/pad.js
*
* TODO: maybe unify those two files and merge in a single one.
*/
@ -60,7 +60,7 @@ describe(__filename, function () {
describe('setHTML', function () {
it('Sets the HTML of a Pad attempting to weird utf8 encoded content', function (done) {
fs.readFile('../tests/backend/specs/api/emojis.html', 'utf8', (err, html) => {
fs.readFile('tests/backend/specs/api/emojis.html', 'utf8', (err, html) => {
api.post(endPoint('setHTML'))
.send({
padID: testPadId,

View File

@ -1,7 +1,7 @@
'use strict';
/*
* ACHTUNG: there is a copied & modified version of this file in
* <basedir>/tests/container/spacs/api/pad.js
* <basedir>/src/tests/container/spacs/api/pad.js
*
* TODO: unify those two files, and merge in a single one.
*/

View File

@ -12,12 +12,12 @@ const superagent = require('superagent');
const padManager = require('../../../../node/db/PadManager');
const plugins = require('../../../../static/js/pluginfw/plugin_defs');
const padText = fs.readFileSync('../tests/backend/specs/api/test.txt');
const etherpadDoc = fs.readFileSync('../tests/backend/specs/api/test.etherpad');
const wordDoc = fs.readFileSync('../tests/backend/specs/api/test.doc');
const wordXDoc = fs.readFileSync('../tests/backend/specs/api/test.docx');
const odtDoc = fs.readFileSync('../tests/backend/specs/api/test.odt');
const pdfDoc = fs.readFileSync('../tests/backend/specs/api/test.pdf');
const padText = fs.readFileSync(`${__dirname}/test.txt`);
const etherpadDoc = fs.readFileSync(`${__dirname}/test.etherpad`);
const wordDoc = fs.readFileSync(`${__dirname}/test.doc`);
const wordXDoc = fs.readFileSync(`${__dirname}/test.docx`);
const odtDoc = fs.readFileSync(`${__dirname}/test.odt`);
const pdfDoc = fs.readFileSync(`${__dirname}/test.pdf`);
let agent;
const apiKey = common.apiKey;

View File

@ -1,6 +1,6 @@
/*
* ACHTUNG: there is a copied & modified version of this file in
* <basedir>/tests/container/specs/api/pad.js
* <basedir>/src/tests/container/specs/api/pad.js
*
* TODO: unify those two files, and merge in a single one.
*/

View File

@ -9,12 +9,11 @@ try() { "$@" || fatal "'$@' failed"; }
[ -n "${SAUCE_USERNAME}" ] || fatal "SAUCE_USERNAME is unset - exiting"
[ -n "${SAUCE_ACCESS_KEY}" ] || fatal "SAUCE_ACCESS_KEY is unset - exiting"
MY_DIR=$(try cd "${0%/*}" && try pwd) || exit 1
# Move to the Etherpad base directory.
MY_DIR=$(try cd "${0%/*}" && try pwd -P) || exit 1
try cd "${MY_DIR}/../../../.."
# reliably move to the etherpad base folder before running it
try cd "${MY_DIR}/../../../"
log "Assuming bin/installDeps.sh has already been run"
log "Assuming src/bin/installDeps.sh has already been run"
node node_modules/ep_etherpad-lite/node/server.js --experimental-worker "${@}" &
ep_pid=$!

View File

@ -6,10 +6,9 @@ error() { log "ERROR: $@" >&2; }
fatal() { error "$@"; exit 1; }
try() { "$@" || fatal "'$@' failed"; }
MY_DIR=$(try cd "${0%/*}" && try pwd) || fatal "failed to find script directory"
# reliably move to the etherpad base folder before running it
try cd "${MY_DIR}/../../../"
# Move to the Etherpad base directory.
MY_DIR=$(try cd "${0%/*}" && try pwd -P) || exit 1
try cd "${MY_DIR}/../../../.."
try sed -e '
s!"soffice":[^,]*!"soffice": "/usr/bin/soffice"!
@ -20,7 +19,7 @@ s!"points":[^,]*!"points": 1000!
s!"loglevel":[^,]*!"loglevel": "WARN"!
' settings.json.template >settings.json
log "Assuming bin/installDeps.sh has already been run"
log "Assuming src/bin/installDeps.sh has already been run"
node node_modules/ep_etherpad-lite/node/server.js "${@}" &
ep_pid=$!

View File

@ -6,10 +6,9 @@ error() { log "ERROR: $@" >&2; }
fatal() { error "$@"; exit 1; }
try() { "$@" || fatal "'$@' failed"; }
MY_DIR=$(try cd "${0%/*}" && try pwd) || exit 1
# reliably move to the etherpad base folder before running it
try cd "${MY_DIR}/../../../"
# Move to the Etherpad base directory.
MY_DIR=$(try cd "${0%/*}" && try pwd -P) || exit 1
try cd "${MY_DIR}/../../../.."
try sed -e '
s!"loadTest":[^,]*!"loadTest": true!
@ -17,7 +16,7 @@ s!"loadTest":[^,]*!"loadTest": true!
s!"points":[^,]*!"points": 1000!
' settings.json.template >settings.json
log "Assuming bin/installDeps.sh has already been run"
log "Assuming src/bin/installDeps.sh has already been run"
node node_modules/ep_etherpad-lite/node/server.js "${@}" >/dev/null &
ep_pid=$!

View File

@ -1,4 +1,4 @@
FROM node:alpine3.12
WORKDIR /tmp
RUN npm i etherpad-cli-client
COPY ./tests/ratelimit/send_changesets.js /tmp/send_changesets.js
COPY ./src/tests/ratelimit/send_changesets.js /tmp/send_changesets.js

View File

@ -1,2 +1,2 @@
FROM nginx
COPY ./tests/ratelimit/nginx.conf /etc/nginx/nginx.conf
COPY ./src/tests/ratelimit/nginx.conf /etc/nginx/nginx.conf