diff --git a/.coffeelintignore b/.coffeelintignore new file mode 100644 index 0000000..1db51fe --- /dev/null +++ b/.coffeelintignore @@ -0,0 +1 @@ +spec/fixtures diff --git a/README.md b/README.md index a5dadc3..7a28109 100644 --- a/README.md +++ b/README.md @@ -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` diff --git a/coffeelint.json b/coffeelint.json new file mode 100644 index 0000000..a5dd715 --- /dev/null +++ b/coffeelint.json @@ -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" + } +} diff --git a/keymaps/to-the-buckets.cson b/keymaps/to-the-buckets.cson index 07fe485..8a638d7 100644 --- a/keymaps/to-the-buckets.cson +++ b/keymaps/to-the-buckets.cson @@ -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' diff --git a/lib/bitbucket-file.coffee b/lib/bitbucket-file.coffee index f0aa278..f904a71 100644 --- a/lib/bitbucket-file.coffee +++ b/lib/bitbucket-file.coffee @@ -48,6 +48,12 @@ class BitbucketFile else @reportValidationErrors() + openIssues: -> + if @isOpenable() + @openUrlInBrowser(@issuesUrl()) + else + @reportValidationErrors() + openRepository: -> if @isOpenable() @openUrlInBrowser(@bitbucketRepoUrl()) @@ -101,6 +107,10 @@ class BitbucketFile historyUrl: -> "#{@bitbucketRepoUrl()}/history-node/#{@encodeSegments(@branchName())}/#{@encodeSegments(@repoRelativePath())}" + # Internal + issuesUrl: -> + "#{@bitbucketRepoUrl()}/issues" + # Internal branchCompareUrl: -> "#{@bitbucketRepoUrl()}/branch/#{@encodeSegments(@branchName())}" diff --git a/lib/main.coffee b/lib/main.coffee index 20f8399..6b437c1 100644 --- a/lib/main.coffee +++ b/lib/main.coffee @@ -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()) diff --git a/menus/open-on-bitbucket.cson b/menus/open-on-bitbucket.cson index bd47203..375e7bb 100644 --- a/menus/open-on-bitbucket.cson +++ b/menus/open-on-bitbucket.cson @@ -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' } ] ] diff --git a/package.json b/package.json index 4740c57..0ae1c63 100644 --- a/package.json +++ b/package.json @@ -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", @@ -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" ] }, @@ -20,5 +21,8 @@ }, "dependencies": { "fs-plus": "2.x" + }, + "devDependencies": { + "coffeelint": "^1.9.7" } } diff --git a/spec/bitbucket-file-spec.coffee b/spec/bitbucket-file-spec.coffee index 2982205..c44a5fa 100644 --- a/spec/bitbucket-file-spec.coffee +++ b/spec/bitbucket-file-spec.coffee @@ -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() @@ -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() @@ -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')