Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
… version 1.5.0
  • Loading branch information
pweingardt committed Aug 6, 2017
1 parent 1af9418 commit 5b08127
Show file tree
Hide file tree
Showing 11 changed files with 58 additions and 54 deletions.
2 changes: 1 addition & 1 deletion de.weingardt.mylyn.gitlab.core/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Mylyn Gitlab Connector Core
Bundle-SymbolicName: de.weingardt.mylyn.gitlab.core;singleton:=true
Bundle-Version: 1.4.0
Bundle-Version: 1.5.0
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.mylyn.commons.core;bundle-version="[3.8.0,4.0.0)",
org.eclipse.mylyn.commons.net;bundle-version="[3.8.0,4.0.0)",
Expand Down
2 changes: 1 addition & 1 deletion de.weingardt.mylyn.gitlab.core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<relativePath>../pom.xml</relativePath>
<groupId>de.weingardt.mylyn.gitlab</groupId>
<artifactId>de.weingardt.mylyn.gitlab-parent</artifactId>
<version>1.4.0</version>
<version>1.5.0</version>
</parent>

<artifactId>de.weingardt.mylyn.gitlab.core</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class ConnectionManager {
/**
* The pattern is used to verify a ULR to a valid Gitlab project URL.
*/
private static Pattern URLPattern = Pattern.compile("((?:http|https)://(?:.*))/((?:[^\\/]*?)/(?:[^\\/]*?))$");
private static Pattern URLPattern = Pattern.compile("((?:http|https)://(?:[^\\/]*))/((?:.*?)/(?:[^\\/]*?))$");

/**
* Returns the GitlabConnection for the given task repository
Expand Down Expand Up @@ -90,13 +90,17 @@ static GitlabConnection validate(TaskRepository repository) throws GitlabExcepti
String password= repository.getCredentials(AuthenticationType.REPOSITORY).getPassword();

GitlabSession session = null;
String token = null;

if(repository.getProperty("usePrivateToken") != null && repository.getProperty("usePrivateToken").equals("true")) {
session = GitlabAPI.connect(host, password).getCurrentSession();
token = password;
} else {
session = GitlabAPI.connect(host, username, password);
token = session.getPrivateToken();
}

GitlabAPI api = GitlabAPI.connect(host, session.getPrivateToken());
GitlabAPI api = GitlabAPI.connect(host, token);

if(projectPath.endsWith(".git")) {
projectPath = projectPath.substring(0, projectPath.length() - 4);
Expand All @@ -105,7 +109,7 @@ static GitlabConnection validate(TaskRepository repository) throws GitlabExcepti
List<GitlabProject> projects = api.getProjects();
for(GitlabProject p : projects) {
if(p.getPathWithNamespace().equals(projectPath)) {
GitlabConnection connection = new GitlabConnection(host, p, session,
GitlabConnection connection = new GitlabConnection(host, p, token,
new GitlabAttributeMapper(repository));
return connection;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,28 +28,28 @@
public class GitlabConnection {

public final String host;
public final GitlabSession session;
public final String token;
public final GitlabProject project;
public final GitlabAttributeMapper mapper;

private List<GitlabMilestone> milestones;
private List<GitlabProjectMember> members;
public GitlabConnection(String host, GitlabProject project, GitlabSession session,

public GitlabConnection(String host, GitlabProject project, String token,
GitlabAttributeMapper mapper) {
this.host = host;
this.project = project;
this.session = session;
this.token = token;
this.mapper = mapper;
}

public GitlabAPI api() {
return GitlabAPI.connect(host, session.getPrivateToken());
return GitlabAPI.connect(host, token);
}

public void update() throws IOException {
ArrayList<GitlabProjectMember> memberList = new ArrayList<GitlabProjectMember>();

milestones = api().getMilestones(project);
memberList.addAll(api().getProjectMembers(project));
// This might fail sometimes, because the namespace is not an actual namespace.
Expand All @@ -65,9 +65,9 @@ public void update() throws IOException {
public List<GitlabMilestone> getMilestones() {
return Collections.unmodifiableList(milestones);
}

public List<GitlabProjectMember> getProjectMembers() {
return Collections.unmodifiableList(members);
}

}
2 changes: 1 addition & 1 deletion de.weingardt.mylyn.gitlab.ui/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Mylyn Gitlab Connector UI
Bundle-SymbolicName: de.weingardt.mylyn.gitlab.ui;singleton:=true
Bundle-Version: 1.4.0
Bundle-Version: 1.5.0
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.ui,
Expand Down
2 changes: 1 addition & 1 deletion de.weingardt.mylyn.gitlab.ui/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<relativePath>../pom.xml</relativePath>
<groupId>de.weingardt.mylyn.gitlab</groupId>
<artifactId>de.weingardt.mylyn.gitlab-parent</artifactId>
<version>1.4.0</version>
<version>1.5.0</version>
</parent>

<artifactId>de.weingardt.mylyn.gitlab.ui</artifactId>
Expand Down
16 changes: 8 additions & 8 deletions de.weingardt.mylyn.gitlab.updatesite/category.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<site>
<feature id="de.weingardt.mylyn.gitlab" version="1.4.0">
<category name="org.eclipse.mylyn" />
</feature>
<category-def name="org.eclipse.mylyn" label="Mylyn Connectors">
<description>
Available Mylyn Connectors
</description>
</category-def>
<feature id="de.weingardt.mylyn.gitlab" version="1.5.0">
<category name="org.eclipse.mylyn"/>
</feature>
<category-def name="org.eclipse.mylyn" label="Mylyn Connectors">
<description>
Available Mylyn Connectors
</description>
</category-def>
</site>
2 changes: 1 addition & 1 deletion de.weingardt.mylyn.gitlab.updatesite/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<relativePath>../pom.xml</relativePath>
<groupId>de.weingardt.mylyn.gitlab</groupId>
<artifactId>de.weingardt.mylyn.gitlab-parent</artifactId>
<version>1.4.0</version>
<version>1.5.0</version>
</parent>

<artifactId>de.weingardt.mylyn.gitlab.updatesite</artifactId>
Expand Down
50 changes: 25 additions & 25 deletions de.weingardt.mylyn.gitlab/feature.xml
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<feature
id="de.weingardt.mylyn.gitlab"
label="Mylyn Gitlab Connector"
version="1.4.0"
provider-name="Weingardt Software">
id="de.weingardt.mylyn.gitlab"
label="Mylyn Gitlab Connector"
version="1.5.0"
provider-name="Weingardt Software">

<description>
A simple Mylyn connector for the open source management software Gitlab.
</description>
<description>
A simple Mylyn connector for the open source management software Gitlab.
</description>

<copyright>
Copyright by Paul Weingardt, licensed under EPL v1.0
</copyright>
<copyright>
Copyright by Paul Weingardt, licensed under EPL v1.0
</copyright>

<license url="http://www.eclipse.org/legal/epl-v10.html">
Eclipse Public License v1.0
</license>
<license url="http://www.eclipse.org/legal/epl-v10.html">
Eclipse Public License v1.0
</license>

<plugin
id="de.weingardt.mylyn.gitlab.core"
download-size="0"
install-size="0"
version="1.4.0"
unpack="false"/>
<plugin
id="de.weingardt.mylyn.gitlab.core"
download-size="0"
install-size="0"
version="1.5.0"
unpack="false"/>

<plugin
id="de.weingardt.mylyn.gitlab.ui"
download-size="0"
install-size="0"
version="1.4.0"
unpack="false"/>
<plugin
id="de.weingardt.mylyn.gitlab.ui"
download-size="0"
install-size="0"
version="1.5.0"
unpack="false"/>

</feature>
2 changes: 1 addition & 1 deletion de.weingardt.mylyn.gitlab/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<relativePath>../pom.xml</relativePath>
<groupId>de.weingardt.mylyn.gitlab</groupId>
<artifactId>de.weingardt.mylyn.gitlab-parent</artifactId>
<version>1.4.0</version>
<version>1.5.0</version>
</parent>

<artifactId>de.weingardt.mylyn.gitlab</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>de.weingardt.mylyn.gitlab</groupId>
<artifactId>de.weingardt.mylyn.gitlab-parent</artifactId>
<version>1.4.0</version>
<version>1.5.0</version>
<packaging>pom</packaging>

<properties>
Expand Down

0 comments on commit 5b08127

Please sign in to comment.