pullbox 0.1.6 → 0.1.8

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: 358733a3bf57bb1cd42f72b8c4fa34821ae0b2c25e694bfbb037dff2af6f668b
4
- data.tar.gz: 47285aab38740f81d09681e75821562052f66ccd33088598f9b56dae8d06e7f6
3
+ metadata.gz: 43456b6e946feae054b5b8656385d84b955d07439d1437e5c75a2afd82c5e93f
4
+ data.tar.gz: 6dd4b7ee156586b3663ca6a955c82ab7b85f692b2cb71aa52f58f6acdb9af215
5
5
  SHA512:
6
- metadata.gz: 0dcad83519180818cc4814d03594bce3617ca17fd4b4960fbde97fa8cbc2fd0c6cbfa12fb5a8287086db78f6115a31b96015118d96614205659906dbeb8bb057
7
- data.tar.gz: 439fe304ce3e36286ee8b3149eb4b459c6a77fd7c541838cc3f4ef02c90c0e1eb895c251244d6f47de33d7601a89d199bf5cbb6c9e61a3c322e686b346f4129c
6
+ metadata.gz: '0905793cceaa9222fc9dc273aab4a4c620b563969c9933f9fbde85fc437c3183beee837b116a98e779077b56c796e729667d2271ebe66676bbc1e6ca53338b4a'
7
+ data.tar.gz: ae6d24c1bb6c4383c8ea077c611b6f860e25ba74740a1215ffca9c0dd67f92e58183801cdccc62f458dbfc3990221c237c1e5e891e6f6b337818f64df9322c3c
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.1.8] - 2023-03-19
4
+
5
+ - `mailmate_beta` improved. Now downloads and installs beta releasess automatically.
6
+
7
+ ## [0.1.7] - 2023-02-08
8
+
9
+ - Remove debug output
10
+
3
11
  ## [0.1.6] - 2023-02-08
4
12
 
5
13
  - Fix issue with regex in `mailmate_beta`
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,11 +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
- p version[:number]
25
- if current_version[:number].to_i > version[:number].to_i
26
- 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")
27
32
  end
28
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,32 @@ 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)
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
+ set theResult to move (POSIX file "#{app_path}") as alias to theApplicationsFolder with replacing
94
+ end tell
95
+ APS
96
+ system "osascript -e '#{applescript}'"
97
+ end
71
98
  end
72
99
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Pullbox
4
- VERSION = "0.1.6"
4
+ VERSION = "0.1.8"
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.6
4
+ version: 0.1.8
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