fontist 1.15.0 → 1.15.1

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: 8ef3c1df1ab7760fa50abdca9dc9c760d7f953dfc209f3841a8c01b9297760e9
4
- data.tar.gz: b6e32f79b2cdeb3af88ec2ae3bdbf9ad767f41d3721dcfa2991f670e74ceaade
3
+ metadata.gz: b05f079e527eb6128f6525bd4923886e5181d266a4cf88151a4131551694de15
4
+ data.tar.gz: 1b8ab3e7b58c1c96aa9565d0b244475e047d48823ae9deec6fb194ed95201de0
5
5
  SHA512:
6
- metadata.gz: bb6f7c6325ba122a79e6713b642dd6ca4967f6622f013dc1c56b41a03e0228da6e5a7e3707211dd293d78d9a3e4a07eec7edc545710f9b322c45f0f7b4c0e7e1
7
- data.tar.gz: 2e42062f05fa332dcea0b93fde315db285c8d5894f029e85fdcfcda9f3f57eeed60dc55ed816cb33405c80581a7b313e15cb44e2c13eedafab1d011043b20336
6
+ metadata.gz: 5aa9bbfcf8b155bd876c5f9d28f37fcbe13d1cb6729ecf7056e298457834370973d0898e80af6515a96e904255fe1da027545a0f3c6d601dc41cc26cd211c060
7
+ data.tar.gz: 6bae05a6ee7445abb41ee724fb01f07ebf2d7a7222ffc09744bb8b5acd4e2119949b35860f7b21d6bbdc2f8e81545a8115ccd7f2846beab1397842c5ae6b3e76
@@ -2,13 +2,27 @@ module Fontist
2
2
  class CacheCLI < Thor
3
3
  include CLI::ClassOptions
4
4
 
5
- desc "clear", "Clear fontist download cache"
5
+ desc "clear", "Clear fontist cache"
6
6
  def clear
7
7
  handle_class_options(options)
8
8
  dir = Fontist.downloads_path
9
- dir.each_child(&:delete) if dir.exist?
10
- Fontist.ui.success("Download cache has been successfully removed.")
9
+ dir.each_child(&:rmtree) if dir.exist?
10
+ clear_indexes
11
+ Fontist.ui.success("Cache has been successfully removed.")
11
12
  CLI::STATUS_SUCCESS
12
13
  end
14
+
15
+ private
16
+
17
+ def clear_indexes
18
+ delete_file_with_lock(Fontist.system_index_path)
19
+ delete_file_with_lock(Fontist.system_preferred_family_index_path)
20
+ end
21
+
22
+ def delete_file_with_lock(path)
23
+ path.delete if path.exist?
24
+ lock_path = Pathname.new Fontist::Utils::Cache.lock_path(path)
25
+ lock_path.delete if lock_path.exist?
26
+ end
13
27
  end
14
28
  end
@@ -121,7 +121,7 @@ module Fontist
121
121
  end
122
122
 
123
123
  def lock_path
124
- "#{@index_path}.lock"
124
+ Utils::Cache.lock_path(@index_path)
125
125
  end
126
126
 
127
127
  def do_build_index
@@ -3,6 +3,10 @@ module Fontist
3
3
  class Cache
4
4
  include Locking
5
5
 
6
+ def self.lock_path(path)
7
+ "#{path}.lock"
8
+ end
9
+
6
10
  def fetch(key)
7
11
  map = load_cache
8
12
  if cache_exist?(map[key])
@@ -79,7 +83,7 @@ module Fontist
79
83
  end
80
84
 
81
85
  def lock_path
82
- cache_map_path.to_s + ".lock"
86
+ Cache.lock_path(cache_map_path)
83
87
  end
84
88
 
85
89
  def move_to_downloads(source)
@@ -1,3 +1,3 @@
1
1
  module Fontist
2
- VERSION = "1.15.0".freeze
2
+ VERSION = "1.15.1".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fontist
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.15.0
4
+ version: 1.15.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-03-03 00:00:00.000000000 Z
11
+ date: 2023-03-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: down