thunderbird 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c9de1d62e6bcb753d69ccdaf75abaafd4da62f6884be11e943978d5df2f8bff6
4
- data.tar.gz: aa85b96e26ad2fbd6b313666481294474c6b630a15fcb420f7684b2a2675edc2
3
+ metadata.gz: 2ce6df42a4aeb1b7cd8d4275712082a3c11bb7c03219c1711641eca2f6ca6fe3
4
+ data.tar.gz: 93f90cd09b730b28c418c7e418707ff3bb67aa803232972f451ce51f41812abb
5
5
  SHA512:
6
- metadata.gz: f4e34e2f49857ad4bde4e80047ccad4c34773aa50d0407ce102eb894380158820eb59b054e0309135cf9bf0269c29679d6ff3350fe68c56041bf55a6fe38a6f0
7
- data.tar.gz: d799f2e2b83e4cdb48939b613052f3b6f488df1eab44de23a72585d40b7cbfa8c21eae0c7c5aba228a8d41dfa0086cc3387297add6ce51793ee68d8887698e21
6
+ metadata.gz: 743e4aefe05fde942fcd687b05474040fda240ca614c5e314d5ce53d5a6b31c48dcb7078f7a180f92c08bb70680102e8a735fa81f33b4d4c1c779db037ae225c
7
+ data.tar.gz: fad8ada3245074cdee0221a6e94f43a1c8c2c8260671e5ab42ae1600c56e61c0de31f8c0a33aa604615333e86d8753d83f74787d77a5424dcb390de9b8b1ef28
@@ -8,14 +8,20 @@ class Thunderbird
8
8
  attr_reader :title
9
9
  attr_reader :entries
10
10
 
11
- # entries are lines from profile.ini
11
+ # entries are lines from profiles.ini
12
12
  def initialize(title:, entries:)
13
13
  @title = title
14
14
  @entries = entries
15
15
  end
16
16
 
17
- def default
18
- Profiles.new.profile_for_path(entries[:Default])
17
+ def default_profile
18
+ profiles.default || profiles.profile_for_path(entries[:Default])
19
+ end
20
+
21
+ private
22
+
23
+ def profiles
24
+ @profiles ||= Profiles.new
19
25
  end
20
26
  end
21
27
  end
@@ -10,9 +10,11 @@ class Thunderbird
10
10
  @path = path
11
11
  end
12
12
 
13
+ def uid_validity
14
+ data.tables[FOLDER_NAMESPACE]["1"]["1"]["UIDValidity"]
15
+ end
16
+
13
17
  def each(&block)
14
- content = File.read(index_path)
15
- data = parser.data(content)
16
18
  messages = data.tables[MESSAGE_NAMESPACE]["1"]
17
19
  File.open(path) do |file|
18
20
  messages.each do |id, message_info|
@@ -26,14 +28,22 @@ class Thunderbird
26
28
 
27
29
  private
28
30
 
29
- MESSAGE_NAMESPACE = "ns:msg:db:row:scope:msgs:all"
31
+ FOLDER_NAMESPACE = "ns:msg:db:row:scope:dbfolderinfo:all"
32
+ private_constant :FOLDER_NAMESPACE
30
33
 
31
- def parser
32
- @parser ||= Mork::Parser.new
33
- end
34
+ MESSAGE_NAMESPACE = "ns:msg:db:row:scope:msgs:all"
35
+ private_constant :MESSAGE_NAMESPACE
34
36
 
35
37
  def index_path
36
38
  "#{path}.msf"
37
39
  end
40
+
41
+ def data
42
+ @data ||= begin
43
+ parser = Mork::Parser.new
44
+ content = File.read(index_path)
45
+ parser.data(content)
46
+ end
47
+ end
38
48
  end
39
49
  end
@@ -8,12 +8,24 @@ class Thunderbird
8
8
  attr_reader :title
9
9
  attr_reader :entries
10
10
 
11
- # entries are lines from profile.ini
11
+ # entries are lines from profiles.ini
12
12
  def initialize(title:, entries:)
13
13
  @title = title
14
14
  @entries = entries
15
15
  end
16
16
 
17
+ def default?
18
+ entries[:Default] == "1"
19
+ end
20
+
21
+ def name
22
+ entries[:Name]
23
+ end
24
+
25
+ def path
26
+ entries[:Path]
27
+ end
28
+
17
29
  def root
18
30
  if relative?
19
31
  File.join(Thunderbird.new.data_path, entries[:Path])
@@ -7,16 +7,16 @@ require "thunderbird/profile"
7
7
  class Thunderbird
8
8
  # http://kb.mozillazine.org/Profiles.ini_file
9
9
  class Profiles
10
- def profile_for_path(path)
11
- title, entries = blocks.find { |_name, entries| entries[:Path] == path }
10
+ def default
11
+ profiles.find(&:default?)
12
+ end
12
13
 
13
- Thunderbird::Profile.new(title: title, entries: entries) if title
14
+ def profile_for_path(path)
15
+ profiles.find { |profile| profile.path == path }
14
16
  end
15
17
 
16
18
  def profile(name)
17
- title, entries = blocks.find { |_name, entries| entries[:Name] == name }
18
-
19
- Thunderbird::Profile.new(title: title, entries: entries) if title
19
+ profiles.find { |profile| profile.name == name }
20
20
  end
21
21
 
22
22
  def installs
@@ -68,6 +68,13 @@ class Thunderbird
68
68
  end
69
69
  end
70
70
 
71
+ def profiles
72
+ @profiles ||=
73
+ blocks.
74
+ filter { |name, _entries| name.start_with?("Profile") }.
75
+ map { |title, entries| Thunderbird::Profile.new(title: title, entries: entries) }
76
+ end
77
+
71
78
  def profiles_ini_path
72
79
  File.join(Thunderbird.new.data_path, "profiles.ini")
73
80
  end
@@ -23,7 +23,7 @@ class Thunderbird
23
23
  return false if !parent_ok
24
24
  end
25
25
 
26
- ok = check
26
+ ok = check_creatable
27
27
  return false if !ok
28
28
 
29
29
  FileUtils.mkdir_p full_path
@@ -79,7 +79,7 @@ class Thunderbird
79
79
  path_elements.map { |p| "#{p}.sbd" }
80
80
  end
81
81
 
82
- def check
82
+ def check_creatable
83
83
  case
84
84
  when exists? && !placeholder.exists?
85
85
  Kernel.puts(
@@ -3,7 +3,7 @@
3
3
  class Thunderbird
4
4
  module Version
5
5
  MAJOR = 0
6
- MINOR = 5
6
+ MINOR = 6
7
7
  REVISION = 0
8
8
  PRE = nil
9
9
  VERSION = [MAJOR, MINOR, REVISION, PRE].compact.map(&:to_s).join(".")
data/lib/thunderbird.rb CHANGED
@@ -5,7 +5,7 @@ require "os"
5
5
  # Require all files so they get counted in coverage
6
6
  Dir.chdir(__dir__) do
7
7
  glob = File.join("**", "*.rb")
8
- Dir[glob].sort.each { |f| require_relative f }
8
+ Dir[glob].each { |f| require_relative f }
9
9
  end
10
10
 
11
11
  # Root information
data/thunderbird.gemspec CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
11
11
  spec.summary = "Conveniences for interacting with Mozilla Thunderbird"
12
12
  spec.homepage = "https://github.com/joeyates/thunderbird"
13
13
  spec.license = "MIT"
14
- spec.required_ruby_version = ">= 2.7"
14
+ spec.required_ruby_version = ">= 3.0"
15
15
 
16
16
  spec.metadata["homepage_uri"] = spec.homepage
17
17
  spec.metadata["source_code_uri"] = "https://github.com/joeyates/thunderbird"
@@ -25,6 +25,6 @@ Gem::Specification.new do |spec|
25
25
  spec.executables = []
26
26
  spec.require_paths = ["lib"]
27
27
 
28
- spec.add_runtime_dependency "mork-parser", "~> 0.2.0"
29
- spec.add_runtime_dependency "os"
28
+ spec.add_dependency "mork-parser", "~> 0.2.0"
29
+ spec.add_dependency "os"
30
30
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thunderbird
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joe Yates
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2024-03-30 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: mork-parser
@@ -38,7 +37,6 @@ dependencies:
38
37
  - - ">="
39
38
  - !ruby/object:Gem::Version
40
39
  version: '0'
41
- description:
42
40
  email:
43
41
  - joe.g.yates@gmail.com
44
42
  executables: []
@@ -65,7 +63,6 @@ metadata:
65
63
  source_code_uri: https://github.com/joeyates/thunderbird
66
64
  changelog_uri: https://github.com/joeyates/thunderbird/blob/main/CHANGELOG.md
67
65
  rubygems_mfa_required: 'true'
68
- post_install_message:
69
66
  rdoc_options: []
70
67
  require_paths:
71
68
  - lib
@@ -73,15 +70,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
73
70
  requirements:
74
71
  - - ">="
75
72
  - !ruby/object:Gem::Version
76
- version: '2.7'
73
+ version: '3.0'
77
74
  required_rubygems_version: !ruby/object:Gem::Requirement
78
75
  requirements:
79
76
  - - ">="
80
77
  - !ruby/object:Gem::Version
81
78
  version: '0'
82
79
  requirements: []
83
- rubygems_version: 3.5.3
84
- signing_key:
80
+ rubygems_version: 3.6.7
85
81
  specification_version: 4
86
82
  summary: Conveniences for interacting with Mozilla Thunderbird
87
83
  test_files: []