Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[release] update to alfred handler framework

  • Loading branch information...
commit a0df522427c7a4686c1304885488fb2aa4f8545c 1 parent 763bcda
@zhaocai authored
View
11 README.md
@@ -2,10 +2,15 @@
Alfred 2 Workflow to list, search, and open [Source Tree](http://www.sourcetreeapp.com/ "SourceTree") repositories in [Alfred](http://www.alfredapp.com/ "Alfred App - Productivity App for Mac OS X").
-![workflow](https://raw.github.com/zhaocai/alfred2-sourcetree-workflow/master/screenshots/workflow.png)
+![](https://raw.github.com/zhaocai/alfred2-sourcetree-workflow/master/screenshots/workflow.png)
## Usage
+### 0. Show Help
+
+Just type `-?`, `-h`, or `--help` after the keyword to show help.
+
+
### A. Keywords:
1. `st`: List and query source tree repositories.
@@ -17,11 +22,11 @@ Alfred 2 Workflow to list, search, and open [Source Tree](http://www.sourcetreea
### B. Modifier Key
-1. `` : Reveal in Finder
+1. `command` : Reveal in Finder
1. `alt` : Browser in Alfred
-![query](https://raw.github.com/zhaocai/alfred2-sourcetree-workflow/master/screenshots/query.png)
+![](https://raw.github.com/zhaocai/alfred2-sourcetree-workflow/master/screenshots/query.png)
## Installation
View
4 Rakefile
@@ -37,7 +37,7 @@ task "bundle:install" => [:chdir] do
if ! ok
puts "fail to install gems (status = #{res.exitstatus})"
else
- sh %Q{find bundle -type d -name cache -print0 | xargs -0 rm -rf}
+ sh %Q{find bundle -type d \\( -name cache -o -name spec -o -name test \\) -print0 | xargs -0 rm -rf}
end
end
end
@@ -48,7 +48,7 @@ task "bundle:update" => [:chdir] do
if ! ok
puts "fail to update gems (status = #{res.exitstatus})"
else
- sh %Q{find bundle -type d -name cache -print0 | xargs -0 rm -rf}
+ sh %Q{find bundle -type d \\( -name cache -o -name spec -o -name test \\) -print0 | xargs -0 rm -rf}
end
end
end
View
BIN  Source Tree.alfredworkflow
Binary file not shown
View
4 config.yml
@@ -2,4 +2,6 @@
path: workflow
domain: me.zhaowu
id: sourcetree
-
+# If you are using Alfred's advanced Dropbox sync, indicate the path shown in
+# Alfred Preferences > Advanced > Syncing:
+dropbox: ~/Dropbox/Alfred
View
4 version.json
@@ -1,5 +1,5 @@
{
- "version": 1.1,
+ "version": 1.2,
"download_uri": "https://github.com/zhaocai/alfred2-sourcetree-workflow/raw/master/Source%20Tree.alfredworkflow",
- "description": "initial working version"
+ "description": "update to alfred handler framework"
}
View
1  workflow/Gemfile
@@ -1,5 +1,4 @@
source "https://rubygems.org"
gem "plist"
-gem "logging"
gem "alfred-workflow"
View
20 workflow/Gemfile.lock
@@ -1,19 +1,25 @@
GEM
remote: https://rubygems.org/
specs:
- alfred-workflow (1.11.0)
+ alfred-workflow (2.0.2)
+ fuzzy_match (>= 2.0.4)
+ gyoku (>= 1.1.0)
+ moneta (>= 0.7.19)
+ nori (>= 2.3.0)
plist (>= 3.1.0)
- little-plugger (1.1.3)
- logging (1.8.1)
- little-plugger (>= 1.1.3)
- multi_json (>= 1.3.6)
- multi_json (1.8.0)
+ terminal-notifier (>= 1.5.0)
+ builder (3.2.2)
+ fuzzy_match (2.0.4)
+ gyoku (1.1.0)
+ builder (>= 2.1.2)
+ moneta (0.7.20)
+ nori (2.3.0)
plist (3.1.0)
+ terminal-notifier (1.5.1)
PLATFORMS
ruby
DEPENDENCIES
alfred-workflow
- logging
plist
View
BIN  workflow/README.pdf
Binary file not shown
View
109 workflow/info.plist
@@ -10,15 +10,7 @@
<array>
<dict>
<key>destinationuid</key>
- <string>8B74B3B5-ED11-4B5E-9567-2C95E6B59F0B</string>
- <key>modifiers</key>
- <integer>524288</integer>
- <key>modifiersubtext</key>
- <string>Browser in Alfred</string>
- </dict>
- <dict>
- <key>destinationuid</key>
- <string>C2B480F5-BA0C-4695-8D5E-9992839F65CE</string>
+ <string>37ED4ABC-535E-4C2B-B6CA-5A95FC152A6E</string>
<key>modifiers</key>
<integer>0</integer>
<key>modifiersubtext</key>
@@ -26,7 +18,7 @@
</dict>
<dict>
<key>destinationuid</key>
- <string>38E6B4AF-AAF7-4DDA-90B2-08FC924C2CE7</string>
+ <string>51C047C3-8B43-4B04-8ABE-851AE0D12CAD</string>
<key>modifiers</key>
<integer>1048576</integer>
<key>modifiersubtext</key>
@@ -79,24 +71,18 @@
<array>
<dict>
<key>config</key>
- <dict/>
- <key>type</key>
- <string>alfred.workflow.action.browseinalfred</string>
- <key>uid</key>
- <string>8B74B3B5-ED11-4B5E-9567-2C95E6B59F0B</string>
- <key>version</key>
- <integer>0</integer>
- </dict>
- <dict>
- <key>config</key>
<dict>
- <key>openwith</key>
- <string>/Applications/SourceTree.app</string>
+ <key>escaping</key>
+ <integer>38</integer>
+ <key>script</key>
+ <string>LANG=en_US.UTF-8 /usr/bin/ruby ./main.rb --workflow-mode=action "{query}"</string>
+ <key>type</key>
+ <integer>0</integer>
</dict>
<key>type</key>
- <string>alfred.workflow.action.openfile</string>
+ <string>alfred.workflow.action.script</string>
<key>uid</key>
- <string>C2B480F5-BA0C-4695-8D5E-9992839F65CE</string>
+ <string>37ED4ABC-535E-4C2B-B6CA-5A95FC152A6E</string>
<key>version</key>
<integer>0</integer>
</dict>
@@ -112,7 +98,8 @@
<key>runningsubtext</key>
<string>search for SourceTree Repositories ...</string>
<key>script</key>
- <string>/usr/bin/ruby ./main.rb {query}</string>
+ <string>LANG=en_US.UTF-8 /usr/bin/ruby ./main.rb {query}
+</string>
<key>subtext</key>
<string>Open Repository in SourceTree</string>
<key>title</key>
@@ -157,6 +144,23 @@
<dict>
<key>config</key>
<dict>
+ <key>escaping</key>
+ <integer>38</integer>
+ <key>script</key>
+ <string>LANG=en_US.UTF-8 /usr/bin/ruby ./main.rb --workflow-mode=action --modifier=command "{query}"</string>
+ <key>type</key>
+ <integer>0</integer>
+ </dict>
+ <key>type</key>
+ <string>alfred.workflow.action.script</string>
+ <key>uid</key>
+ <string>51C047C3-8B43-4B04-8ABE-851AE0D12CAD</string>
+ <key>version</key>
+ <integer>0</integer>
+ </dict>
+ <dict>
+ <key>config</key>
+ <dict>
<key>acceptsmulti</key>
<false/>
<key>filetypes</key>
@@ -174,25 +178,15 @@
<integer>0</integer>
</dict>
<dict>
- <key>type</key>
- <string>alfred.workflow.action.revealfile</string>
- <key>uid</key>
- <string>38E6B4AF-AAF7-4DDA-90B2-08FC924C2CE7</string>
- <key>version</key>
- <integer>0</integer>
- </dict>
- <dict>
<key>config</key>
<dict>
- <key>applescript</key>
- <string>on alfred_script(q)
- activate application "SourceTree"
- tell application "System Events"
+ <key>openwith</key>
+ <string>/Applications/SourceTree.app</string>
</dict>
<key>type</key>
- set value of text field 1 of group 1 of tool bar 1 of window "Bookmarks" to q as text
+ <string>alfred.workflow.action.openfile</string>
<key>uid</key>
-
+ <string>C2B480F5-BA0C-4695-8D5E-9992839F65CE</string>
<key>version</key>
<integer>0</integer>
</dict>
@@ -217,15 +211,35 @@
<key>version</key>
<integer>0</integer>
</dict>
+ <dict>
+ <key>config</key>
+ <dict>
+ <key>applescript</key>
+ <string>on alfred_script(q)
+ activate application "SourceTree"
+ tell application "System Events"
+ tell process "SourceTree"
+ keystroke "b" using command down
+ set value of text field 1 of group 1 of tool bar 1 of window "Bookmarks" to q as text
+ click button 1 of text field 1 of group 1 of tool bar 1 of window "Bookmarks"
+
+ set frontmost to true
+ end tell
+ end tell
end alfred_script</string>
<key>cachescript</key>
<true/>
</dict>
<key>type</key>
- <string>alfred.workflow.input.keyword</string>
+ <string>alfred.workflow.action.applescript</string>
+ <key>uid</key>
+ <string>DB55BBC7-595C-4E83-ABBE-60355155A4B3</string>
+ <key>version</key>
+ <integer>0</integer>
+ </dict>
</array>
<key>readme</key>
- <key>version</key>
+ <string></string>
<key>uidata</key>
<dict>
<key>37ED4ABC-535E-4C2B-B6CA-5A95FC152A6E</key>
@@ -235,27 +249,22 @@
</dict>
<key>51C047C3-8B43-4B04-8ABE-851AE0D12CAD</key>
<dict>
- <key>ypos</key>
+ <key>ypos</key>
<real>300</real>
</dict>
<key>63F60794-BB56-4415-9372-BAF974C3A7E1</key>
<dict>
- <key>ypos</key>
- <real>180</real>
- </dict>
- <key>6D8D55CB-5416-4EE8-90D5-3E92CA4C24A2</key>
- <dict>
- <key>ypos</key>
+ <key>ypos</key>
<real>180</real>
</dict>
<key>6D8D55CB-5416-4EE8-90D5-3E92CA4C24A2</key>
<dict>
- <key>ypos</key>
+ <key>ypos</key>
<real>410</real>
</dict>
<key>76ED402A-138E-4714-8B00-C470579950FE</key>
<dict>
- <key>ypos</key>
+ <key>ypos</key>
<real>640</real>
</dict>
<key>C2B480F5-BA0C-4695-8D5E-9992839F65CE</key>
View
21 workflow/main.rb
@@ -26,7 +26,7 @@ def initialize(alfred, opts = {})
super
@settings = {
:handler => 'SourceTree' ,
- :expire => 3600 ,
+ :expire => 7200 ,
}.update(opts)
feedback.use_cache_file :expire => @settings[:expire]
@@ -35,11 +35,16 @@ def initialize(alfred, opts = {})
def generate_feedback
sourcetree_bookmarks.uniq {|b| b[:name] + b[:path]}.each do |b|
+ arg = xml_builder(
+ :handler => @settings[:handler] ,
+ :path => b[:path]
+ )
+
feedback.add_item({
:uid => b[:path] ,
:title => b[:name] ,
:subtitle => b[:path] ,
- :arg => b[:path] ,
+ :arg => arg ,
:type => 'file' ,
:match? => :all_title_match? ,
})
@@ -53,14 +58,24 @@ def on_feedback
if !options.should_reload_cached_feedback and fb = feedback.get_cached_feedback
feedback.merge! fb
else
- generate_feedback(alfred, query)
+ generate_feedback
end
end
def on_action(arg)
+
+ return unless action?(arg)
+
+ case options.modifier
+ when :command
+ Alfred::Util.reveal_in_finder(arg[:path])
+ when :none
+ Alfred::Util.open_with('SourceTree', arg[:path])
+ end
end
+
def sourcetree_bookmarks
sourcetree_plist = File.expand_path(
View
10 workflow/setting.yaml
@@ -0,0 +1,10 @@
+---
+:id: me.zhaowu.sourcetree
+:help:
+ - :kind: url
+ :title: Check the Homepage for usage help
+ :subtitle: http://zhaocai.github.io/alfred2-sourcetree-workflow/
+ :url: http://zhaocai.github.io/alfred2-top-workflow/
+ - :kind: file
+ :path: README.pdf
+
View
2  workflow/update.json
@@ -1,4 +1,4 @@
{
- "version": 1.1,
+ "version": 1.2,
"remote_json": "https://github.com/zhaocai/alfred2-sourcetree-workflow/raw/master/version.json"
}
Please sign in to comment.
Something went wrong with that request. Please try again.