pullbox 0.1.2 → 0.1.4
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 +18 -10
- data/lib/pullbox/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '0979fd8e25fcb2904420f92151c5c4aed13bb7cad45b82e97e8acac805f5cbd2'
|
4
|
+
data.tar.gz: 4a6b446fea44edc5d9fbd8a3b963abf2250fb11709bf5e65225c1c642220c5d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0755bc804d2a28841290dc8ff5d3bfce5f0489cac54768e675151ea103f733330481a9cf4dabad3868ff4fbef1bdff059d497148dc5d90bafd0710a5d653060c
|
7
|
+
data.tar.gz: 7b998cbe1daa77885e60adfe442800b6ea536005daf0d4bff41a36c7af13fb9cf4f1cd9f04799720f39542f8408da5bacdc4125fb5cadcdbf501f87892f07687
|
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
@@ -22,41 +22,49 @@ module Pullbox
|
|
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
|
+
button_construct = buttons.dup
|
30
|
+
button_construct << defaults[:buttons].join('", "')
|
31
|
+
button_construct << "\"} default button \"#{default_button}\" cancel button \"#{cancel_button}\""
|
29
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
49
|
answer = `osascript -e '#{applescript}'`.strip
|
40
50
|
|
41
|
-
exit
|
51
|
+
exit(0) if answer.empty?
|
42
52
|
|
43
53
|
answer
|
44
54
|
end
|
45
55
|
|
46
56
|
def self.export_playlist(name, to, format = :xml)
|
47
|
-
|
57
|
+
formats = {
|
48
58
|
m3u: "M3U",
|
49
59
|
m3u8: "M3U8",
|
50
60
|
plain_text: "plain text",
|
51
61
|
unicode_text: "Unicode text",
|
52
62
|
xml: "XML"
|
53
63
|
}
|
54
|
-
raise ArgumentError, "Export format not supported" unless allowed_formats.keys.include? format
|
55
64
|
|
56
|
-
format = allowed_formats[format]
|
57
65
|
applescript = <<~APS.strip
|
58
66
|
#{intro}
|
59
|
-
tell application "Music" to export playlist "#{name}" as #{format} to "#{to}"
|
67
|
+
tell application "Music" to export playlist "#{name}" as #{formats.fetch(format, 'XML')} to "#{to}"
|
60
68
|
APS
|
61
69
|
system "osascript -e '#{applescript}'"
|
62
70
|
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.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- PuLLi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-01-
|
11
|
+
date: 2023-01-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: plist
|