-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Yevhen Vydolob <evidolob@codenvy.com>
- Loading branch information
Yevhen Vydolob
committed
Aug 1, 2017
1 parent
0ea6a9d
commit e1dac3b
Showing
21 changed files
with
781 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
Copyright (c) 2012-2017 Codenvy, S.A. | ||
All rights reserved. This program and the accompanying materials | ||
are made available under the terms of the Eclipse Public License v1.0 | ||
which accompanies this distribution, and is available at | ||
http://www.eclipse.org/legal/epl-v10.html | ||
Contributors: | ||
Codenvy, S.A. - initial API and implementation | ||
--> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<artifactId>che-agents-parent</artifactId> | ||
<groupId>org.eclipse.che</groupId> | ||
<version>5.16.0-SNAPSHOT</version> | ||
</parent> | ||
<artifactId>test-ls-agent</artifactId> | ||
<name>Test Language Server Agent</name> | ||
<dependencies> | ||
<dependency> | ||
<groupId>com.google.inject</groupId> | ||
<artifactId>guice</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.google.inject.extensions</groupId> | ||
<artifactId>guice-multibindings</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.eclipse.che.core</groupId> | ||
<artifactId>che-core-api-agent-shared</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.eclipse.che.core</groupId> | ||
<artifactId>che-core-commons-inject</artifactId> | ||
</dependency> | ||
</dependencies> | ||
</project> |
35 changes: 35 additions & 0 deletions
35
agents/test-ls/src/main/java/org/eclipse/che/api/agent/TestLSAgent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2012-2017 Codenvy, S.A. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contributors: | ||
* Codenvy, S.A. - initial API and implementation | ||
*******************************************************************************/ | ||
|
||
package org.eclipse.che.api.agent; import com.google.inject.Inject; | ||
import com.google.inject.Singleton; | ||
|
||
import org.eclipse.che.api.agent.shared.model.Agent; | ||
import org.eclipse.che.api.agent.shared.model.impl.BasicAgent; | ||
|
||
import java.io.IOException; | ||
|
||
/** | ||
* Test Language server agent. | ||
* | ||
* @see Agent | ||
* | ||
*/ | ||
@Singleton | ||
public class TestLSAgent extends BasicAgent { | ||
private static final String AGENT_DESCRIPTOR = "org.eclipse.che.test.ls.json"; | ||
private static final String AGENT_SCRIPT = "org.eclipse.che.test.ls.script.sh"; | ||
|
||
@Inject | ||
public TestLSAgent() throws IOException { | ||
super(AGENT_DESCRIPTOR, AGENT_SCRIPT); | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
agents/test-ls/src/main/java/org/eclipse/che/api/agent/TestLSModule.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2012-2017 Codenvy, S.A. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contributors: | ||
* Codenvy, S.A. - initial API and implementation | ||
*******************************************************************************/ | ||
|
||
package org.eclipse.che.api.agent; | ||
|
||
import com.google.inject.AbstractModule; | ||
import com.google.inject.multibindings.Multibinder; | ||
|
||
import org.eclipse.che.api.agent.shared.model.Agent; | ||
import org.eclipse.che.inject.DynaModule; | ||
|
||
/** | ||
* | ||
*/ | ||
@DynaModule | ||
public class TestLSModule extends AbstractModule { | ||
@Override | ||
protected void configure() { | ||
Multibinder<Agent> agents = Multibinder.newSetBinder(binder(), Agent.class); | ||
agents.addBinding().to(TestLSAgent.class); | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
agents/test-ls/src/main/resources/org.eclipse.che.test.ls.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"id": "org.eclipse.che.test.ls", | ||
"name": "Simple Test language server", | ||
"description": "Test LS", | ||
"dependencies": [], | ||
"properties": {} | ||
} |
170 changes: 170 additions & 0 deletions
170
agents/test-ls/src/main/resources/org.eclipse.che.test.ls.script.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,170 @@ | ||
# | ||
# Copyright (c) 2012-2017 Codenvy, S.A. | ||
# All rights reserved. This program and the accompanying materials | ||
# are made available under the terms of the Eclipse Public License v1.0 | ||
# which accompanies this distribution, and is available at | ||
# http://www.eclipse.org/legal/epl-v10.html | ||
# | ||
# Contributors: | ||
# Codenvy, S.A. - initial API and implementation | ||
# | ||
|
||
unset PACKAGES | ||
unset SUDO | ||
command -v tar >/dev/null 2>&1 || { PACKAGES=${PACKAGES}" tar"; } | ||
command -v curl >/dev/null 2>&1 || { PACKAGES=${PACKAGES}" curl"; } | ||
test "$(id -u)" = 0 || SUDO="sudo -E" | ||
|
||
AGENT_BINARIES_URI=https://codenvy.com/update/repository/public/download/org.eclipse.che.ls.test.binaries | ||
CHE_DIR=$HOME/che | ||
LS_DIR=${CHE_DIR}/test-ls | ||
LS_LAUNCHER=${LS_DIR}/launch.sh | ||
|
||
if [ -f /etc/centos-release ]; then | ||
FILE="/etc/centos-release" | ||
LINUX_TYPE=$(cat $FILE | awk '{print $1}') | ||
elif [ -f /etc/redhat-release ]; then | ||
FILE="/etc/redhat-release" | ||
LINUX_TYPE=$(cat $FILE | cut -c 1-8) | ||
else | ||
FILE="/etc/os-release" | ||
LINUX_TYPE=$(cat $FILE | grep ^ID= | tr '[:upper:]' '[:lower:]') | ||
LINUX_VERSION=$(cat $FILE | grep ^VERSION_ID=) | ||
fi | ||
|
||
MACHINE_TYPE=$(uname -m) | ||
|
||
mkdir -p ${CHE_DIR} | ||
mkdir -p ${LS_DIR} | ||
|
||
######################## | ||
### Install packages ### | ||
######################## | ||
|
||
# Red Hat Enterprise Linux 7 | ||
############################ | ||
if echo ${LINUX_TYPE} | grep -qi "rhel"; then | ||
test "${PACKAGES}" = "" || { | ||
${SUDO} yum install ${PACKAGES}; | ||
} | ||
|
||
command -v nodejs >/dev/null 2>&1 || { | ||
curl --silent --location https://rpm.nodesource.com/setup_6.x | ${SUDO} bash -; | ||
${SUDO} yum -y install nodejs; | ||
} | ||
|
||
# Red Hat Enterprise Linux 6 | ||
############################ | ||
elif echo ${LINUX_TYPE} | grep -qi "Red Hat"; then | ||
test "${PACKAGES}" = "" || { | ||
${SUDO} yum install ${PACKAGES}; | ||
} | ||
|
||
command -v nodejs >/dev/null 2>&1 || { | ||
curl --silent --location https://rpm.nodesource.com/setup_6.x | ${SUDO} bash -; | ||
${SUDO} yum -y install nodejs; | ||
} | ||
|
||
|
||
# Ubuntu 14.04 16.04 / Linux Mint 17 | ||
#################################### | ||
elif echo ${LINUX_TYPE} | grep -qi "ubuntu"; then | ||
test "${PACKAGES}" = "" || { | ||
${SUDO} apt-get update; | ||
${SUDO} apt-get -y install ${PACKAGES}; | ||
} | ||
|
||
command -v nodejs >/dev/null 2>&1 || { | ||
{ | ||
curl -sL https://deb.nodesource.com/setup_6.x | ${SUDO} bash -; | ||
}; | ||
|
||
${SUDO} apt-get update; | ||
${SUDO} apt-get install -y nodejs; | ||
} | ||
|
||
|
||
# Debian 8 | ||
########## | ||
elif echo ${LINUX_TYPE} | grep -qi "debian"; then | ||
test "${PACKAGES}" = "" || { | ||
${SUDO} apt-get update; | ||
${SUDO} apt-get -y install ${PACKAGES}; | ||
} | ||
|
||
command -v nodejs >/dev/null 2>&1 || { | ||
{ | ||
curl -sL https://deb.nodesource.com/setup_6.x | ${SUDO} bash -; | ||
}; | ||
|
||
${SUDO} apt-get update; | ||
${SUDO} apt-get install -y nodejs; | ||
} | ||
|
||
# Fedora 23 | ||
########### | ||
elif echo ${LINUX_TYPE} | grep -qi "fedora"; then | ||
command -v ps >/dev/null 2>&1 || { PACKAGES=${PACKAGES}" procps-ng"; } | ||
test "${PACKAGES}" = "" || { | ||
${SUDO} dnf -y install ${PACKAGES}; | ||
} | ||
|
||
command -v nodejs >/dev/null 2>&1 || { | ||
curl --silent --location https://rpm.nodesource.com/setup_6.x | ${SUDO} bash -; | ||
${SUDO} dnf -y install nodejs; | ||
} | ||
|
||
|
||
# CentOS 7.1 & Oracle Linux 7.1 | ||
############################### | ||
elif echo ${LINUX_TYPE} | grep -qi "centos"; then | ||
test "${PACKAGES}" = "" || { | ||
${SUDO} yum -y install ${PACKAGES}; | ||
} | ||
|
||
command -v nodejs >/dev/null 2>&1 || { | ||
curl --silent --location https://rpm.nodesource.com/setup_6.x | ${SUDO} bash -; | ||
${SUDO} yum -y install nodejs; | ||
} | ||
|
||
# openSUSE 13.2 | ||
############### | ||
elif echo ${LINUX_TYPE} | grep -qi "opensuse"; then | ||
test "${PACKAGES}" = "" || { | ||
${SUDO} zypper install -y ${PACKAGES}; | ||
} | ||
|
||
command -v nodejs >/dev/null 2>&1 || { | ||
${SUDO} zypper ar http://download.opensuse.org/repositories/devel:/languages:/nodejs/openSUSE_13.1/ Node.js | ||
${SUDO} zypper in nodejs | ||
} | ||
|
||
# Alpine 3.3 | ||
############ | ||
elif echo ${LINUX_TYPE} | grep -qi "alpine"; then | ||
test "${PACKAGES}" = "" || { | ||
${SUDO} apk update | ||
${SUDO} apk add ${PACKAGES}; | ||
} | ||
|
||
command -v nodejs >/dev/null 2>&1 || { | ||
${SUDO} apk update | ||
${SUDO} apk add nodejs; | ||
} | ||
|
||
else | ||
>&2 echo "Unrecognized Linux Type" | ||
>&2 cat $FILE | ||
exit 1 | ||
fi | ||
|
||
|
||
####################### | ||
### Install Test LS ### | ||
####################### | ||
|
||
curl -s ${AGENT_BINARIES_URI} | tar xzf - -C ${LS_DIR} | ||
|
||
touch ${LS_LAUNCHER} | ||
chmod +x ${LS_LAUNCHER} | ||
echo "${LS_DIR}/test-ls/server.sh" > ${LS_LAUNCHER} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.