Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

Rename factory plugin to workspace plugin #592

Merged
merged 1 commit into from
Jan 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ At this stage, you can code on Che-theia plugins. In this devfile, containers an
Che-theia plugins are located in `/projects/che-theia/plugins/` folder.

### Step 6: Compile your plugin
You can use the che command `build ... containers-plugin` or `build ... factory-plugin` (command pallette > Run task > … or containers view)
You can use the che command `build ... containers-plugin` or `build ... workspace-plugin` (command pallette > Run task > … or containers view)
Basically, this command will perform in the right plugin folder:

```
Expand All @@ -116,12 +116,12 @@ $ yarn
### Step 7: Run che-theia + plugin
In this section, we are going to run the che-theia assembly built previously and run that with one of the plugins built previously. We will be able to test our changes with a dedicated che-theia instance.

You can use the che command `run ... DEV che-theia + factory-plugin` or `run ... DEV che-theia + containers-plugin` (command pallette > Run task > … or containers view)
You can use the che command `run ... DEV che-theia + workspace-plugin` or `run ... DEV che-theia + containers-plugin` (command pallette > Run task > … or containers view)
Basically, this command will start the DEV che-theia with the plugin:

```
[theia-ide]
$ export HOSTED_PLUGIN=/projects/che-theia/plugins/factory-plugin/
$ export HOSTED_PLUGIN=/projects/che-theia/plugins/workspace-plugin/
$ node /projects/theia/production/src-gen/backend/main.js /tmp/theiadev_projects --hostname=0.0.0.0 --port=3130
```

Expand All @@ -131,7 +131,7 @@ You can then access to your modified Che-theia from the Container view `theia-de
### Step 7bis: Run che-theia + plugin in dev mode
In this section we show how to run the che-theia assembly but in `dev mode`: keeping all the information for debugging.

You can use the che command `run ... DEV yarn start ... che-theia + factory-plugin` or
You can use the che command `run ... DEV yarn start ... che-theia + workspace-plugin` or
`run ... DEV yarn start... che-theia + containers-plugin`
(command pallette > Run task > … or containers view).
To start che-theia in `dev-mode` with yarn (not using the production che-theia generated). It would keep things like the ability to source map.
Expand All @@ -140,9 +140,9 @@ Running dev theia would be located in the che-dev container and `theia-dev-flow`
![Che-Theia-dev-endpoint](https://raw.githubusercontent.com/eclipse/che-theia/assets/theia-dev-flow-endpoint.png)

### Just want to build the plugin and run with the existing Theia image
If you do not have any changes on Theia or Che-theia extension, you could just build the plugins with `build ... containers-plugin` or `build ... factory-plugin`
If you do not have any changes on Theia or Che-theia extension, you could just build the plugins with `build ... containers-plugin` or `build ... workspace-plugin`
and run these plugins with the existing che-theia app:
`run ... HOSTED che-theia + container-plugin` or `run ... HOSTED che-theia + factory-plugin`
`run ... HOSTED che-theia + container-plugin` or `run ... HOSTED che-theia + workspace-plugin`


## How to develop Che Theia remote plugin mechanism
Expand Down
2 changes: 1 addition & 1 deletion che-theia-init-sources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ sources:
- extensions/eclipse-che-theia-git-provisioner
plugins:
- plugins/containers-plugin
- plugins/factory-plugin
- plugins/workspace-plugin
- plugins/ports-plugin
- plugins/task-plugin
- plugins/welcome-plugin
Expand Down
26 changes: 13 additions & 13 deletions devfiles/che-theia-all.devfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,35 +89,35 @@ commands:
echo -e "\e[32mDone.\e[0m build ... containers-plugin"
workdir: /projects/che-theia/plugins/containers-plugin

- name: build ... factory-plugin
- name: build ... workspace-plugin
actions:
- type: exec
component: che-dev
command: >
killall node;
yarn &&
echo -e "\e[32mDone.\e[0m build ... factory-plugin"
workdir: /projects/che-theia/plugins/factory-plugin
echo -e "\e[32mDone.\e[0m build ... workspace-plugin"
workdir: /projects/che-theia/plugins/workspace-plugin

- name: test-watch ... factory-plugin
- name: test-watch ... workspace-plugin
actions:
- type: exec
component: che-dev
command: >
killall node;
yarn test-watch
workdir: /projects/che-theia/plugins/factory-plugin
workdir: /projects/che-theia/plugins/workspace-plugin

- name: run ... DEV che-theia + factory-plugin
- name: run ... DEV che-theia + workspace-plugin
actions:
- type: exec
component: theia-editor
command: >
kill `cat /tmp/node_theiadev.pid`;
rm /default-theia-plugins/eclipse_che_theia_factory_plugin.theia;
rm /default-theia-plugins/eclipse_che_workspace_plugin.theia;
mkdir -p /tmp/theiadev_projects &&
export CHE_PROJECTS_ROOT=/tmp/theiadev_projects &&
export HOSTED_PLUGIN=/projects/che-theia/plugins/factory-plugin/ &&
export HOSTED_PLUGIN=/projects/che-theia/plugins/workspace-plugin/ &&
node src-gen/backend/main.js /tmp/theiadev_projects --hostname=0.0.0.0 --port=3130 & echo $!> /tmp/node_theiadev.pid ; wait `cat /tmp/node_theiadev.pid`
workdir: /projects/theia/production

Expand All @@ -134,16 +134,16 @@ commands:
node src-gen/backend/main.js /tmp/theiadev_projects --hostname=0.0.0.0 --port=3130 & echo $!> /tmp/node_theiadev.pid ; wait `cat /tmp/node_theiadev.pid`
workdir: /projects/theia/production

- name: run ... HOSTED che-theia + factory-plugin
- name: run ... HOSTED che-theia + workspace-plugin
actions:
- type: exec
component: theia-editor
command: >
kill `cat /tmp/node_theiadev.pid`;
rm /default-theia-plugins/eclipse_che_theia_factory_plugin.theia;
rm /default-theia-plugins/eclipse_che_workspace_plugin.theia;
mkdir -p /tmp/theiadev_projects &&
export CHE_PROJECTS_ROOT=/tmp/theiadev_projects &&
cp /projects/che-theia/plugins/factory-plugin/eclipse_che_theia_factory_plugin.theia /default-theia-plugins/ &&
cp /projects/che-theia/plugins/workspace-plugin/eclipse_che_workspace_plugin.theia /default-theia-plugins/ &&
node src-gen/backend/main.js /tmp/theiadev_projects --hostname=0.0.0.0 --port=3130 & echo $!> /tmp/node_theiadev.pid ; wait `cat /tmp/node_theiadev.pid`
workdir: /home/theia

Expand All @@ -160,15 +160,15 @@ commands:
node src-gen/backend/main.js /tmp/theiadev_projects --hostname=0.0.0.0 --port=3130 & echo $!> /tmp/node_theiadev.pid ; wait `cat /tmp/node_theiadev.pid`
workdir: /home/theia

- name: run ... DEV yarn start ... che-theia + factory-plugin
- name: run ... DEV yarn start ... che-theia + workspace-plugin
actions:
- type: exec
component: che-dev
command: >
killall node;
mkdir -p /tmp/theiadev_projects &&
export CHE_PROJECTS_ROOT=/tmp/theiadev_projects &&
export HOSTED_PLUGIN=/projects/che-theia/plugins/factory-plugin/ &&
export HOSTED_PLUGIN=/projects/che-theia/plugins/workspace-plugin/ &&
export GIT_EXEC_PATH=/usr/libexec/git-core && export USE_LOCAL_GIT=true && export LOCAL_GIT_DIRECTORY=/usr &&
yarn start /tmp/theiadev_projects --hostname=0.0.0.0 --port=3010
workdir: /projects/theia/examples/assembly
Expand Down
3 changes: 0 additions & 3 deletions plugins/factory-plugin/.gitignore

This file was deleted.

3 changes: 3 additions & 0 deletions plugins/workspace-plugin/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
lib
coverage
eclipse_che_workspace_plugin.theia
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "@eclipse-che/theia-factory-plugin",
"name": "@eclipse-che/workspace-plugin",
"publisher": "Eclipse Che",
"version": "0.0.1",
"keywords": [
"theia-plugin"
],
"version": "0.0.1",
"license": "EPL-2.0",
"files": [
"src"
Expand Down Expand Up @@ -36,7 +36,7 @@
"theiaPlugin": "next"
},
"theiaPlugin": {
"backend": "lib/factory-plugin.js"
"backend": "lib/workspace-plugin.js"
},
"jest": {
"collectCoverage": true,
Expand Down Expand Up @@ -67,19 +67,19 @@
"menus": {
"editor/context": [
{
"command": "factory-plugin.create-workspace",
"command": "workspace-plugin.create-workspace",
"when": "resourceFilename =~ /devfile/"
}
],
"editor/title": [
{
"command": "factory-plugin.create-workspace",
"command": "workspace-plugin.create-workspace",
"when": "resourceFilename =~ /devfile/"
}
],
"explorer/context": [
{
"command": "factory-plugin.create-workspace",
"command": "workspace-plugin.create-workspace",
"when": "resourceFilename =~ /devfile/"
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import * as theia from '@theia/plugin';
import * as che from '@eclipse-che/plugin';

const CREATE_WORKSPACE_COMMAND = {
id: 'factory-plugin.create-workspace',
id: 'workspace-plugin.create-workspace',
label: 'Create Workspace',
tooltip: 'Create workspace from this DevFile'
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ export class TheiaImportZipCommand implements TheiaImportCommand {

this.locationURI = source!.location;
this.projectDir = path.join(projectsRoot, project.name!);
this.tmpDir = fs.mkdtempSync(path.join(`${os.tmpdir()}${path.sep}`, 'factory-plugin-'));
this.tmpDir = fs.mkdtempSync(path.join(`${os.tmpdir()}${path.sep}`, 'workspace-plugin-'));
this.zipfile = `${project.name}.zip`;
this.zipfilePath = path.join(this.tmpDir, this.zipfile);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ describe('Test exec commands', () => {

describe('Testing convertion of project paths to be stored in the workspace config', () => {
test('Converting fs project path to che project path', async () => {
expect(convertToCheProjectPath('/projects/che-factory-extension/', '/projects')).toBe('che-factory-extension');
expect(convertToCheProjectPath('/projects/che-factory-extension', '/projects')).toBe('che-factory-extension');
expect(convertToCheProjectPath('/projects/che/che-factory-extension/', '/projects')).toBe('che/che-factory-extension');
expect(convertToCheProjectPath('/projects/che-workspace-extension/', '/projects')).toBe('che-workspace-extension');
expect(convertToCheProjectPath('/projects/che-workspace-extension', '/projects')).toBe('che-workspace-extension');
expect(convertToCheProjectPath('/projects/che/che-workspace-extension/', '/projects')).toBe('che/che-workspace-extension');
expect(convertToCheProjectPath('/projects/theiadev_projects/blog.sunix.org/', '/projects/theiadev_projects')).toBe('blog.sunix.org');
expect(convertToCheProjectPath('/projects/che/che-factory-extension/', undefined)).toBe('che/che-factory-extension');
expect(convertToCheProjectPath('/projects/che/che-workspace-extension/', undefined)).toBe('che/che-workspace-extension');
});
});