hookapp 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +11 -0
- data/lib/hook/hooker.rb +10 -15
- data/lib/hook/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2823ba5fc9c9745eae3ab91e6bf0b27a88b8a030931e3c07c305d2c4aca52a70
|
4
|
+
data.tar.gz: fe130f18aac896e3058361fe26ee182cc4047c4db10e61df19c24bd24d715f87
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e35a77b9bc373266a5a26e653b9ad20ae2446d4ff9571fa56c054ba4bb782d4737f25d00294db5449534cc5482d94c8268b815c26799158709adc5314de10b18
|
7
|
+
data.tar.gz: f7659543f1fcda1e9f1183f071a469a1fe4e3b1bb22d68945630c652fb33194ae12e9d940504b8aff15e70e16136e6fdad56f1225c1172558e1916eb65c480b8
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -64,3 +64,14 @@ The `--output_format=paths` option (abbr. `-o p`) combined with the `--files_onl
|
|
64
64
|
You can open a hooked file or URL by running `hook select file1.md`. This will display a menu of all the hooks on `file1.md`, and entering the number of a selection will open that file in its default application.
|
65
65
|
|
66
66
|
You can also open a file in the Hook GUI using `hook open file1.md`.
|
67
|
+
|
68
|
+
### Changelog
|
69
|
+
|
70
|
+
#### 0.0.4
|
71
|
+
|
72
|
+
- Fix "conversion of nil into string" error
|
73
|
+
|
74
|
+
#### 0.0.3
|
75
|
+
|
76
|
+
- Fix to handle all url types, not just hook: and http:
|
77
|
+
|
data/lib/hook/hooker.rb
CHANGED
@@ -18,15 +18,11 @@ class String
|
|
18
18
|
def valid_hook
|
19
19
|
if File.exist?(self)
|
20
20
|
File.expand_path(self)
|
21
|
-
elsif self =~
|
22
|
-
|
21
|
+
elsif self =~ /^\[.*?\]\((.*?)\)$/
|
22
|
+
mdlink = $1
|
23
|
+
mdlink.valid_hook
|
23
24
|
else
|
24
|
-
|
25
|
-
mdlink = $1
|
26
|
-
mdlink.valid_hook
|
27
|
-
else
|
28
|
-
nil
|
29
|
-
end
|
25
|
+
self
|
30
26
|
end
|
31
27
|
end
|
32
28
|
|
@@ -42,15 +38,16 @@ class Hooker
|
|
42
38
|
end
|
43
39
|
|
44
40
|
def validate_format(fmt, options)
|
45
|
-
valid_format_rx = options.map { |
|
41
|
+
valid_format_rx = options.map { |format| format.sub(/^(.)(.*)$/, '^\1(\2)?$') }
|
46
42
|
valid_format = false
|
47
43
|
valid_format_rx.each_with_index do |rx, i|
|
48
44
|
cmp = Regexp.new(rx, 'i')
|
49
45
|
next unless fmt =~ cmp
|
46
|
+
|
50
47
|
valid_format = options[i]
|
51
48
|
break
|
52
49
|
end
|
53
|
-
|
50
|
+
valid_format
|
54
51
|
end
|
55
52
|
|
56
53
|
def bookmark_for(url)
|
@@ -218,9 +215,9 @@ class Hooker
|
|
218
215
|
return true
|
219
216
|
end tell
|
220
217
|
APPLESCRIPT`
|
221
|
-
|
218
|
+
"Hook removed between #{source} and #{target}"
|
222
219
|
else
|
223
|
-
raise
|
220
|
+
raise 'Invalid number of URLs or files specified'
|
224
221
|
|
225
222
|
end
|
226
223
|
end
|
@@ -228,9 +225,7 @@ class Hooker
|
|
228
225
|
def link_all(args)
|
229
226
|
args.each do |file|
|
230
227
|
source = file.valid_hook
|
231
|
-
link_to = args.dup.map(&:valid_url).reject { |url|
|
232
|
-
url == source
|
233
|
-
}
|
228
|
+
link_to = args.dup.map(&:valid_url).reject { |url| url == source }
|
234
229
|
link_to.each do |url|
|
235
230
|
`osascript <<'APPLESCRIPT'
|
236
231
|
tell application "Hook"
|
data/lib/hook/version.rb
CHANGED