alphred 2.0.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6e16e15e9c29efb59e1db59f3c521e7434a72792
4
- data.tar.gz: e9e42358283d6f3b43f89c7a5e93e658de747bdf
3
+ metadata.gz: 7d77538c0ab6babe0166db3c1d3760560a581b72
4
+ data.tar.gz: ff87faf19a7aab67ef5efb519ce09d8090cfff43
5
5
  SHA512:
6
- metadata.gz: 5fc789dedf8233a24917d2084f4c8340525b97df36932036acccd1a9223299dd0fad05ec258c85cd5ecaa394c75c6ed5746b6df2ce9728d15eef64f0c0df64a0
7
- data.tar.gz: b9bac5f7129ebf6f67488c318c5b8a200ed0cb2a819ffd87afa71786440482fac4b0a157f7a3040becfdf69365f0e1ff8e5b578a7af2232fbdde1d56de261300
6
+ metadata.gz: 3619e36d3aa9bf3b3187121e6566c1945c60ec2628207693b932afa895242d0c1bdf59caa5ccf555a43cecaa67167466c7dbf4c97e6ecfebf5982fad0ad02757
7
+ data.tar.gz: a942a94bf4e8bcbbbbc7b6a752d9400c5215ccb68838b2f0171f05f3ac60e60d2998f8431bfc3502b1b414edfbb601c0c9b028526ea33a24091c7bc066c6ae79
@@ -1,3 +1,19 @@
1
+ ## [2.0.1] - 2016-07-28
2
+ ### Fixed
3
+ - Rake task now cleans `Don't Export`-ed environment vars.
4
+
5
+ ## [2.0.0] - 2016-05-15
6
+ ### Added
7
+ - `Alphred::Items[...]` convenience method.
8
+
9
+ ### Changed
10
+ - `to_xml` has been deprecated in favor of `to_json`.
11
+ - `mods` in an `Alphred::Item` are declared differently now.
12
+
13
+ ### Removed
14
+ - `Alphred::Config` has been deprecated since Alfred 3 supports environment
15
+ variables.
16
+
1
17
  ## [1.2.2] - 2016-04-17
2
18
  ### Fixed
3
19
  - Require FileUtils for Config.
data/README.md CHANGED
@@ -14,76 +14,122 @@ The [example script filter][scriptfilter] would look like this using Alphred:
14
14
  [scriptfilter]: https://www.alfredapp.com/help/workflows/inputs/script-filter/
15
15
 
16
16
  ``` ruby
17
- items = Alphred::Items.new(
18
- Alphred::Item.new(uid: "desktop",
19
- arg: "~/Desktop",
20
- valid: true,
21
- autocomplete: "Desktop",
22
- type: :file,
23
- title: "Desktop",
24
- subtitle: "~/Desktop",
25
- icon: { value: "~/Desktop", type: :fileicon }),
26
- Alphred::Item.new(uid: "flickr",
27
- valid: false,
28
- autocomplete: "flickr",
29
- title: "Flickr",
30
- icon: "flickr.png"),
31
- Alphred::Item.new(uid: "image",
32
- autocomplete: "My holiday photo",
33
- type: :file,
34
- title: "My holiday photo",
35
- subtitle: "~/Pictures/My holiday photo.jpg",
36
- icon: { value: "public.jpeg", type: :filetype }),
37
- Alphred::Item.new(uid: "home",
38
- arg: "~/",
39
- valid: true,
40
- autocomplete: "Home",
41
- type: :file,
42
- title: "Home Folder",
43
- subtitle: "Home folder ~/",
44
- icon: { value: "~/", type: :fileicon },
45
- mods: { shift: "Subtext when shift is pressed",
46
- fn: "Subtext when fn is pressed",
47
- ctrl: "Subtext when ctrl is pressed",
48
- alt: "Subtext when alt is pressed",
49
- cmd: "Subtext when cmd is pressed" },
50
- text: { copy: "Text when copying",
51
- largetype: "Text for LargeType" }))
52
- items.to_xml
17
+ items = Items[
18
+ Item.new(
19
+ uid: 'desktop',
20
+ type: 'file',
21
+ title: 'Desktop',
22
+ subtitle: '~/Desktop',
23
+ arg: '~/Desktop',
24
+ autocomplete: 'Desktop',
25
+ icon: { type: :fileicon, path: '~/Desktop' },
26
+ ),
27
+ Item.new(
28
+ valid: false,
29
+ uid: 'flickr',
30
+ title: 'Flickr',
31
+ icon: 'flickr.png'
32
+ ),
33
+ Item.new(
34
+ uid: 'image',
35
+ type: 'file',
36
+ title: 'My holiday photo',
37
+ subtitle: '~/Pictures/My holiday photo.jpg',
38
+ autocomplete: 'My holiday photo',
39
+ icon: { type: :filetype, path: 'public.jpeg' },
40
+ ),
41
+ Item.new(
42
+ valid: false,
43
+ uid: 'alfredapp',
44
+ title: 'Alfred Website',
45
+ subtitle: 'https://www.alfredapp.com/',
46
+ arg: 'alfredapp.com',
47
+ autocomplete: 'Alfred Website',
48
+ quicklookurl: 'https://www.alfredapp.com/',
49
+ mods: {
50
+ alt: {
51
+ valid: true,
52
+ arg: 'alfredapp.com/powerpack',
53
+ subtitle: 'https://www.alfredapp.com/powerpack/',
54
+ },
55
+ cmd: {
56
+ valid: true,
57
+ arg: 'alfredapp.com/powerpack/buy/',
58
+ subtitle: 'https://www.alfredapp.com/powerpack/buy/',
59
+ },
60
+ },
61
+ text: {
62
+ copy: 'https://www.alfredapp.com/ (text here to copy)',
63
+ largetype: 'https://www.alfredapp.com/ (text here for large type)',
64
+ },
65
+ ),
66
+ ]
67
+ items.to_json
53
68
  ```
54
69
 
55
- This produces the following XML:
56
-
57
- ``` xml
58
- <?xml version="1.0" encoding="UTF-8"?>
59
- <items>
60
- <item uid="desktop" arg="~/Desktop" autocomplete="Desktop" type="file" valid="yes">
61
- <title>Desktop</title>
62
- <subtitle>~/Desktop</subtitle>
63
- <icon type="fileicon">~/Desktop</icon>
64
- </item>
65
- <item uid="flickr" autocomplete="flickr" valid="no">
66
- <title>Flickr</title>
67
- <icon>flickr.png</icon>
68
- </item>
69
- <item uid="image" autocomplete="My holiday photo" type="file">
70
- <title>My holiday photo</title>
71
- <subtitle>~/Pictures/My holiday photo.jpg</subtitle>
72
- <icon type="filetype">public.jpeg</icon>
73
- </item>
74
- <item uid="home" arg="~/" autocomplete="Home" type="file" valid="yes">
75
- <title>Home Folder</title>
76
- <subtitle>Home folder ~/</subtitle>
77
- <icon type="fileicon">~/</icon>
78
- <subtitle mod="shift">Subtext when shift is pressed</subtitle>
79
- <subtitle mod="fn">Subtext when fn is pressed</subtitle>
80
- <subtitle mod="ctrl">Subtext when ctrl is pressed</subtitle>
81
- <subtitle mod="alt">Subtext when alt is pressed</subtitle>
82
- <subtitle mod="cmd">Subtext when cmd is pressed</subtitle>
83
- <text type="copy">Text when copying</text>
84
- <text type="largetype">Text for LargeType</text>
85
- </item>
86
- </items>
70
+ This produces the following JSON:
71
+
72
+ ``` json
73
+ {
74
+ "items": [
75
+ {
76
+ "uid": "desktop",
77
+ "type": "file",
78
+ "title": "Desktop",
79
+ "subtitle": "~/Desktop",
80
+ "arg": "~/Desktop",
81
+ "autocomplete": "Desktop",
82
+ "icon": {
83
+ "type": "fileicon",
84
+ "path": "~/Desktop"
85
+ }
86
+ },
87
+ {
88
+ "valid": false,
89
+ "uid": "flickr",
90
+ "title": "Flickr",
91
+ "icon": {
92
+ "path": "flickr.png"
93
+ }
94
+ },
95
+ {
96
+ "uid": "image",
97
+ "type": "file",
98
+ "title": "My holiday photo",
99
+ "subtitle": "~/Pictures/My holiday photo.jpg",
100
+ "autocomplete": "My holiday photo",
101
+ "icon": {
102
+ "type": "filetype",
103
+ "path": "public.jpeg"
104
+ }
105
+ },
106
+ {
107
+ "valid": false,
108
+ "uid": "alfredapp",
109
+ "title": "Alfred Website",
110
+ "subtitle": "https://www.alfredapp.com/",
111
+ "arg": "alfredapp.com",
112
+ "autocomplete": "Alfred Website",
113
+ "quicklookurl": "https://www.alfredapp.com/",
114
+ "mods": {
115
+ "alt": {
116
+ "valid": true,
117
+ "arg": "alfredapp.com/powerpack",
118
+ "subtitle": "https://www.alfredapp.com/powerpack/"
119
+ },
120
+ "cmd": {
121
+ "valid": true,
122
+ "arg": "alfredapp.com/powerpack/buy/",
123
+ "subtitle": "https://www.alfredapp.com/powerpack/buy/"
124
+ }
125
+ },
126
+ "text": {
127
+ "copy": "https://www.alfredapp.com/ (text here to copy)",
128
+ "largetype": "https://www.alfredapp.com/ (text here for large type)"
129
+ }
130
+ }
131
+ ]
132
+ }
87
133
  ```
88
134
 
89
135
  ### Releasing
@@ -1,3 +1,5 @@
1
+ require 'tmpdir'
2
+
1
3
  require 'rake'
2
4
 
3
5
  namespace :alphred do
@@ -20,22 +22,59 @@ Can't tag #{version}: dirty working directory.
20
22
  desc 'Create an alfredworkflow package with vendored dependencies'
21
23
  task :package do
22
24
  restore_bundler_config do
23
- cmd = 'bundle install --standalone --path vendor/bundle --without development test'
24
- sh "chruby-exec 2.0.0 -- #{cmd}"
25
- end
26
- sh "zip -r #{application_dir.pathmap('%n.alfredworkflow')} *"
27
- rm_rf 'vendor'
28
- end
25
+ vendor_deps
29
26
 
30
- def application_dir
31
- Rake.application.original_dir
27
+ Dir.mktmpdir do |tmp_dir|
28
+ cp_r FileList[File.join(workflow_dir, ?*)], tmp_dir, verbose: false
29
+
30
+ clean_vars(tmp_dir)
31
+ zip_workflow(tmp_dir)
32
+ end
33
+
34
+ rm_r 'vendor'
35
+ end
32
36
  end
33
37
 
34
38
  def restore_bundler_config
35
- path = File.join(application_dir, '.bundle', 'config')
39
+ path = File.join(workflow_dir, '.bundle', 'config')
36
40
  config = File.read(path)
37
41
  yield
38
42
  ensure
39
43
  File.write(path, config, mode: ?w)
40
44
  end
45
+
46
+ def vendor_deps
47
+ args = %w[ --standalone
48
+ --path vendor/bundle
49
+ --without development test ]
50
+ cmd = "bundle install #{args.join(' ')}"
51
+ sh "chruby-exec 2.0.0 -- #{cmd}"
52
+ end
53
+
54
+ def clean_vars(dir)
55
+ info_plist = File.join(dir, 'info.plist')
56
+
57
+ vars = `/usr/libexec/PlistBuddy -c "Print :variablesdontexport" #{info_plist}`
58
+ vars = vars.split("\n")[1..-2].map(&:strip)
59
+
60
+ vars.each do |var|
61
+ sh "/usr/libexec/PlistBuddy -c \"Set :variables:#{var} ''\" #{info_plist}"
62
+ end
63
+ end
64
+
65
+ def zip_workflow(dir)
66
+ cd dir do
67
+ output = File.join(workflow_dir,
68
+ workflow_name.pathmap('%n.alfredworkflow'))
69
+ sh "zip -rq #{output} *"
70
+ end
71
+ end
72
+
73
+ def workflow_name
74
+ workflow_dir.pathmap('%f')
75
+ end
76
+
77
+ def workflow_dir
78
+ Rake.application.original_dir
79
+ end
41
80
  end
@@ -1,3 +1,3 @@
1
1
  module Alphred
2
- VERSION = '2.0.0'
2
+ VERSION = '2.0.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alphred
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alpha Chen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-15 00:00:00.000000000 Z
11
+ date: 2016-07-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: builder