pullbox 0.1.7 → 0.1.9

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
  SHA256:
3
- metadata.gz: 9e43bf2b4621765eea12dd095ae34fffed7cfaf6ab7f089e858c17b3d948dde8
4
- data.tar.gz: df800cf9169ef227b1a14064e2b8612a6ba927c010428e393642bd59234312f9
3
+ metadata.gz: 87d2b40cfd8b7a1181675f57462fa4f890be85459ba6d9263877078d287545b1
4
+ data.tar.gz: 0eadb9f720a6705c246cfd934e713f83438f19ac6ccb7e3adc4f972cf160d191
5
5
  SHA512:
6
- metadata.gz: cde990acd7310c2a2e9e7bdc155a9cb2765a9e2658017b1b59069e7f6f435edc35165aaca889d54b872f5ae41c1bf1d22446f431999115e135a3c26f9edf7b96
7
- data.tar.gz: 2f33b53734dcad9f141b385935da5424fe37883f0b220bb32db2d8eda92e8caa801cc760a7bc73cba13faa44e57af3ba890bb53979505bc57ea46bc58e0f123c
6
+ metadata.gz: 5f692094c2dce32ac9cb7f49628d8ee8add36649b55e5a31ff960a1b66973c3b6bb3565e93b4bcc8bf554a9bd8ff1b702cf8eb65353c5edd9a014b303a432c1d
7
+ data.tar.gz: 7af4e33fd4eb976a6923660a4ed4b166653f7f6e73a4c91bae80f0cdbb3e47f214d7b30d508e68a0fb83021a2615d258cfb44741631b82abc1c7be59371756d8
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.1.9] - 2023-03-19
4
+
5
+ - Add option to start app in `move_app`.
6
+
7
+ ## [0.1.8] - 2023-03-19
8
+
9
+ - `mailmate_beta` improved. Now downloads and installs beta releasess automatically.
10
+
3
11
  ## [0.1.7] - 2023-02-08
4
12
 
5
13
  - Remove debug output
data/README.md CHANGED
@@ -14,6 +14,9 @@ If bundler is not being used to manage dependencies, install the gem by executin
14
14
 
15
15
  ## Usage
16
16
 
17
+ Includes a executable `mailmate_beta` which checks and installs MailMate prerelease automatically for you.
18
+ For the AppleScript and DEVONthink functions available check the corresponding source code.
19
+
17
20
  ## Contributing
18
21
 
19
22
  Bug reports and pull requests are welcome on GitHub at https://github.com/the-pulli/pullbox.
data/exe/mailmate_beta CHANGED
@@ -6,7 +6,7 @@ require "nokogiri"
6
6
  require "plist"
7
7
  require_relative "../lib/pullbox/applescript"
8
8
 
9
- mailmate = "/Applications/MailMate.app/Contents/Info.plist"
9
+ mailmate = "#{Pullbox::AppleScript.applications_folder}MailMate.app/Contents/Info.plist"
10
10
  raise "MailMate not installed." unless File.exist? mailmate
11
11
 
12
12
  result = Plist.parse_xml(mailmate)
@@ -18,10 +18,16 @@ long_version = result["CFBundleGetInfoString"]
18
18
  version = long_version.match(regexp1)
19
19
 
20
20
  doc = Nokogiri::HTML(Net::HTTP.get(URI("https://updates.mailmate-app.com/archives/")))
21
- doc.xpath("(//table//tr//td/a)[last()]").each do |current_release|
22
- current_version = current_release.content.match(regexp2)
21
+ doc.xpath("/html/body/table/tr[position() = (last() - 1)]/td[2]/a/@href").each do |current_release|
22
+ beta_version = current_release.value.match(regexp2)
23
23
 
24
- if current_version[:number].to_i > version[:number].to_i
25
- Pullbox::AppleScript.display_dialog "Update available.\nVersion: #{current_version}", "MailMate"
24
+ if beta_version[:number].to_i > version[:number].to_i
25
+ response = Net::HTTP.get(URI("https://updates.mailmate-app.com/archives/#{current_release.value}"))
26
+ File.write(current_release.value, response)
27
+ system "tar -xjf #{current_release.value}"
28
+ system "rm #{current_release.value}"
29
+ path = Dir.pwd + "/MailMate.app"
30
+ Pullbox::AppleScript.move_app("MailMate", path)
31
+ Pullbox::AppleScript.display_notification("MailMate updated to version: #{beta_version[:number]}", "MailMate Updater")
26
32
  end
27
33
  end
@@ -27,7 +27,7 @@ module Pullbox
27
27
  cancel_button = defaults[:buttons].first
28
28
  buttons = 'buttons {"'
29
29
  button_construct = buttons.dup
30
- button_construct << defaults[:buttons].join('", "')
30
+ button_construct << defaults[:buttons].join('", "')
31
31
  button_construct << "\"} default button \"#{default_button}\" cancel button \"#{cancel_button}\""
32
32
  applescript = <<~APS.strip
33
33
  #{intro}
@@ -68,5 +68,35 @@ module Pullbox
68
68
  APS
69
69
  system "osascript -e '#{applescript}'"
70
70
  end
71
+
72
+ def self.applications_folder
73
+ applescript = <<-APS.strip
74
+ #{intro}
75
+
76
+ set theApplicationsFolder to path to applications folder
77
+ return (POSIX path) of theApplicationsFolder
78
+ APS
79
+ `osascript -e '#{applescript}'`.strip
80
+ end
81
+
82
+ def self.move_app(name, app_path, launch = true)
83
+ applescript = <<-APS.strip
84
+ #{intro}
85
+
86
+ set theApplicationsFolder to path to applications folder
87
+ try
88
+ tell application "#{name}" to quit
89
+ on error errMsg
90
+ end try
91
+ delay 3
92
+ tell application "Finder"
93
+ move (POSIX file "#{app_path}") as alias to theApplicationsFolder with replacing
94
+ end tell
95
+ if #{launch} then
96
+ tell application "#{name}" to activate
97
+ end if
98
+ APS
99
+ system "osascript -e '#{applescript}'"
100
+ end
71
101
  end
72
102
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Pullbox
4
- VERSION = "0.1.7"
4
+ VERSION = "0.1.9"
5
5
  end
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.7
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - PuLLi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-02-08 00:00:00.000000000 Z
11
+ date: 2023-03-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -83,7 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
83
83
  - !ruby/object:Gem::Version
84
84
  version: '0'
85
85
  requirements: []
86
- rubygems_version: 3.4.1
86
+ rubygems_version: 3.4.7
87
87
  signing_key:
88
88
  specification_version: 4
89
89
  summary: Just a small toolbox for AppleScript, DEVONthink and MailMate