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

Commit

Permalink
Merged in upstream changes from atom/open-on-github (0.37.0)
Browse files Browse the repository at this point in the history
Conflicts:
	README.md
	keymaps/to-the-hubs.cson
	lib/main.coffee
	menus/open-on-github.cson
	package.json
	spec/github-file-spec.coffee
  • Loading branch information
mark-adams committed Jul 11, 2015
2 parents 887d25d + 0c06f92 commit f25c06b
Show file tree
Hide file tree
Showing 9 changed files with 79 additions and 3 deletions.
1 change: 1 addition & 0 deletions .coffeelintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
spec/fixtures
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ When editing a file in Atom, use the command palette or keyboard shortcuts to:
- Open the file on bitbucket.org `alt-b, o`
- Open the blame view for the file on bitbucket.org `alt-b, b`
- Open the history view for the file on bitbucket.org `alt-b, h`
- Open the issues view for the repository the file belongs to on github.com `alt-g, i`
- Open the compare page for the current branch on bitbucket.org `alt-b, r`
- Copy the bitbucket.org URL for the currently selected lines `alt-b, c`

Expand Down
37 changes: 37 additions & 0 deletions coffeelint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"max_line_length": {
"level": "ignore"
},
"no_empty_param_list": {
"level": "error"
},
"arrow_spacing": {
"level": "error"
},
"no_interpolation_in_single_quotes": {
"level": "error"
},
"no_debugger": {
"level": "error"
},
"prefer_english_operator": {
"level": "error"
},
"colon_assignment_spacing": {
"spacing": {
"left": 0,
"right": 1
},
"level": "error"
},
"braces_spacing": {
"spaces": 0,
"level": "error"
},
"spacing_after_comma": {
"level": "error"
},
"no_stand_alone_at": {
"level": "error"
}
}
1 change: 1 addition & 0 deletions keymaps/to-the-buckets.cson
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
'alt-b o': 'open-on-bitbucket:file'
'alt-b b': 'open-on-bitbucket:blame'
'alt-b h': 'open-on-bitbucket:history'
'alt-g i': 'open-on-bitbucket:issues'
'alt-b c': 'open-on-bitbucket:copy-url'
'alt-b r': 'open-on-bitbucket:branch-compare'
'alt-b g': 'open-on-bitbucket:repository'
10 changes: 10 additions & 0 deletions lib/bitbucket-file.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ class BitbucketFile
else
@reportValidationErrors()

openIssues: ->
if @isOpenable()
@openUrlInBrowser(@issuesUrl())
else
@reportValidationErrors()

openRepository: ->
if @isOpenable()
@openUrlInBrowser(@bitbucketRepoUrl())
Expand Down Expand Up @@ -101,6 +107,10 @@ class BitbucketFile
historyUrl: ->
"#{@bitbucketRepoUrl()}/history-node/#{@encodeSegments(@branchName())}/#{@encodeSegments(@repoRelativePath())}"

# Internal
issuesUrl: ->
"#{@bitbucketRepoUrl()}/issues"

# Internal
branchCompareUrl: ->
"#{@bitbucketRepoUrl()}/branch/#{@encodeSegments(@branchName())}"
Expand Down
4 changes: 4 additions & 0 deletions lib/main.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ module.exports =
if itemPath = getActivePath()
BitbucketFile.fromPath(itemPath).history()

'open-on-bitbucket:issues': ->
if itemPath = getActivePath()
BitbucketFile.fromPath(itemPath).openIssues()

'open-on-bitbucket:copy-url': ->
if itemPath = getActivePath()
BitbucketFile.fromPath(itemPath).copyUrl(getSelectedRange())
Expand Down
1 change: 1 addition & 0 deletions menus/open-on-bitbucket.cson
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
{ 'label': 'Copy URL', 'command': 'open-on-bitbucket:copy-url' }
{ 'label': 'File', 'command': 'open-on-bitbucket:file' }
{ 'label': 'History', 'command': 'open-on-bitbucket:history' }
{ 'label': 'Issues', 'command': 'open-on-bitbucket:issues' }
{ 'label': 'Repository', 'command': 'open-on-bitbucket:repository' }
]
]
Expand Down
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "open-on-bitbucket",
"version": "0.2.0",
"version": "0.3.0",
"main": "./lib/main",
"description": "View the active file on bitbucket.org",
"repository": "https://github.com/mark-adams/open-on-bitbucket",
Expand All @@ -12,6 +12,7 @@
"open-on-bitbucket:copy-url",
"open-on-bitbucket:file",
"open-on-bitbucket:history",
"open-on-bitbucket:issues",
"open-on-bitbucket:repository"
]
},
Expand All @@ -20,5 +21,8 @@
},
"dependencies": {
"fs-plus": "2.x"
},
"devDependencies": {
"coffeelint": "^1.9.7"
}
}
21 changes: 19 additions & 2 deletions spec/bitbucket-file-spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ describe "BitbucketFile", ->
setupBitbucketFile = ->
atom.project.setPaths([workingDirPath])
waitsForPromise ->
atom.workspace.open(filePathRelativeToWorkingDir)
atom.workspace.open(filePathRelativeToWorkingDir)

runs ->
editor = atom.workspace.getActiveTextEditor()
Expand Down Expand Up @@ -295,6 +295,23 @@ describe "BitbucketFile", ->
expect(bitbucketFile.openUrlInBrowser).toHaveBeenCalledWith \
'https://bitbucket.org/some-user/some-repo'

describe "openIssues", ->
describe 'when the file is openable on Bitbucket.org', ->
fixtureName = 'bitbucket-remote'

beforeEach ->
setupWorkingDir(fixtureName)
setupBitbucketFile()

afterEach ->
teardownWorkingDirAndRestoreFixture(fixtureName)

it 'opens the Bitbucket.org issues URL', ->
spyOn(bitbucketFile, 'openUrlInBrowser')
bitbucketFile.openIssues()
expect(bitbucketFile.openUrlInBrowser).toHaveBeenCalledWith \
'https://bitbucket.org/some-user/some-repo/issues'

describe "bitbucketRepoUrl", ->
beforeEach ->
bitbucketFile = new BitbucketFile()
Expand Down Expand Up @@ -349,7 +366,7 @@ describe "BitbucketFile", ->
activationPromise = atom.packages.activatePackage('open-on-bitbucket')

waitsForPromise ->
atom.workspace.open()
atom.workspace.open()

runs ->
atom.commands.dispatch(atom.views.getView(atom.workspace.getActivePane()), 'open-on-bitbucket:file')
Expand Down

0 comments on commit f25c06b

Please sign in to comment.