cliffrowley / atom-open-in-sourcetree Goto Github PK
View Code? Open in Web Editor NEWAtom package to open the current project in SourceTree
License: MIT License
Atom package to open the current project in SourceTree
License: MIT License
Argument to path.dirname
must be a string
Object.dirname (C:\Users\diveyez\AppData\Local\atom\app-1.39.0\resources\app.asar\src\electron-shims.js:9:10)
Object.openApp (C:\Users\diveyez\.atom\packages\open-in-sourcetree\lib\open-in-sourcetree.coffee:55:24)
HTMLElement.<anonymous> (C:\Users\diveyez\.atom\packages\open-in-sourcetree\lib\open-in-sourcetree.coffee:38:24)
CommandRegistry.handleCommandEvent (<embedded>:11:349123)
CommandRegistry.dispatch (<embedded>:11:347598)
AtomEnvironment.dispatchContextMenuCommand (<embedded>:1:744957)
As title says :-)
A target path should be resolvable for most, if not all events.
Here's a quick snippet of what this might look like:
atom-open-in-sourcetree/lib/open-in-sourcetree.coffee:
fs = require 'fs'
path = require 'path'
{CompositeDisposable} = require 'atom'
ProjectPathListView = require './project-path-list-view'
findVCSRootForEvent = (e) ->
if e.currentTarget.getPath?
paths = atom.packages.getActivePackage('tree-view')?.mainModule.selectedPaths()
else # this is the pane atom-text-editor
paths = [e.currentTarget.getModel().getPath()]
return unless paths? # return if tree view package isn't active
for path in paths
findVCSRoot(path)
isVCSRoot = (dir) ->
for vcsDir in ['.git', '.hg']
try
fs.statSync path.join(dir, vcsDir)
return true
catch e
findVCSRoot = (start) ->
if typeof start == 'string'
if start[start.length - 1] != path.sep
start += path.sep
start = start.split(path.sep)
if !start.length
# handle unresolved for path
return []
start.pop()
dir = start.join(path.sep)
isVCSRoot dir ? dir : findVCSRoot start
module.exports =
subscriptions: null
activate: (state) ->
@subscriptions = new CompositeDisposable
@subscriptions.add atom.commands.add 'atom-workspace', 'open-in-sourcetree:open', => @openApp()
deactivate: ->
@subscriptions.destroy()
openApp: (e) ->
rootDirs = findVCSRootForEvent e
if rootDirs.length is 0
# use project paths when no vcs root is found for the event path
rootDirs = atom.project?.getPaths()
if rootDirs.length is 0
atom.notifications.addInfo 'Open in SourceTree',
detail: 'No git or hg root found and this project has no folders!',
dismissable: true
else if rootDirs.length is 1
require('./open-sourcetree')(rootDirs[0])
else
# todo: ProjectPathListView should probably be renamed to PathListView
new ProjectPathListView(rootDirs)
It's a pity, but installing SourceTree with Homebrew is not supported because of another application path.
--one
Atom Version: 0.194.0
System: Mac OS X 10.10.3
Thrown From: open-in-sourcetree package, v0.1.2
Failed to activate the open-in-sourcetree package
At Cannot read property 'command' of undefined
TypeError: Cannot read property 'command' of undefined
at Object.module.exports.activate (/Users/ash/.atom/packages/open-in-sourcetree/lib/open-in-sourcetree.coffee:10:32)
at Package.module.exports.Package.activateNow (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:222:19)
at /Applications/Atom.app/Contents/Resources/app.asar/src/package.js:203:30
at Package.module.exports.Package.measure (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:147:15)
at Package.module.exports.Package.activate (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:195:14)
at PackageManager.module.exports.PackageManager.activatePackage (/Applications/Atom.app/Contents/Resources/app.asar/src/package-manager.js:434:21)
at /Applications/Atom.app/Contents/Resources/app.asar/src/package-manager.js:418:29
at Config.module.exports.Config.transact (/Applications/Atom.app/Contents/Resources/app.asar/src/config.js:311:16)
at PackageManager.module.exports.PackageManager.activatePackages (/Applications/Atom.app/Contents/Resources/app.asar/src/package-manager.js:413:19)
at PackageManager.module.exports.PackageManager.activate (/Applications/Atom.app/Contents/Resources/app.asar/src/package-manager.js:394:46)
at Atom.module.exports.Atom.startEditorWindow (/Applications/Atom.app/Contents/Resources/app.asar/src/atom.js:623:21)
at Object.<anonymous> (/Applications/Atom.app/Contents/Resources/app.asar/src/window-bootstrap.js:12:8)
at Object.<anonymous> (/Applications/Atom.app/Contents/Resources/app.asar/src/window-bootstrap.js:23:4)
at Module._compile (module.js:452:26)
at Object.loadFile [as .js] (/Applications/Atom.app/Contents/Resources/app.asar/src/babel.js:162:21)
at Module.load (module.js:347:32)
{
"core": {
"disabledPackages": [
"atom-spark-core",
"welcome",
"save-session",
"preview",
"color-picker"
],
"themes": [
"atom-dark-ui",
"base16-tomorrow-dark-theme"
],
"audioBeep": false,
"followSymlinks": true,
"projectHome": "/Users/ash/personal"
}
}
# User
Atom-Syntax-highlighting-for-Sass, v0.5.0
angularjs, v0.1.0
atom-alignment, v0.12.0
autocomplete-paths, v1.0.2
autocomplete-plus, v2.12.0
editorconfig, v1.0.0
file-icons, v1.5.4
git-tab-status, v1.7.0
highlight-line, v0.10.2
highlight-selected, v0.9.2
jsonlint, v1.1.0
language-arduino, v0.2.1
language-docker, v1.1.3
language-haml, v0.19.0
language-ini, v1.10.0
language-salt, v0.2.0
linter, v0.12.1
linter-rubocop, v0.2.2
linter-ruby, v0.1.4
minimap, v4.7.6
minimap-color-highlight, v4.1.0
minimap-find-and-replace, v4.2.0
minimap-git-diff, v4.1.2
minimap-highlight-selected, v4.2.1
minimap-selection, v4.2.0
open-in-sourcetree, v0.1.2
open-last-project, v0.4.1
pretty-json, v0.3.3
project-manager, v1.15.5
rspec, v0.1.9
set-syntax, v0.2.1
symbols-tree-view, v0.9.2
vim-mode, v0.44.0
# Dev
No dev packages
Use activationCommands
instead of activationEvents
in your package.json
Commands should be grouped by selector as follows:
"activationCommands": {
"atom-workspace": ["foo:bar", "foo:baz"],
"atom-text-editor": ["foo:quux"]
}
Package.getActivationCommands (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:808:9)
Package.hasActivationCommands (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:733:20)
<unknown> (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:185:24)
Package.measure (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:163:15)
Package.load (/Applications/Atom.app/Contents/Resources/app.asar/src/package.js:177:12)
PackageManager.loadPackage (/Applications/Atom.app/Contents/Resources/app.asar/src/package-manager.js:355:14)
when I have multiple projects added to the same window
/Users/mido/.atom/packages/open-in-sourcetree/node_modules/fuzzaldrin/lib/scorer.js:60
Hide Stack Trace
TypeError: string.indexOf is not a function
at Object.exports.score (open-in-sourcetree/node_modules/fuzzaldrin/lib/scorer.js:60:31)
at module.exports (open-in-sourcetree/node_modules/fuzzaldrin/lib/filter.js:25:24)
at filter (open-in-sourcetree/node_modules/fuzzaldrin/lib/fuzzaldrin.js:21:14)
at ProjectPathListView.module.exports.SelectListView.populateList packages/open-in-sourcetree/node_modules/atom-space-pen-views/lib/select-list-view.js:195:25)
at open-in-sourcetree/node_modules/atom-space-pen-views/lib/select-list-view.js:350:26
I'm on windows 8.1 and the command doesn't seem to do anything. If it is mac-only this should probably say so in the readme to save other people of installing and trying this.
The context menu CSON format has changed. Please see
https://atom.io/docs/api/latest/ContextMenuManager
In OSX it starts Sourcetree in Parallels Desktop.
I added /Applications/SourceTree.app in line 9 in file open-in-sourcetree.coffee
Tx
If a space is present in file path => no go
I added '...'
line 9 in open-in-sourcetree.coffee
exec "open -a /Applications/SourceTree.app '#{path}'" if path?
Tx
Hi there,
I have some long-standing health issues, and can't promise anything, but given as we've already worked together, and if you want a better chance that someone else can keep the package updated, I'd be happy to accept the publishing details / repository ownership unless there are any other volunteers.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.