pullbox 0.1.0 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/exe/mailmate_beta +20 -0
- data/lib/pullbox/applescript.rb +24 -6
- data/lib/pullbox/devonthink.rb +1 -1
- data/lib/pullbox/version.rb +1 -1
- data/lib/pullbox.rb +1 -1
- data/pullbox.gemspec +40 -0
- metadata +26 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c2f534754efeeb67e20f795dc0c6593f5f7c378bc5493d0d05a53c04cc7b4207
|
4
|
+
data.tar.gz: 888cbe6a7966336d76da1d273c69f98580bef9eae2d7c6218acf79417b9b3984
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a04bd17a33c23f78d18a4c5132b89ea46ecc9548bd3ca1ed702febcc5ca35a01768b4c3174e6d599b8599936b8989209780a27789e496c942cce40b5a519b36c
|
7
|
+
data.tar.gz: d251bc033b8301038517c2fb7f93e6ff8a6631099e6efaabf811918909f800e9c3167442e3df8f6d1e80eb14bba0c424daa6688c71cf1de45d25fa4040eac05b
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/pullbox`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
4
|
|
5
|
-
TODO:
|
5
|
+
TODO: Describe gem in detail
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
@@ -16,7 +16,7 @@ If bundler is not being used to manage dependencies, install the gem by executin
|
|
16
16
|
|
17
17
|
## Usage
|
18
18
|
|
19
|
-
TODO: Write usage instructions
|
19
|
+
TODO: Write usage instructions
|
20
20
|
|
21
21
|
## Development
|
22
22
|
|
@@ -26,7 +26,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
26
26
|
|
27
27
|
## Contributing
|
28
28
|
|
29
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
29
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/the-pulli/pullbox.
|
30
30
|
|
31
31
|
## License
|
32
32
|
|
data/exe/mailmate_beta
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require "english"
|
5
|
+
require "plist"
|
6
|
+
require "pullbox/applescript"
|
7
|
+
|
8
|
+
result = Plist.parse_xml("/Applications/MailMate.app/Contents/Info.plist")
|
9
|
+
raise "MailMate not installed." if result.nil?
|
10
|
+
|
11
|
+
long_version = result["CFBundleGetInfoString"]
|
12
|
+
version = long_version.match(/\(r(?<number>\d+)\)/i)
|
13
|
+
following_release = version[:number].to_i.next
|
14
|
+
search_string = "MailMate_r#{following_release}.tbz"
|
15
|
+
|
16
|
+
content = `curl -s https://updates.mailmate-app.com/archives/ | grep #{search_string}`
|
17
|
+
|
18
|
+
if !content.empty? && $CHILD_STATUS.zero?
|
19
|
+
Pullbox::AppleScript.display_dialog "Update available.\nVersion: #{following_release}", "MailMate"
|
20
|
+
end
|
data/lib/pullbox/applescript.rb
CHANGED
@@ -13,20 +13,20 @@ 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] == true ? ' default answer ""' :
|
25
|
+
answer = defaults[:answer] == true ? ' default answer ""' : ""
|
26
26
|
buttons = 'buttons {"'
|
27
27
|
buttons << defaults[:buttons].join('", "')
|
28
28
|
buttons << "\"} default button \"#{defaults[:buttons].last}\""
|
29
|
-
|
29
|
+
applescript = <<~APS.strip
|
30
30
|
#{intro}
|
31
31
|
try
|
32
32
|
return text returned of (display dialog "#{message}"#{buttons}#{answer} with title "#{title}")
|
@@ -36,11 +36,29 @@ module Pullbox
|
|
36
36
|
end if
|
37
37
|
end try
|
38
38
|
APS
|
39
|
-
answer = `osascript -e '#{
|
39
|
+
answer = `osascript -e '#{applescript}'`.strip
|
40
40
|
|
41
|
-
exit! if answer ==
|
41
|
+
exit! if answer == ""
|
42
42
|
|
43
43
|
answer
|
44
44
|
end
|
45
|
+
|
46
|
+
def self.export_playlist(name, to, format = :xml)
|
47
|
+
allowed_formats = {
|
48
|
+
m3u: "M3U",
|
49
|
+
m3u8: "M3U8",
|
50
|
+
plain_text: "plain text",
|
51
|
+
unicode_text: "Unicode text",
|
52
|
+
xml: "XML"
|
53
|
+
}
|
54
|
+
raise ArgumentError, "Export format not supported" unless allowed_formats.keys.include? format
|
55
|
+
|
56
|
+
format = allowed_formats[format]
|
57
|
+
applescript = <<~APS.strip
|
58
|
+
#{intro}
|
59
|
+
tell application "Music" to export playlist "#{name}" as #{format} to "#{to}"
|
60
|
+
APS
|
61
|
+
system "osascript -e '#{applescript}'"
|
62
|
+
end
|
45
63
|
end
|
46
64
|
end
|
data/lib/pullbox/devonthink.rb
CHANGED
data/lib/pullbox/version.rb
CHANGED
data/lib/pullbox.rb
CHANGED
data/pullbox.gemspec
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "lib/pullbox/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "pullbox"
|
7
|
+
spec.version = Pullbox::VERSION
|
8
|
+
spec.authors = ["PuLLi"]
|
9
|
+
spec.email = ["the@pulli.dev"]
|
10
|
+
|
11
|
+
spec.summary = "Just a small toolbox for AppleScript, DEVONthink and MailMate"
|
12
|
+
spec.description = "Enables you to write ruby code for AppleScript, DEVONthink and MailMate features."
|
13
|
+
spec.homepage = "https://github.com/the-pulli/pullbox"
|
14
|
+
spec.license = "MIT"
|
15
|
+
spec.required_ruby_version = ">= 2.6.0"
|
16
|
+
|
17
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
18
|
+
|
19
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
20
|
+
spec.metadata["source_code_uri"] = "https://github.com/the-pulli/pullbox"
|
21
|
+
spec.metadata["changelog_uri"] = "https://github.com/the-pulli/pullbox/blob/main/CHANGELOG.md"
|
22
|
+
|
23
|
+
# Specify which files should be added to the gem when it is released.
|
24
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
25
|
+
spec.files = Dir.chdir(__dir__) do
|
26
|
+
`git ls-files -z`.split("\x0").reject do |f|
|
27
|
+
(f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
|
28
|
+
end
|
29
|
+
end
|
30
|
+
spec.bindir = "exe"
|
31
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
32
|
+
spec.require_paths = ["lib"]
|
33
|
+
|
34
|
+
# Uncomment to register a new dependency of your gem
|
35
|
+
spec.add_dependency "plist", "~> 3.6"
|
36
|
+
|
37
|
+
# For more information and examples about making a new gem, check out our
|
38
|
+
# guide at: https://bundler.io/guides/creating_gem.html
|
39
|
+
spec.metadata["rubygems_mfa_required"] = "true"
|
40
|
+
end
|
metadata
CHANGED
@@ -1,19 +1,35 @@
|
|
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.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- PuLLi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
12
|
-
dependencies:
|
13
|
-
|
11
|
+
date: 2023-01-15 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: plist
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.6'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '3.6'
|
27
|
+
description: Enables you to write ruby code for AppleScript, DEVONthink and MailMate
|
28
|
+
features.
|
14
29
|
email:
|
15
30
|
- the@pulli.dev
|
16
|
-
executables:
|
31
|
+
executables:
|
32
|
+
- mailmate_beta
|
17
33
|
extensions: []
|
18
34
|
extra_rdoc_files: []
|
19
35
|
files:
|
@@ -22,10 +38,12 @@ files:
|
|
22
38
|
- LICENSE.txt
|
23
39
|
- README.md
|
24
40
|
- Rakefile
|
41
|
+
- exe/mailmate_beta
|
25
42
|
- lib/pullbox.rb
|
26
43
|
- lib/pullbox/applescript.rb
|
27
44
|
- lib/pullbox/devonthink.rb
|
28
45
|
- lib/pullbox/version.rb
|
46
|
+
- pullbox.gemspec
|
29
47
|
- sig/pullbox.rbs
|
30
48
|
homepage: https://github.com/the-pulli/pullbox
|
31
49
|
licenses:
|
@@ -34,7 +52,7 @@ metadata:
|
|
34
52
|
allowed_push_host: https://rubygems.org
|
35
53
|
homepage_uri: https://github.com/the-pulli/pullbox
|
36
54
|
source_code_uri: https://github.com/the-pulli/pullbox
|
37
|
-
changelog_uri: https://github.com/the-pulli/pullbox/CHANGELOG.md
|
55
|
+
changelog_uri: https://github.com/the-pulli/pullbox/blob/main/CHANGELOG.md
|
38
56
|
rubygems_mfa_required: 'true'
|
39
57
|
post_install_message:
|
40
58
|
rdoc_options: []
|
@@ -51,8 +69,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
51
69
|
- !ruby/object:Gem::Version
|
52
70
|
version: '0'
|
53
71
|
requirements: []
|
54
|
-
rubygems_version: 3.
|
72
|
+
rubygems_version: 3.4.1
|
55
73
|
signing_key:
|
56
74
|
specification_version: 4
|
57
|
-
summary: Just a small toolbox for AppleScript and
|
75
|
+
summary: Just a small toolbox for AppleScript, DEVONthink and MailMate
|
58
76
|
test_files: []
|