fontist 1.2.1 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/check_google.yml +28 -0
- data/.github/workflows/macosx.yml +3 -0
- data/.github/workflows/ubuntu.yml +1 -1
- data/.github/workflows/windows.yml +1 -1
- data/.gitignore +6 -0
- data/.hound.yml +2 -0
- data/.rubocop.yml +22 -0
- data/README.md +224 -0
- data/bin/check_google +8 -0
- data/bin/convert_formulas +8 -0
- data/bin/fontist +7 -0
- data/bin/generate_otfinfo +8 -0
- data/bin/import_google +8 -0
- data/fontist.gemspec +16 -1
- data/lib/fontist.rb +23 -13
- data/lib/fontist/cli.rb +162 -0
- data/lib/fontist/errors.rb +5 -0
- data/lib/fontist/font.rb +181 -8
- data/lib/fontist/font_formula.rb +12 -5
- data/lib/fontist/fontist_font.rb +70 -0
- data/lib/fontist/formula.rb +27 -9
- data/lib/fontist/formula_template.rb +108 -0
- data/lib/fontist/formulas.rb +41 -0
- data/lib/fontist/import.rb +9 -0
- data/lib/fontist/import/convert_formulas.rb +65 -0
- data/lib/fontist/import/create_formula.rb +74 -0
- data/lib/fontist/import/extractors.rb +5 -0
- data/lib/fontist/import/extractors/cab_extractor.rb +37 -0
- data/lib/fontist/import/extractors/extractor.rb +19 -0
- data/lib/fontist/import/extractors/ole_extractor.rb +41 -0
- data/lib/fontist/import/extractors/seven_zip_extractor.rb +44 -0
- data/lib/fontist/import/extractors/zip_extractor.rb +31 -0
- data/lib/fontist/import/files/collection_file.rb +47 -0
- data/lib/fontist/import/formula_builder.rb +162 -0
- data/lib/fontist/import/formula_serializer.rb +133 -0
- data/lib/fontist/import/google.rb +16 -0
- data/lib/fontist/import/google/fonts_public.md +10 -0
- data/lib/fontist/import/google/fonts_public.pb.rb +71 -0
- data/lib/fontist/import/google/fonts_public.proto +46 -0
- data/lib/fontist/import/google/new_fonts_fetcher.rb +121 -0
- data/lib/fontist/import/google/skiplist.yml +8 -0
- data/lib/fontist/import/google_check.rb +34 -0
- data/lib/fontist/import/google_import.rb +180 -0
- data/lib/fontist/import/helpers/hash_helper.rb +13 -0
- data/lib/fontist/import/helpers/system_helper.rb +23 -0
- data/lib/fontist/import/otf/font_file.rb +91 -0
- data/lib/fontist/import/otf_parser.rb +25 -0
- data/lib/fontist/import/otf_style.rb +29 -0
- data/lib/fontist/import/otfinfo/otfinfo_requirement.rb +22 -0
- data/lib/fontist/import/otfinfo/template.erb +20 -0
- data/lib/fontist/import/otfinfo_generate.rb +45 -0
- data/lib/fontist/import/recursive_extraction.rb +128 -0
- data/lib/fontist/import/template_helper.rb +19 -0
- data/lib/fontist/import/text_helper.rb +30 -0
- data/lib/fontist/manifest.rb +2 -0
- data/lib/fontist/manifest/common.rb +60 -0
- data/lib/fontist/manifest/install.rb +36 -0
- data/lib/fontist/manifest/locations.rb +13 -0
- data/lib/fontist/registry.rb +1 -0
- data/lib/fontist/system_font.rb +53 -22
- data/lib/fontist/utils.rb +5 -0
- data/lib/fontist/utils/cache.rb +88 -0
- data/lib/fontist/utils/downloader.rb +69 -8
- data/lib/fontist/utils/dsl.rb +4 -0
- data/lib/fontist/utils/dsl/font.rb +37 -0
- data/lib/fontist/utils/exe_extractor.rb +20 -18
- data/lib/fontist/utils/msi_extractor.rb +31 -0
- data/lib/fontist/utils/seven_zip_extractor.rb +41 -0
- data/lib/fontist/utils/system.rb +23 -0
- data/lib/fontist/utils/ui.rb +27 -0
- data/lib/fontist/utils/zip_extractor.rb +10 -4
- data/lib/fontist/version.rb +1 -1
- metadata +185 -48
- data/lib/fontist/formulas/andale_font.rb +0 -80
- data/lib/fontist/formulas/arial_black_font.rb +0 -79
- data/lib/fontist/formulas/cleartype_fonts.rb +0 -227
- data/lib/fontist/formulas/comic_font.rb +0 -78
- data/lib/fontist/formulas/courier_font.rb +0 -81
- data/lib/fontist/formulas/euphemia_font.rb +0 -85
- data/lib/fontist/formulas/georgia_font.rb +0 -80
- data/lib/fontist/formulas/impact_font.rb +0 -78
- data/lib/fontist/formulas/montserrat_font.rb +0 -132
- data/lib/fontist/formulas/ms_truetype_fonts.rb +0 -125
- data/lib/fontist/formulas/open_sans_fonts.rb +0 -263
- data/lib/fontist/formulas/overpass_font.rb +0 -73
- data/lib/fontist/formulas/source_fonts.rb +0 -109
- data/lib/fontist/formulas/stix_fonts.rb +0 -108
- data/lib/fontist/formulas/tahoma_font.rb +0 -147
- data/lib/fontist/formulas/webding_font.rb +0 -78
- data/spec/fontist/font_formula_spec.rb +0 -67
- data/spec/fontist/font_spec.rb +0 -87
- data/spec/fontist/formula_spec.rb +0 -67
- data/spec/fontist/formulas/andale_font_spec.rb +0 -29
- data/spec/fontist/formulas/arial_black_font_spec.rb +0 -29
- data/spec/fontist/formulas/cleartype_fonts_spec.rb +0 -38
- data/spec/fontist/formulas/comic_font_spec.rb +0 -29
- data/spec/fontist/formulas/courier_font_spec.rb +0 -29
- data/spec/fontist/formulas/euphemia_font_spec.rb +0 -29
- data/spec/fontist/formulas/georgia_font_spec.rb +0 -29
- data/spec/fontist/formulas/impact_font_spec.rb +0 -29
- data/spec/fontist/formulas/montserrat_font_spec.rb +0 -29
- data/spec/fontist/formulas/ms_truetype_fonts_spec.rb +0 -29
- data/spec/fontist/formulas/open_sans_fonts_spec.rb +0 -29
- data/spec/fontist/formulas/overpass_font_spec.rb +0 -29
- data/spec/fontist/formulas/source_fonts_spec.rb +0 -31
- data/spec/fontist/formulas/stix_fonts_spec.rb +0 -29
- data/spec/fontist/formulas/tahoma_font_spec.rb +0 -29
- data/spec/fontist/formulas/webding_font_spec.rb +0 -29
- data/spec/fontist/registry_spec.rb +0 -47
- data/spec/fontist/system_font_spec.rb +0 -44
- data/spec/fontist/utils/downloader_spec.rb +0 -35
- data/spec/fontist_spec.rb +0 -5
- data/spec/spec_helper.rb +0 -22
- data/spec/support/fontist_helper.rb +0 -10
@@ -0,0 +1,70 @@
|
|
1
|
+
module Fontist
|
2
|
+
class FontistFont
|
3
|
+
def initialize(font_name:)
|
4
|
+
@font_name = font_name
|
5
|
+
|
6
|
+
check_and_register_font_formulas
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.find(name)
|
10
|
+
new(font_name: name).find
|
11
|
+
end
|
12
|
+
|
13
|
+
def find
|
14
|
+
return unless @font_name
|
15
|
+
|
16
|
+
filenames = fonts_filenames
|
17
|
+
return if filenames.empty?
|
18
|
+
|
19
|
+
paths = font_paths.select do |path|
|
20
|
+
filenames.any? { |f| File.basename(path).casecmp?(f) }
|
21
|
+
end
|
22
|
+
|
23
|
+
paths.empty? ? nil : paths
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def fonts_filenames
|
29
|
+
fonts.map { |font| font.styles.map(&:font) }.flatten
|
30
|
+
end
|
31
|
+
|
32
|
+
def fonts
|
33
|
+
by_key || by_name || []
|
34
|
+
end
|
35
|
+
|
36
|
+
def by_key
|
37
|
+
_key, formula = formulas.detect do |key, _value|
|
38
|
+
key.to_s.casecmp?(@font_name)
|
39
|
+
end
|
40
|
+
|
41
|
+
return unless formula
|
42
|
+
|
43
|
+
formula.fonts
|
44
|
+
end
|
45
|
+
|
46
|
+
def by_name
|
47
|
+
_key, formula = formulas.detect do |_key, value|
|
48
|
+
value.fonts.map(&:name).map(&:downcase).include?(@font_name.downcase)
|
49
|
+
end
|
50
|
+
|
51
|
+
return unless formula
|
52
|
+
|
53
|
+
formula.fonts.select do |font|
|
54
|
+
font.name.casecmp?(@font_name)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def formulas
|
59
|
+
@formulas ||= Fontist::Registry.instance.formulas.to_h
|
60
|
+
end
|
61
|
+
|
62
|
+
def font_paths
|
63
|
+
Dir.glob(Fontist.fonts_path.join("**"))
|
64
|
+
end
|
65
|
+
|
66
|
+
def check_and_register_font_formulas
|
67
|
+
$check_and_register_font_formulas ||= Fontist::Formulas.register_formulas
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
data/lib/fontist/formula.rb
CHANGED
@@ -2,6 +2,7 @@ module Fontist
|
|
2
2
|
class Formula
|
3
3
|
def initialize(options = {})
|
4
4
|
@font_name = options.fetch(:font_name, nil)
|
5
|
+
@style_name = options.fetch(:style_name, nil)
|
5
6
|
|
6
7
|
check_and_register_font_formulas
|
7
8
|
end
|
@@ -18,6 +19,10 @@ module Fontist
|
|
18
19
|
new(font_name: name).find_fonts
|
19
20
|
end
|
20
21
|
|
22
|
+
def self.find_styles(font, style)
|
23
|
+
new(font_name: font, style_name: style).find_styles
|
24
|
+
end
|
25
|
+
|
21
26
|
def all
|
22
27
|
@all ||= Fontist::Registry.instance.formulas
|
23
28
|
end
|
@@ -28,29 +33,42 @@ module Fontist
|
|
28
33
|
|
29
34
|
def find_fonts
|
30
35
|
formulas = [find_formula].flatten
|
31
|
-
|
36
|
+
fonts = take_fonts(formulas)
|
37
|
+
fonts.empty? ? nil : fonts
|
38
|
+
end
|
39
|
+
|
40
|
+
def find_styles
|
41
|
+
formulas.values.flat_map do |formula|
|
42
|
+
formula.fonts.flat_map do |f|
|
43
|
+
f.styles.select do |s|
|
44
|
+
f.name.casecmp?(font_name) && s.type.casecmp?(style_name)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
32
48
|
end
|
33
49
|
|
34
50
|
private
|
35
51
|
|
36
|
-
attr_reader :font_name
|
52
|
+
attr_reader :font_name, :style_name
|
37
53
|
|
38
54
|
def find_formula
|
39
|
-
find_by_font_name || find_by_font || []
|
55
|
+
find_by_key || find_by_font_name || find_by_font || []
|
40
56
|
end
|
41
57
|
|
42
58
|
def formulas
|
43
59
|
@formulas ||= all.to_h
|
44
60
|
end
|
45
61
|
|
46
|
-
def
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
62
|
+
def take_fonts(formulas)
|
63
|
+
formulas.map(&:fonts).flatten
|
64
|
+
end
|
65
|
+
|
66
|
+
def find_by_key
|
67
|
+
matched_formulas = formulas.select do |key, _value|
|
68
|
+
key.to_s.casecmp?(font_name)
|
51
69
|
end
|
52
70
|
|
53
|
-
|
71
|
+
matched_formulas.empty? ? nil : matched_formulas.values
|
54
72
|
end
|
55
73
|
|
56
74
|
def find_by_font_name
|
@@ -0,0 +1,108 @@
|
|
1
|
+
module Fontist
|
2
|
+
class FormulaTemplate
|
3
|
+
def self.create_formula_class(formula)
|
4
|
+
Class.new(FontFormula) do |klass|
|
5
|
+
first_font = (formula.fonts || formula.font_collections.first.fonts).first
|
6
|
+
cleanname = first_font.name.gsub(/ /, "")
|
7
|
+
resource_name = formula.resources.to_h.keys.first
|
8
|
+
font_filename = first_font.styles.first.font
|
9
|
+
|
10
|
+
key formula.key&.to_sym || formula.name.gsub(/ /, "_").downcase.to_sym
|
11
|
+
display_progress_bar formula.display_progress_bar if formula.display_progress_bar
|
12
|
+
desc formula.description
|
13
|
+
homepage formula.homepage
|
14
|
+
|
15
|
+
formula.resources.to_h.each do |filename, options|
|
16
|
+
resource filename do
|
17
|
+
urls options.urls
|
18
|
+
sha256 options.sha256
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
if formula.font_collections
|
23
|
+
formula.font_collections.each do |collection|
|
24
|
+
provides_font_collection do
|
25
|
+
filename collection.filename
|
26
|
+
|
27
|
+
collection.fonts.each do |font|
|
28
|
+
styles = font.styles.map { |s| [s.type, s.full_name] }.to_h
|
29
|
+
provides_font font.name, extract_styles_from_collection: styles
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
if formula.fonts
|
36
|
+
formula.fonts.each do |font|
|
37
|
+
provides_font(
|
38
|
+
font.name,
|
39
|
+
match_styles_from_file: font.styles.map do |style|
|
40
|
+
{
|
41
|
+
family_name: style.family_name,
|
42
|
+
style: style.type,
|
43
|
+
full_name: style.full_name,
|
44
|
+
post_script_name: style.post_script_name,
|
45
|
+
version: style.version,
|
46
|
+
description: style.description,
|
47
|
+
filename: style.font,
|
48
|
+
copyright: style.copyright,
|
49
|
+
}
|
50
|
+
end
|
51
|
+
)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
klass.define_method :extract do
|
56
|
+
resource = resource(resource_name)
|
57
|
+
|
58
|
+
[formula.extract].flatten.each do |operation|
|
59
|
+
method = "#{operation.format}_extract"
|
60
|
+
resource = if operation.options
|
61
|
+
send(method, resource, **operation.options.to_h)
|
62
|
+
else
|
63
|
+
send(method, resource)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
if formula.fonts
|
68
|
+
formula.fonts.each do |font|
|
69
|
+
match_fonts(resource, font.name)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
if formula.font_collections
|
74
|
+
formula.font_collections.each do |collection|
|
75
|
+
collection.fonts.each do |font|
|
76
|
+
match_fonts(resource, font.name)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
klass.define_method :install do
|
83
|
+
case platform
|
84
|
+
when :macos
|
85
|
+
install_matched_fonts "$HOME/Library/Fonts/#{cleanname}"
|
86
|
+
when :linux
|
87
|
+
install_matched_fonts "/usr/share/fonts/truetype/#{cleanname.downcase}"
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
test do
|
92
|
+
case platform
|
93
|
+
when :macos
|
94
|
+
assert_predicate "$HOME/Library/Fonts/#{cleanname}/#{font_filename}", :exist?
|
95
|
+
when :linux
|
96
|
+
assert_predicate "/usr/share/fonts/truetype/#{cleanname.downcase}/#{font_filename}", :exist?
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
copyright formula.copyright
|
101
|
+
license_url formula.license_url
|
102
|
+
|
103
|
+
open_license formula.open_license if formula.open_license
|
104
|
+
requires_license_agreement formula.requires_license_agreement if formula.requires_license_agreement
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
data/lib/fontist/formulas.rb
CHANGED
@@ -1,9 +1,45 @@
|
|
1
|
+
require "git"
|
1
2
|
require "fontist/utils"
|
2
3
|
require "fontist/font_formula"
|
4
|
+
require "fontist/formula_template"
|
3
5
|
|
4
6
|
module Fontist
|
5
7
|
module Formulas
|
6
8
|
def self.register_formulas
|
9
|
+
load_formulas
|
10
|
+
update_registry
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.fetch_formulas
|
14
|
+
if Dir.exist?(Fontist.formulas_repo_path)
|
15
|
+
Git.open(Fontist.formulas_repo_path).pull
|
16
|
+
else
|
17
|
+
Git.clone(Fontist.formulas_repo_url,
|
18
|
+
Fontist.formulas_repo_path,
|
19
|
+
depth: 1)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.load_formulas
|
24
|
+
Dir[Fontist.formulas_path.join("**/*.yml").to_s].sort.each do |file|
|
25
|
+
create_formula_class(file)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.create_formula_class(file)
|
30
|
+
formula = parse_to_object(YAML.load_file(file))
|
31
|
+
class_name = name_to_classname(formula.name)
|
32
|
+
return if Formulas.const_defined?(class_name)
|
33
|
+
|
34
|
+
klass = FormulaTemplate.create_formula_class(formula)
|
35
|
+
Formulas.const_set(class_name, klass)
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.parse_to_object(hash)
|
39
|
+
JSON.parse(hash.to_json, object_class: OpenStruct)
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.update_registry
|
7
43
|
Formulas.constants.select do |constant|
|
8
44
|
if Formulas.const_get(constant).is_a?(Class)
|
9
45
|
klass = "Fontist::Formulas::#{constant}"
|
@@ -11,5 +47,10 @@ module Fontist
|
|
11
47
|
end
|
12
48
|
end
|
13
49
|
end
|
50
|
+
|
51
|
+
def self.name_to_classname(name)
|
52
|
+
cleanname = name.gsub(/ /, "").sub(/\S/, &:upcase)
|
53
|
+
"#{cleanname}Font"
|
54
|
+
end
|
14
55
|
end
|
15
56
|
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
require_relative "formula_serializer"
|
2
|
+
|
3
|
+
module Fontist
|
4
|
+
module Import
|
5
|
+
class ConvertFormulas
|
6
|
+
def call
|
7
|
+
find_formulas.each do |formula|
|
8
|
+
convert_to_yaml(formula)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def find_formulas
|
15
|
+
require_formulas_files
|
16
|
+
formulas_instances
|
17
|
+
end
|
18
|
+
|
19
|
+
def require_formulas_files
|
20
|
+
path = Fontist.lib_path.join("fontist", "converted_formulas")
|
21
|
+
Dir[path.join("**/*.rb").to_s].sort.each do |file|
|
22
|
+
require file
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def formulas_instances
|
27
|
+
classes = Formulas.constants.select do |constant|
|
28
|
+
Formulas.const_get(constant).is_a?(Class)
|
29
|
+
end
|
30
|
+
|
31
|
+
classes.map do |constant|
|
32
|
+
Object.const_get("Fontist::Formulas::#{constant}").instance
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def convert_to_yaml(formula)
|
37
|
+
hash = formula_hash(formula)
|
38
|
+
write_yaml(formula, hash)
|
39
|
+
end
|
40
|
+
|
41
|
+
def formula_hash(formula)
|
42
|
+
code = File.read(formula_path(formula))
|
43
|
+
FormulaSerializer.new(formula, code).call
|
44
|
+
end
|
45
|
+
|
46
|
+
def formula_path(formula)
|
47
|
+
formula.method(:extract).source_location.first
|
48
|
+
end
|
49
|
+
|
50
|
+
def write_yaml(formula, hash)
|
51
|
+
File.write(yaml_formula_path(formula), YAML.dump(stringify_keys(hash)))
|
52
|
+
end
|
53
|
+
|
54
|
+
def yaml_formula_path(formula)
|
55
|
+
name = formula_path(formula).match(/formulas\/(.*)_fonts?.rb/)[1]
|
56
|
+
|
57
|
+
Fontist.formulas_path.join(name + ".yml")
|
58
|
+
end
|
59
|
+
|
60
|
+
def stringify_keys(hash)
|
61
|
+
JSON.parse(hash.to_json)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
require "fontist/import"
|
2
|
+
require_relative "recursive_extraction"
|
3
|
+
require_relative "otf/font_file"
|
4
|
+
require_relative "files/collection_file"
|
5
|
+
require_relative "helpers/hash_helper"
|
6
|
+
require_relative "formula_builder"
|
7
|
+
|
8
|
+
module Fontist
|
9
|
+
module Import
|
10
|
+
class CreateFormula
|
11
|
+
FONT_PATTERN = /(\.ttf|\.otf)/i.freeze
|
12
|
+
FONT_COLLECTION_PATTERN = /\.ttc/i.freeze
|
13
|
+
LICENSE_PATTERN = /(OFL\.txt|UFL\.txt|LICENSE\.txt|COPYING)$/i.freeze
|
14
|
+
|
15
|
+
def initialize(url, options = {})
|
16
|
+
@url = url
|
17
|
+
@options = options
|
18
|
+
end
|
19
|
+
|
20
|
+
def call
|
21
|
+
save(formula)
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def formula
|
27
|
+
builder = FormulaBuilder.new
|
28
|
+
builder.url = @url
|
29
|
+
builder.archive = download(@url)
|
30
|
+
builder.extractor = extractor(builder.archive)
|
31
|
+
builder.options = @options
|
32
|
+
builder.font_files = font_files(builder.extractor)
|
33
|
+
builder.font_collection_files = font_collection_files(builder.extractor)
|
34
|
+
builder.license_text = license_texts(builder.extractor).first
|
35
|
+
builder.formula
|
36
|
+
end
|
37
|
+
|
38
|
+
def download(url)
|
39
|
+
return url if File.exist?(url)
|
40
|
+
|
41
|
+
Fontist::Utils::Downloader.download(url, progress_bar: true).path
|
42
|
+
end
|
43
|
+
|
44
|
+
def extractor(archive)
|
45
|
+
RecursiveExtraction.new(archive, subarchive: @options[:subarchive])
|
46
|
+
end
|
47
|
+
|
48
|
+
def font_files(extractor)
|
49
|
+
extractor.extract(FONT_PATTERN) do |path|
|
50
|
+
Otf::FontFile.new(path)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def font_collection_files(extractor)
|
55
|
+
extractor.extract(FONT_COLLECTION_PATTERN) do |path|
|
56
|
+
Files::CollectionFile.new(path)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def license_texts(extractor)
|
61
|
+
extractor.extract(LICENSE_PATTERN) do |path|
|
62
|
+
File.read(path)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
def save(hash)
|
67
|
+
filename = Import.name_to_filename(hash[:name])
|
68
|
+
yaml = YAML.dump(Helpers::HashHelper.stringify_keys(hash))
|
69
|
+
File.write(filename, yaml)
|
70
|
+
filename
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|