pullbox 0.1.1 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/exe/mailmate_beta +8 -5
- data/lib/pullbox/applescript.rb +36 -10
- data/lib/pullbox/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e721acd3845f22b0cbba4fcea949777d7deeabf0d9373018ae18521196aaf66e
|
4
|
+
data.tar.gz: 1c069eb6bb2ebd32bf3b51b832ec77293a40403c2b45f688970b8ed59097e8ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f49441a2c0c98c657880982d28798e82bb5843e6eb7067cd86106006b16ccedd5515493b00b6672188644063c3d2a1465d8a2a121e535269d4af29993a5f09f
|
7
|
+
data.tar.gz: d23e5b59248593bfc0c8653f49725264cfe72073f53535cfe5be80c2e98e769a16f2ce0e4ba18e83d545dad4104f37a3029b47b983575e793679752a9930afc2
|
data/exe/mailmate_beta
CHANGED
@@ -1,12 +1,15 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
require "
|
4
|
+
require "English"
|
5
5
|
require "plist"
|
6
|
-
|
6
|
+
require_relative "../lib/pullbox/applescript"
|
7
7
|
|
8
|
-
|
9
|
-
raise "MailMate not installed."
|
8
|
+
mailmate = "/Applications/MailMate.app/Contents/Info.plist"
|
9
|
+
raise "MailMate not installed." unless File.exist? mailmate
|
10
|
+
|
11
|
+
result = Plist.parse_xml(mailmate)
|
12
|
+
raise "MailMate not properly installed." if result.nil?
|
10
13
|
|
11
14
|
long_version = result["CFBundleGetInfoString"]
|
12
15
|
version = long_version.match(/\(r(?<number>\d+)\)/i)
|
@@ -15,6 +18,6 @@ search_string = "MailMate_r#{following_release}.tbz"
|
|
15
18
|
|
16
19
|
content = `curl -s https://updates.mailmate-app.com/archives/ | grep #{search_string}`
|
17
20
|
|
18
|
-
if !content.empty? && $CHILD_STATUS.
|
21
|
+
if !content.empty? && $CHILD_STATUS.exited?
|
19
22
|
Pullbox::AppleScript.display_dialog "Update available.\nVersion: #{following_release}", "MailMate"
|
20
23
|
end
|
data/lib/pullbox/applescript.rb
CHANGED
@@ -13,34 +13,60 @@ module Pullbox
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def self.display_notification(message, title)
|
16
|
-
|
16
|
+
applescript = <<~APS.strip
|
17
17
|
#{intro}
|
18
18
|
display notification "#{message}" with title "#{title}"
|
19
19
|
APS
|
20
|
-
system "osascript -e '#{
|
20
|
+
system "osascript -e '#{applescript}'"
|
21
21
|
end
|
22
22
|
|
23
23
|
def self.display_dialog(message, title, defaults = {})
|
24
24
|
defaults = { answer: false, buttons: %w[OK] }.merge(defaults)
|
25
|
-
answer = defaults[:answer]
|
25
|
+
answer = defaults[:answer] ? ' default answer ""' : ""
|
26
|
+
default_button = defaults[:buttons].last
|
27
|
+
cancel_button = defaults[:buttons].first
|
26
28
|
buttons = 'buttons {"'
|
27
|
-
|
28
|
-
|
29
|
-
|
29
|
+
button_construct = buttons.dup
|
30
|
+
button_construct << defaults[:buttons].join('", "')
|
31
|
+
button_construct << "\"} default button \"#{default_button}\" cancel button \"#{cancel_button}\""
|
32
|
+
applescript = <<~APS.strip
|
30
33
|
#{intro}
|
31
34
|
try
|
32
|
-
|
35
|
+
set theReturnedValue to (display dialog "#{message}" #{button_construct}#{answer} with title "#{title}")
|
36
|
+
if button returned of theReturnedValue is "#{default_button}" then
|
37
|
+
if text returned of theReturnedValue is not "" then
|
38
|
+
return text returned of theReturnedValue
|
39
|
+
else
|
40
|
+
return
|
41
|
+
end if
|
42
|
+
end if
|
33
43
|
on error errorMessage number errorNumber
|
34
44
|
if errorNumber is equal to -128 -- aborted by user
|
35
|
-
return
|
45
|
+
return
|
36
46
|
end if
|
37
47
|
end try
|
38
48
|
APS
|
39
|
-
answer = `osascript -e '#{
|
49
|
+
answer = `osascript -e '#{applescript}'`.strip
|
40
50
|
|
41
|
-
exit
|
51
|
+
exit(0) if answer.empty?
|
42
52
|
|
43
53
|
answer
|
44
54
|
end
|
55
|
+
|
56
|
+
def self.export_playlist(name, to, format = :xml)
|
57
|
+
formats = {
|
58
|
+
m3u: "M3U",
|
59
|
+
m3u8: "M3U8",
|
60
|
+
plain_text: "plain text",
|
61
|
+
unicode_text: "Unicode text",
|
62
|
+
xml: "XML"
|
63
|
+
}
|
64
|
+
|
65
|
+
applescript = <<~APS.strip
|
66
|
+
#{intro}
|
67
|
+
tell application "Music" to export playlist "#{name}" as #{formats.fetch(format, 'XML')} to "#{to}"
|
68
|
+
APS
|
69
|
+
system "osascript -e '#{applescript}'"
|
70
|
+
end
|
45
71
|
end
|
46
72
|
end
|
data/lib/pullbox/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pullbox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- PuLLi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-01-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: plist
|
@@ -69,7 +69,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
69
69
|
- !ruby/object:Gem::Version
|
70
70
|
version: '0'
|
71
71
|
requirements: []
|
72
|
-
rubygems_version: 3.
|
72
|
+
rubygems_version: 3.4.1
|
73
73
|
signing_key:
|
74
74
|
specification_version: 4
|
75
75
|
summary: Just a small toolbox for AppleScript, DEVONthink and MailMate
|