Skip to content

Commit

Permalink
dev: 2.1 Ground work. (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-gibson authored Nov 6, 2017
1 parent 69cfafe commit 0650863
Show file tree
Hide file tree
Showing 100 changed files with 2,460 additions and 1,712 deletions.
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,12 @@ All Notable changes to `Open in Git host` will be documented in this file

## 2.0.1 - 2017-09-30

- Fixed encoding issue when URL contains non-ASCII characters. #40
- Fixed encoding issue when URL contains non-ASCII characters. #40

## 2.1.0 - 2017-11-05

- Code refactor
- Separated shortcuts for opening in the browser and copying to the clipboard #47
- Rename plugin to GitLink #46
- Make default branch customisable #45
- Add custom URL factory #44
51 changes: 32 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,35 @@
# Open in Git host

[![Build Status](https://travis-ci.org/ben-gibson/jetbrains-open-in-git-host.svg?branch=master)](https://travis-ci.org/ben-gibson/jetbrains-open-in-git-host)
[![Join the chat at https://gitter.im/jetbrains-open-in-git-host/Lobby](https://badges.gitter.im/jetbrains-open-in-git-host/Lobby.svg)](https://gitter.im/jetbrains-open-in-git-host/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

A Jetbrains plugin that opens a local file under Git version control in its remote host using the default browser.
It can also optionally copy the URL to the clipboard.
<h1 align="center">
GitLink
<br>
</h1>

<h4 align="center">
A Jetbrains plugin that provides shortcuts to open a file or commit in Stash, GitHub, BitBucket or GitLab using the default browser or copy the link to the clipboard.
</h4>

<p align="center">
<a href="https://travis-ci.org/ben-gibson/jetbrains-open-in-git-host">
<img src="https://travis-ci.org/ben-gibson/jetbrains-open-in-git-host.svg?branch=master"
alt="Gitter">
</a>
<a href="https://gitter.im/jetbrains-open-in-git-host/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge"><img src="https://badges.gitter.im/jetbrains-open-in-git-host/Lobby.svg"></a>
</p>
<br>

Installation
-------------------------------------------------------------------------------

This plugin is published on the
[JetBrains Plugin Repository](https://plugins.jetbrains.com/plugin/8183):

Preferences → Plugins → Browse Repositories → Search for "Open in Git host"
Preferences → Plugins → Browse Repositories → Search for "GitLink"

### From Source

Clone this repository:

$ git clone https://github.com/ben-gibson/jetbrains-open-in-git-host
$ cd jetbrains-open-in-git-host
$ git clone https://github.com/ben-gibson/GitLink
$ cd GitLink

Update the permissions:

Expand All @@ -29,7 +39,7 @@ Build the plugin zip file:

$ ./gradlew buildPlugin

Install the plugin from `./build/distributions/RemoteRepositoryMapper.zip`:
Install the plugin from `./build/distributions/GitLink-2.*.zip`:

Preferences → Plugins → Install plugin from disk

Expand All @@ -44,29 +54,32 @@ Update the permissions:
Execute an IntelliJ IDEA instance with the plugin you're developing installed:

$ ./gradlew runIdea

Run the tests:

$ ./gradlew test

Usage
-------------------------------------------------------------------------------

After installing the plugin set your remote host in the preferences:
After installing the plugin set your remote host (GitHub, GitLab, BitBucket, Stash) and enabled extensions in the preferences:

Preferences → Other Settings → Open in Git host
Preferences → Other Settings → GitLink
Make sure you have registered your projects root under the version control preferences:

Preferences → Version Control (see unregistered roots)

Open a project file that is under Git version control in the editor:
To open the current file in the default browser:

View → Open in (your selected host) or
Select in... → Browser (GitLink)

To copy the link to you clipboard:

View → Open in Git host or
Select in... → Open in Git host
View → Copy (your selected host) link to clipboard

The current branch is used unless it does not exist in the remote host in which case it defaults to using the master branch.
The resulting link can be copied to the clipboard depending on your plugin preferences.
The current branch is used unless it does not exist on the remote in which case it defaults to your preferred branch as defined in the plugin settings.

Change log
-------------------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ sourceSets {

intellij {
plugins 'git4idea'
pluginName 'Open in Git host'
pluginName 'GitLink'
updateSinceUntilBuild false
sameSinceUntilBuild false
}

group 'org.jetbrains'
version '2.0.1'
version '2.1.0'
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Tue Aug 22 17:18:30 BST 2017
#Sat Sep 30 01:29:20 BST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-all.zip
Binary file added resources/Icons/Custom/Custom.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/Icons/Custom/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
75 changes: 48 additions & 27 deletions resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
@@ -1,32 +1,33 @@
<idea-plugin url="https://github.com/ben-gibson/jetbrains-open-in-git-host">
<idea-plugin url="https://github.com/ben-gibson/GitLink">
<id>uk.co.ben-gibson.remote.repository.mapper</id>
<name>Open in Git host</name>
<version>2.0.1</version>
<vendor url="https://github.com/ben-gibson/jetbrains-open-in-git-host">Ben Gibson</vendor>
<name>GitLink</name>
<version>2.1.0</version>
<vendor url="https://github.com/ben-gibson/GitLink">Ben Gibson</vendor>
<description><![CDATA[
Determines the remote URL of a git commit or file and runs it through enabled extensions. Extensions allow the URL to be
opened in the default browser and copied to the clipboard etc.
Provides shortcuts to open a file or commit in Stash, GitHub, BitBucket or GitLab using the default browser or copy the link to the clipboard.
<br />
<br />
After installing select your remote host and the extensions you want enabled in Settings &rarr; Other Settings &rarr; Open in Git host
(currently supports the hosts GitHub, Stash, BitBucket and GitLab). Make sure you have registered your project's root under the version control settings.
After installing select your remote host in Settings &rarr; Other Settings &rarr; GitLink
(currently supports GitHub, Stash, BitBucket and GitLab). Make sure you have registered your project's root under the version control settings.
Preferences → Version Control (see unregistered roots)
<br />
<br />
To use, open a file that is under Git version control in the editor and select View &rarr; Open in Git host. You can
To open a file in the default browser select View &rarr; Open in (your selected host). You can
also access this action through the <i>Select target</i> menu under Navigate &rarr; Select in. If you want to view
a specific commit, you can do this by right clicking the commit from the <i>VCS log tool window</i> and selecting
Open in Git host.
Open in (your selected host).
<br />
<br />
Note: The current branch is used unless it does not exist in your remote host in which case it defaults to the
master branch.
Note: The current branch is used unless it does not exist on the remote in which case your preferred default,
defined in the settings, is used.
]]></description>
<change-notes><![CDATA[
<ul>
<li>
Fixed encoding issue when URL contains non-ASCII characters. <a href="https://github.com/ben-gibson/jetbrains-open-in-git-host/issues/40">#40</a>
</li>
<li>Code refactor</li>
<li>Separate shortcuts for opening in the browser and copying to the clipboard <a href="https://github.com/ben-gibson/jetbrains-open-in-git-host/issues/47">#47</a>.</li>
<li>Rename project to GitLink <a href="https://github.com/ben-gibson/jetbrains-open-in-git-host/issues/46">#46</a>.</li>
<li>Make default branch customisable <a href="https://github.com/ben-gibson/jetbrains-open-in-git-host/issues/45">#45</a>.</li>
<li>Add custom URL factory <a href="https://github.com/ben-gibson/jetbrains-open-in-git-host/issues/44">#44</a>.</li>
</ul>
]]>
</change-notes>
Expand All @@ -44,31 +45,51 @@

<extensions defaultExtensionNs="com.intellij">
<applicationService
serviceInterface="uk.co.ben_gibson.open.in.git.host.Container"
serviceImplementation="uk.co.ben_gibson.open.in.git.host.Container"
serviceInterface="uk.co.ben_gibson.git.link.Container"
serviceImplementation="uk.co.ben_gibson.git.link.Container"
/>
<projectService serviceImplementation="uk.co.ben_gibson.open.in.git.host.Settings"/>
<projectConfigurable instance="uk.co.ben_gibson.open.in.git.host.Configuration"/>
<selectInTarget implementation="uk.co.ben_gibson.open.in.git.host.UI.Target.SelectInTarget"/>
<projectService serviceImplementation="uk.co.ben_gibson.git.link.Preferences"/>
<projectConfigurable instance="uk.co.ben_gibson.git.link.UI.Settings.ConfigurableSettings"/>
<selectInTarget implementation="uk.co.ben_gibson.git.link.UI.Target.BrowserSelectInTarget"/>
</extensions>

<actions>

<action
id="uk.co.ben_gibson.open.in.git.host.UI.Action.MenuAction.FileAction"
class="uk.co.ben_gibson.open.in.git.host.UI.Action.MenuAction"
text="Open in Git host"
description="Opens the version controlled file in the Git host using the default browser"
id="uk.co.ben_gibson.git.link.UI.Action.Menu.MenuAction.Browser"
class="uk.co.ben_gibson.git.link.UI.Action.Menu.BrowserMenuAction"
text="Open in git host"
description="Opens the file in the remote git host using the default browser"
>
<add-to-group group-id="ViewMenu" anchor="last"/>
<add-to-group group-id="EditorPopupMenu"/>
<add-to-group group-id="ProjectViewPopupMenu"/>
<add-to-group group-id="EditorTabPopupMenu"/>
<keyboard-shortcut keymap="$default" first-keystroke="shift ctrl M"/>
<keyboard-shortcut keymap="Mac OS X 10.5+" first-keystroke="shift ctrl O"/>
<keyboard-shortcut keymap="$default" first-keystroke="shift ctrl O"/>
</action>
<action
id="uk.co.ben_gibson.git.link.UI.Action.Menu.MenuAction.Clipboard"
class="uk.co.ben_gibson.git.link.UI.Action.Menu.ClipboardMenuAction"
text="Copy link to git host"
description="Copies a link to the file in the remote git host"
>
<add-to-group group-id="ViewMenu" anchor="last"/>
<add-to-group group-id="EditorPopupMenu"/>
<add-to-group group-id="ProjectViewPopupMenu"/>
<add-to-group group-id="EditorTabPopupMenu"/>
<keyboard-shortcut keymap="Mac OS X 10.5+" first-keystroke="shift ctrl C"/>
<keyboard-shortcut keymap="$default" first-keystroke="shift ctrl C"/>
</action>

<action id="uk.co.ben_gibson.git.link.UI.Action.Menu.VcsAction.Browser" class="uk.co.ben_gibson.git.link.UI.Action.Vcs.BrowserVcsAction" text="Open in git host"
description="Opens the commit in the remote git host using the default browser">
<add-to-group group-id="Git.LogContextMenu" />
<add-to-group group-id="Vcs.Log.ContextMenu" />
</action>

<action id="RemoteRepositoryMapper.Open.Commit.In.Git.Host" class="uk.co.ben_gibson.open.in.git.host.UI.Action.VcsLogAction" text="Open in Git host"
description="Opens the commit in the Git host using the default browser">
<action id="uk.co.ben_gibson.git.link.UI.Action.Menu.VcsAction.Clipboard" class="uk.co.ben_gibson.git.link.UI.Action.Vcs.ClipboardVcsAction" text="Copy link to git host"
description="Copies a link to the commit in the remote git host">
<add-to-group group-id="Git.LogContextMenu" />
<add-to-group group-id="Vcs.Log.ContextMenu" />
</action>
Expand Down
Loading

0 comments on commit 0650863

Please sign in to comment.