Giter Site home page Giter Site logo

atom-open-in-sourcetree's People

Contributors

brettz9 avatar cliffrowley avatar dependabot[bot] avatar gontadu avatar kachkaev avatar mark-hahn avatar sponomarev avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

leetaizhu brettz9

atom-open-in-sourcetree's Issues

Package.getActivationCommands is deprecated.

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)

Use the target path to open SourceTree without prompting for project folders

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)

Object.dirname is deprecated.

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)

Conditional Path ???

In OSX it starts Sourcetree in Parallels Desktop.
I added /Applications/SourceTree.app in line 9 in file open-in-sourcetree.coffee

Tx

does this support windows?

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.

Failed to activate the open-in-sourcetree package

  1. Started atom with --one

Atom Version: 0.194.0 ⚠️ in 1.0 API Preview Mode ⚠️
System: Mac OS X 10.10.3
Thrown From: open-in-sourcetree package, v0.1.2

Stack Trace

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)

Commands

Config

{
  "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"
  }
}

Installed Packages

# 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

spaces in file path

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

Ownership

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.

Uncaught TypeError: string.indexOf is not a function

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.