fontist 1.15.1 → 1.15.2

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: b05f079e527eb6128f6525bd4923886e5181d266a4cf88151a4131551694de15
4
- data.tar.gz: 1b8ab3e7b58c1c96aa9565d0b244475e047d48823ae9deec6fb194ed95201de0
3
+ metadata.gz: d98d4d83f8bbfe87d19e6c11dd8d365810ac47ddeef59a8855f3fba7f9d5418d
4
+ data.tar.gz: 4f349a35dfe3d164e599dee2e077625b8273dd91c6d4b698042bf25a54ba45a0
5
5
  SHA512:
6
- metadata.gz: 5aa9bbfcf8b155bd876c5f9d28f37fcbe13d1cb6729ecf7056e298457834370973d0898e80af6515a96e904255fe1da027545a0f3c6d601dc41cc26cd211c060
7
- data.tar.gz: 6bae05a6ee7445abb41ee724fb01f07ebf2d7a7222ffc09744bb8b5acd4e2119949b35860f7b21d6bbdc2f8e81545a8115ccd7f2846beab1397842c5ae6b3e76
6
+ metadata.gz: 007af294bcd909651345c08df9f948dae6d62eb7c3e6f26048dc91df3542a53f417a9446c69790f9bfb017e3fd7d9389784938d37274223ff4e16bd1bae47703
7
+ data.tar.gz: 4068f33a62c9e8afe20b3bd6c135fc642c9dcfc9738faa37b49f1e582a6e5b4d879e7d8df65c34554818b2dd1258bd76ee57b90f85b1a119bd3748263f5d374d
@@ -82,7 +82,7 @@ jobs:
82
82
  needs: prepare
83
83
  if: needs.prepare.outputs.push-for-tag != 'true'
84
84
 
85
- continue-on-error: ${{ matrix.ruby.experimental }}
85
+ continue-on-error: ${{ matrix.ruby.experimental || matrix.os == 'windows-latest' }} # workaround https://github.com/metanorma/metanorma/issues/288
86
86
  strategy:
87
87
  fail-fast: false
88
88
  max-parallel: 5
data/fontist.gemspec CHANGED
@@ -34,7 +34,7 @@ Gem::Specification.new do |spec|
34
34
  spec.add_runtime_dependency "nokogiri", "~> 1.0"
35
35
  spec.add_runtime_dependency "mime-types", "~> 3.0"
36
36
  spec.add_runtime_dependency "sys-uname", "~> 1.2"
37
- spec.add_runtime_dependency "thor", "~> 1.0.1"
37
+ spec.add_runtime_dependency "thor", "~> 1.2.1"
38
38
  spec.add_runtime_dependency "git", "~> 1.0"
39
39
  spec.add_runtime_dependency "ttfunk", "~> 1.6"
40
40
  spec.add_runtime_dependency "plist", "~> 3.0"
data/lib/fontist/repo.rb CHANGED
@@ -1,6 +1,62 @@
1
1
  require "git"
2
2
 
3
3
  module Fontist
4
+ class Info
5
+ attr_reader :name, :metadata, :formulas
6
+
7
+ def initialize(name, path)
8
+ @name = name
9
+ @metadata = build_metadata(path)
10
+ @formulas = build_formulas(path)
11
+ end
12
+
13
+ def to_s
14
+ <<~MSG.chomp
15
+ Repository info for '#{@name}':
16
+ #{@metadata.map { |k, v| " #{k}: #{v}" }.join("\n")}
17
+ Found #{formulas.count} formulas:
18
+ #{@formulas.map { |info| "- #{info.description} (#{info.name})" }.join("\n")}
19
+ MSG
20
+ end
21
+
22
+ private
23
+
24
+ def build_metadata(path)
25
+ repo = Git.open(path)
26
+
27
+ {
28
+ url: repo.config["remote.origin.url"],
29
+ revision: revision(repo),
30
+ created: created(repo),
31
+ updated: updated(repo),
32
+ dirty: dirty?(repo),
33
+ }
34
+ end
35
+
36
+ def build_formulas(path)
37
+ path.glob("*.yml").map do |formula_path|
38
+ formula = Formula.new_from_file(formula_path)
39
+ Struct.new(:name, :description).new(formula.key, formula.description)
40
+ end
41
+ end
42
+
43
+ def revision(repo)
44
+ repo.log.first.sha[0..6]
45
+ end
46
+
47
+ def created(repo)
48
+ repo.gcommit(repo.log.last.sha).date
49
+ end
50
+
51
+ def updated(repo)
52
+ repo.gcommit(repo.log.first.sha).date
53
+ end
54
+
55
+ def dirty?(repo)
56
+ !repo.status.changed.empty?
57
+ end
58
+ end
59
+
4
60
  class Repo
5
61
  class << self
6
62
  def setup(name, url)
@@ -47,11 +103,20 @@ module Fontist
47
103
  .map { |path| File.basename(path) }
48
104
  end
49
105
 
106
+ def info(name)
107
+ path = Pathname.new repo_path(name)
108
+ unless path.exist?
109
+ raise(Errors::RepoNotFoundError, "No such repo '#{name}'.")
110
+ end
111
+
112
+ Info.new(name, path)
113
+ end
114
+
50
115
  private
51
116
 
52
117
  def ensure_private_formulas_path_exists
53
118
  Fontist.private_formulas_path.tap do |path|
54
- FileUtils.mkdir_p(path) unless Dir.exist?(path)
119
+ FileUtils.mkdir_p(path)
55
120
  end
56
121
  end
57
122
 
@@ -47,6 +47,16 @@ module Fontist
47
47
  CLI::STATUS_SUCCESS
48
48
  end
49
49
 
50
+ desc "info NAME", "Information about repos"
51
+ def info(name)
52
+ handle_class_options(options)
53
+ info = Repo.info(name)
54
+ Fontist.ui.say(info.to_s)
55
+ CLI::STATUS_SUCCESS
56
+ rescue Errors::RepoNotFoundError
57
+ handle_repo_not_found(name)
58
+ end
59
+
50
60
  private
51
61
 
52
62
  def handle_repo_not_found(name)
@@ -1,3 +1,3 @@
1
1
  module Fontist
2
- VERSION = "1.15.1".freeze
2
+ VERSION = "1.15.2".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.1
4
+ version: 1.15.2
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-07 00:00:00.000000000 Z
11
+ date: 2023-05-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: down
@@ -86,14 +86,14 @@ dependencies:
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: 1.0.1
89
+ version: 1.2.1
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: 1.0.1
96
+ version: 1.2.1
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: git
99
99
  requirement: !ruby/object:Gem::Requirement