Skip to content

Commit

Permalink
CHE-4097: Refactor go agents package structure (eclipse-che#4344)
Browse files Browse the repository at this point in the history
Also add comments and cleanup code.
Signed-off-by: Alexander Garagatyi <agaragatyi@codenvy.com>
  • Loading branch information
Alexander Garagatyi authored Mar 9, 2017
1 parent 73c14ec commit 2ac7b44
Show file tree
Hide file tree
Showing 95 changed files with 814 additions and 618 deletions.
2 changes: 0 additions & 2 deletions agents/exec/.gitignore

This file was deleted.

59 changes: 0 additions & 59 deletions agents/exec/README.md

This file was deleted.

128 changes: 0 additions & 128 deletions agents/exec/src/auth/auth.go

This file was deleted.

65 changes: 0 additions & 65 deletions agents/exec/src/term/activity.go

This file was deleted.

2 changes: 2 additions & 0 deletions agents/go-agents/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
src/main/go/exec-agent/exec-agent
src/main/go/exec-agent/logs
53 changes: 53 additions & 0 deletions agents/go-agents/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
Summary
---
Golang based server for executing commands and streaming process output logs,
also websocket-terminal.


Requirements
--
- golang 1.6+


Docs
---
- jsonrpc2.0 based [Webscoket API](docs/ws_api.md)
- jsonrpc2.0 based [Events](docs/events.md)
- [REST API](docs/rest_api.md)

Development
---

##### Link the sources to standard go workspace

```bash
export CHE_PATH=~/code/che
mkdir $GOPATH/src/github.com/eclipse/che/agents/go-agents/src/main -p
ln -s $CHE_PATH/agents/go-agents/src/main/go $GOPATH/src/github.com/eclipse/che/agents/go-agents/src/main/go
```

That's it, `$GOPATH/src/github.com/eclipse/che/agents/go-agents` project is ready.

##### Building linked project

```bash
cd $GOPATH/src/github.com/eclipse/che/agents/go-agents/src/main/go && go build ./...
```

#### Building exec agent executable

```bash
cd $GOPATH/src/github.com/eclipse/che/agents/go-agents/src/main/go/exec-agent && go build
```

##### Running linked project tests

```bash
cd $GOPATH/src/github.com/eclipse/che/agents/go-agents/src/main/go && go test ./...
```

##### Formatting linked project sources

```bash
cd $GOPATH/src/github.com/eclipse/che/agents/go-agents/src/main/go && go fmt ./...
```
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
29 changes: 14 additions & 15 deletions agents/exec/pom.xml → agents/go-agents/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
<groupId>org.eclipse.che</groupId>
<version>5.5.0-SNAPSHOT</version>
</parent>
<artifactId>exec-agent</artifactId>
<name>Exec Agent</name>
<artifactId>go-agents</artifactId>
<name>Agent :: Golang agents</name>
<properties>
<go.workspace.name>go-workspace</go.workspace.name>
</properties>
Expand Down Expand Up @@ -56,13 +56,10 @@
<artifactId>license-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>src/term/server.go</exclude>
<exclude>src/docs/**</exclude>
<exclude>src/vendor/**</exclude>
<exclude>src/Godeps/**</exclude>
<exclude>src/.idea/**</exclude>
<exclude>src/exec</exclude>
<exclude>src/*.iml</exclude>
<exclude>/docs/**</exclude>
<exclude>src/main/go/exec-agent/term/server.go</exclude>
<exclude>src/main/go/vendor/**</exclude>
<exclude>src/main/go/Godeps/**</exclude>
</excludes>
</configuration>
</plugin>
Expand All @@ -78,11 +75,13 @@
</goals>
<configuration>
<target>
<!--To not use godep tool vendored dependencies are copied into correct place of GOPATH
by maven-->
<copy todir="${project.build.directory}/${go.workspace.name}/src">
<fileset dir="./src/vendor/" includes="**/*" />
<fileset dir="src/main/go/vendor/" includes="**/*" />
</copy>
<copy todir="${project.build.directory}/${go.workspace.name}/src/github.com/eclipse/che/agents/exec">
<fileset dir="./src/" excludes="vendor/ target/" includes="**/*.*go **/static/*" />
<copy todir="${project.build.directory}/${go.workspace.name}/src/github.com/eclipse/che/agents/go-agents/src/main/go">
<fileset dir="src/main/go/" excludes="vendor/" includes="**/*.*go **/static/*" />
</copy>
</target>
</configuration>
Expand All @@ -95,7 +94,7 @@
<version>0.5.0</version>
<executions>
<execution>
<id>compile-exec-agent</id>
<id>compile-go-agents</id>
<phase>compile</phase>
<goals>
<goal>iterator</goal>
Expand Down Expand Up @@ -150,7 +149,7 @@
<goal>exec</goal>
<configuration>
<executable>go</executable>
<workingDirectory>${project.build.directory}/${go.workspace.name}/src/github.com/eclipse/che/agents/exec</workingDirectory>
<workingDirectory>${project.build.directory}/${go.workspace.name}/src/github.com/eclipse/che/agents/go-agents/src/main/go/exec-agent</workingDirectory>
<arguments>
<argument>build</argument>
<argument>-a</argument>
Expand Down Expand Up @@ -225,7 +224,7 @@
</goals>
<configuration>
<target unless="skipTests">
<exec dir="${project.build.directory}/${go.workspace.name}/src/github.com/eclipse/che/agents/exec" executable="go" failonerror="true">
<exec dir="${project.build.directory}/${go.workspace.name}/src/github.com/eclipse/che/agents/go-agents/src/main/go" executable="go" failonerror="true">
<env key="GOPATH" value="${project.build.directory}/${go.workspace.name}" />
<arg value="test" />
<arg value="-v" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,5 @@
<fileMode>0755</fileMode>
<outputDirectory></outputDirectory>
</fileSet>
<fileSet>
<directory>${project.build.directory}/${go.workspace.name}/src/github.com/eclipse/che/agents/exec/static</directory>
<outputDirectory></outputDirectory>
</fileSet>
</fileSets>
</assembly>
Loading

0 comments on commit 2ac7b44

Please sign in to comment.