pullbox 0.1.9 → 0.1.11

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: 87d2b40cfd8b7a1181675f57462fa4f890be85459ba6d9263877078d287545b1
4
- data.tar.gz: 0eadb9f720a6705c246cfd934e713f83438f19ac6ccb7e3adc4f972cf160d191
3
+ metadata.gz: 3994c7b8b3c96b07b780a6a6abb024f1883b73711d4b0ce61e530c055a4a7b3c
4
+ data.tar.gz: adc3780652febf823d3df7f990b327acd8a94a6174a5a65f82ac34e064d24c80
5
5
  SHA512:
6
- metadata.gz: 5f692094c2dce32ac9cb7f49628d8ee8add36649b55e5a31ff960a1b66973c3b6bb3565e93b4bcc8bf554a9bd8ff1b702cf8eb65353c5edd9a014b303a432c1d
7
- data.tar.gz: 7af4e33fd4eb976a6923660a4ed4b166653f7f6e73a4c91bae80f0cdbb3e47f214d7b30d508e68a0fb83021a2615d258cfb44741631b82abc1c7be59371756d8
6
+ metadata.gz: 42f064ff9174cd2225137459a6f1c85512d2c5186005c0c02cdb21179509c8513e2bb953238f00374ee9e774668c25e91de206319be70802ed34ce4e5c77f053
7
+ data.tar.gz: fcd1a1da129516d03e45f49b9af99fdf30016c8d49030b2615a3eb66b1dd15970e46c925eef1440646a6983c56586ddf3769b924863d5c29a4586b73a8cc26ac
data/Gemfile CHANGED
@@ -8,3 +8,5 @@ gemspec
8
8
  gem "rake", "~> 13.0"
9
9
 
10
10
  gem "minitest", "~> 5.0"
11
+
12
+ gem "thor", "~> 1.2"
data/Gemfile.lock ADDED
@@ -0,0 +1,32 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ pullbox (0.1.10)
5
+ nokogiri (~> 1.12)
6
+ plist (~> 3.6)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ minitest (5.18.0)
12
+ nokogiri (1.14.2-arm64-darwin)
13
+ racc (~> 1.4)
14
+ nokogiri (1.14.2-x86_64-linux)
15
+ racc (~> 1.4)
16
+ plist (3.7.0)
17
+ racc (1.6.2)
18
+ rake (13.0.6)
19
+ thor (1.2.2)
20
+
21
+ PLATFORMS
22
+ arm64-darwin-22
23
+ x86_64-linux
24
+
25
+ DEPENDENCIES
26
+ minitest (~> 5.0)
27
+ pullbox!
28
+ rake (~> 13.0)
29
+ thor (~> 1.2)
30
+
31
+ BUNDLED WITH
32
+ 2.4.10
data/README.md CHANGED
@@ -6,15 +6,19 @@
6
6
 
7
7
  Install the gem and add to the application's Gemfile by executing:
8
8
 
9
- $ bundle add pullbox
9
+ ```bash
10
+ bundle add pullbox
11
+ ```
10
12
 
11
13
  If bundler is not being used to manage dependencies, install the gem by executing:
12
14
 
13
- $ gem install pullbox
15
+ ```bash
16
+ gem install pullbox
17
+ ```
14
18
 
15
19
  ## Usage
16
20
 
17
- Includes a executable `mailmate_beta` which checks and installs MailMate prerelease automatically for you.
21
+ Includes a executable `mailmate`. Use it via `mailmate beta` to check if the current MailMate prerelease is installed and if not it installs it automatically for you.
18
22
  For the AppleScript and DEVONthink functions available check the corresponding source code.
19
23
 
20
24
  ## Contributing
data/exe/mailmate ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "thor"
5
+ require_relative "../lib/pullbox/mailmate"
6
+
7
+ class MailMateCLI < Thor
8
+ desc "beta", "Updates MailMate to the latest beta release"
9
+ def beta
10
+ Pullbox::MailMate.beta_release
11
+ end
12
+ end
13
+
14
+ MailMateCLI.start(ARGV)
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "net/http"
4
+ require "nokogiri"
5
+ require "plist"
6
+ require_relative "applescript"
7
+
8
+ module Pullbox
9
+ class MailMate
10
+ def self.beta_release
11
+ mailmate = "#{Pullbox::AppleScript.applications_folder}MailMate.app/Contents/Info.plist"
12
+ raise "MailMate not installed." unless File.exist? mailmate
13
+
14
+ result = Plist.parse_xml(mailmate)
15
+ raise "MailMate not properly installed." if result.nil?
16
+
17
+ regexp1 = /\(r(?<number>\d+)\)/i
18
+ regexp2 = /(?<number>\d+)/
19
+ long_version = result["CFBundleGetInfoString"]
20
+ version = long_version.match(regexp1)
21
+
22
+ doc = Nokogiri::HTML(Net::HTTP.get(URI("https://updates.mailmate-app.com/archives/")))
23
+ doc.xpath("/html/body/table/tr[position() = (last() - 1)]/td[2]/a/@href").each do |current_release|
24
+ beta_version = current_release.value.match(regexp2)
25
+
26
+ if beta_version[:number].to_i > version[:number].to_i
27
+ response = Net::HTTP.get(URI("https://updates.mailmate-app.com/archives/#{current_release.value}"))
28
+ File.write(current_release.value, response)
29
+ system "tar -xjf #{current_release.value}"
30
+ system "rm #{current_release.value}"
31
+ path = "#{Dir.pwd}/MailMate.app"
32
+ Pullbox::AppleScript.move_app("MailMate", path)
33
+ Pullbox::AppleScript.display_notification("MailMate updated to version: #{beta_version[:number]}", "MailMate Updater")
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Pullbox
4
- VERSION = "0.1.9"
4
+ VERSION = "0.1.11"
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.9
4
+ version: 0.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - PuLLi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-03-19 00:00:00.000000000 Z
11
+ date: 2023-09-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -43,19 +43,21 @@ description: Enables you to write ruby code for AppleScript, DEVONthink and Mail
43
43
  email:
44
44
  - the@pulli.dev
45
45
  executables:
46
- - mailmate_beta
46
+ - mailmate
47
47
  extensions: []
48
48
  extra_rdoc_files: []
49
49
  files:
50
50
  - CHANGELOG.md
51
51
  - Gemfile
52
+ - Gemfile.lock
52
53
  - LICENSE.txt
53
54
  - README.md
54
55
  - Rakefile
55
- - exe/mailmate_beta
56
+ - exe/mailmate
56
57
  - lib/pullbox.rb
57
58
  - lib/pullbox/applescript.rb
58
59
  - lib/pullbox/devonthink.rb
60
+ - lib/pullbox/mailmate.rb
59
61
  - lib/pullbox/version.rb
60
62
  - pullbox.gemspec
61
63
  - sig/pullbox.rbs
@@ -83,7 +85,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
83
85
  - !ruby/object:Gem::Version
84
86
  version: '0'
85
87
  requirements: []
86
- rubygems_version: 3.4.7
88
+ rubygems_version: 3.4.10
87
89
  signing_key:
88
90
  specification_version: 4
89
91
  summary: Just a small toolbox for AppleScript, DEVONthink and MailMate
data/exe/mailmate_beta DELETED
@@ -1,33 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- require "net/http"
5
- require "nokogiri"
6
- require "plist"
7
- require_relative "../lib/pullbox/applescript"
8
-
9
- mailmate = "#{Pullbox::AppleScript.applications_folder}MailMate.app/Contents/Info.plist"
10
- raise "MailMate not installed." unless File.exist? mailmate
11
-
12
- result = Plist.parse_xml(mailmate)
13
- raise "MailMate not properly installed." if result.nil?
14
-
15
- regexp1 = /\(r(?<number>\d+)\)/i
16
- regexp2 = /(?<number>\d+)/
17
- long_version = result["CFBundleGetInfoString"]
18
- version = long_version.match(regexp1)
19
-
20
- doc = Nokogiri::HTML(Net::HTTP.get(URI("https://updates.mailmate-app.com/archives/")))
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
-
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")
32
- end
33
- end