eac_tools 0.55.7 → 0.56.0

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: 3b4986d5d4f203b2446bf15351a22b29701c9f3f467afee4e2e5fd557a7b15f3
4
- data.tar.gz: 3f277827e7f8880fce8c95a1d5bd21529763e786e8c6edf4e070b04762a531f0
3
+ metadata.gz: b39a13e0d2d3c95ec91b645a95b4194dd25550440a986de200e9e0867ef2ec31
4
+ data.tar.gz: b7135c790da9d47ce3675cced805478b9b16a4c9d27ee3454612bc5c86e9e2f2
5
5
  SHA512:
6
- metadata.gz: 5d6de889f5814a26b52abb0c77135d7eb173333fc9c35fc2a1d5a043cefc6624018fc2fe7897cc4eba0fb94e219b02538623c9e8689d32c0e735b8d99e1587c5
7
- data.tar.gz: 27a49cabf562f3ca549f171a3c3b29d4587dcf16a94887f95980f135bc63dd7222c6f75e9a8d3b568bcba08e022b067a3f9867919d30a5b3ec54f7737f24246d
6
+ metadata.gz: f400d1cf29e23f6ffc9a87025d4765a7a601c9e0fd4c53925ccfc636bca411e840e94cb153cdc7cfd11ff32fb79111ba97d3b59389772260fdfc7d1e02861d6d
7
+ data.tar.gz: f22e7776248bc742fb3005aa4f3fbf3fb468f8efcafb890d14058ac3d4c93a3cd4012da2d99d0accaf7216ef8948cd359dcad8f7e543c6e8b1e372b5337e12de
data/Gemfile.lock CHANGED
@@ -1,10 +1,10 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- eac_tools (0.55.7)
5
- avm (~> 0.65)
4
+ eac_tools (0.56.0)
5
+ avm (~> 0.66)
6
6
  avm-eac_asciidoctor_base0 (~> 0.15)
7
- avm-eac_generic_base0 (~> 0.11)
7
+ avm-eac_generic_base0 (~> 0.12)
8
8
  avm-eac_latex_base0 (~> 0.3)
9
9
  avm-eac_php_base0 (~> 0.4, >= 0.4.1)
10
10
  avm-eac_postgresql_base0 (~> 0.2, >= 0.2.3)
@@ -14,7 +14,7 @@ PATH
14
14
  avm-eac_redmine_base0 (~> 0.18, >= 0.18.2)
15
15
  avm-eac_redmine_plugin_base0 (~> 0.4)
16
16
  avm-eac_ruby_base1 (~> 0.30)
17
- avm-eac_webapp_base0 (~> 0.13, >= 0.13.1)
17
+ avm-eac_webapp_base0 (~> 0.14)
18
18
  avm-eac_wordpress_base0 (~> 0.3)
19
19
  avm-git (~> 0.13, >= 0.13.1)
20
20
  avm-tools (~> 0.145, >= 0.145.1)
@@ -47,8 +47,8 @@ PATH
47
47
  PATH
48
48
  remote: sub/avm-eac_generic_base0
49
49
  specs:
50
- avm-eac_generic_base0 (0.11.0)
51
- avm (~> 0.64, >= 0.64.1)
50
+ avm-eac_generic_base0 (0.12.0)
51
+ avm (~> 0.66)
52
52
  eac_ruby_utils (~> 0.112)
53
53
 
54
54
  PATH
@@ -137,13 +137,13 @@ PATH
137
137
  PATH
138
138
  remote: sub/avm-eac_webapp_base0
139
139
  specs:
140
- avm-eac_webapp_base0 (0.13.1)
141
- avm (~> 0.60)
142
- avm-eac_generic_base0 (~> 0.9)
140
+ avm-eac_webapp_base0 (0.14.0)
141
+ avm (~> 0.66)
142
+ avm-eac_generic_base0 (~> 0.12)
143
143
  avm-eac_postgresql_base0 (~> 0.2, >= 0.2.3)
144
- avm-eac_ubuntu_base0 (~> 0.4)
144
+ avm-eac_ubuntu_base0 (~> 0.4, >= 0.4.1)
145
145
  avm-files (~> 0.6)
146
- eac_ruby_utils (~> 0.110, >= 0.110.1)
146
+ eac_ruby_utils (~> 0.112)
147
147
 
148
148
  PATH
149
149
  remote: sub/avm-eac_wordpress_base0
@@ -194,7 +194,7 @@ PATH
194
194
  PATH
195
195
  remote: sub/avm
196
196
  specs:
197
- avm (0.65.0)
197
+ avm (0.66.0)
198
198
  aranha-parsers (~> 0.17)
199
199
  eac_cli (~> 0.30, >= 0.30.1)
200
200
  eac_config (~> 0.12)
@@ -334,7 +334,7 @@ GEM
334
334
  os (1.1.4)
335
335
  parallel (1.22.1)
336
336
  parseconfig (1.1.2)
337
- parser (3.2.1.1)
337
+ parser (3.2.2.0)
338
338
  ast (~> 2.4.1)
339
339
  parslet (2.0.0)
340
340
  public_suffix (5.0.1)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacTools
4
- VERSION = '0.55.7'
4
+ VERSION = '0.56.0'
5
5
  end
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/file_formats/utf8_assert'
4
3
  require 'eac_fs/file_info'
5
4
  require 'ostruct'
6
5
 
@@ -10,10 +9,10 @@ module Avm
10
9
  enable_abstract_methods
11
10
  compare_by :class
12
11
 
13
- def apply(files)
14
- old_content = Hash[files.map { |f| [f, File.read(f)] }]
15
- ::Avm::FileFormats::Utf8Assert.assert_files(files) { internal_apply(files) }
16
- files.map { |f| build_file_result(f, old_content[f]) }
12
+ # @params files [Enumerable<Pathname>]
13
+ # @return [Enumerable<Avm::FileFormats::FileResult>]
14
+ def apply(_files)
15
+ raise_abstract_method __method__
17
16
  end
18
17
 
19
18
  # @param path [Pathname]
@@ -26,42 +25,10 @@ module Avm
26
25
  self.class.name.demodulize
27
26
  end
28
27
 
29
- def match?(file)
30
- match_by_filename?(file) || match_by_type?(file)
31
- end
32
-
33
- def valid_basenames
34
- constant_or_array('VALID_BASENAMES')
35
- end
36
-
37
- def valid_types
38
- constant_or_array('VALID_TYPES')
39
- end
40
-
41
- private
42
-
43
- def constant_or_array(name)
44
- return [] unless self.class.const_defined?(name)
45
-
46
- self.class.const_get(name)
47
- end
48
-
49
- def build_file_result(file, old_content)
50
- ::OpenStruct.new(file: file, format: self.class,
51
- changed: (old_content != File.read(file)))
52
- end
53
-
54
- def match_by_filename?(file)
55
- valid_basenames.any? do |valid_basename|
56
- file.basename.fnmatch?(valid_basename)
57
- end
58
- end
59
-
60
- def match_by_type?(file)
61
- info = ::EacFs::FileInfo.new(file)
62
- return unless info.content_type.type == 'text'
63
-
64
- valid_types.include?(info.content_type.subtype)
28
+ # @param file [Pathname]
29
+ # @return [Boolean]
30
+ def match?(_file)
31
+ raise_abstract_method __method__
65
32
  end
66
33
  end
67
34
  end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/file_formats/utf8_assert'
4
+ require 'eac_fs/file_info'
5
+ require 'ostruct'
6
+
7
+ module Avm
8
+ module FileFormats
9
+ class FileResult
10
+ common_constructor :file, :format, :changed
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/file_formats/base'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module Avm
7
+ module FileFormats
8
+ class Unknown < ::Avm::FileFormats::Base
9
+ # @params files [Enumerable<Pathname>]
10
+ # @return [Enumerable<Avm::FileFormats::FileResult>]
11
+ def apply(files)
12
+ files.map do |file|
13
+ ::Avm::FileFormats::FileResult.new(file, self.class, false)
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'avm/file_formats/unknown'
3
4
  require 'avm/registry/from_gems'
4
5
 
5
6
  module Avm
@@ -9,6 +10,11 @@ module Avm
9
10
  def class_detect(klass, detect_args)
10
11
  klass.new if klass.new.match?(detect_args.first)
11
12
  end
13
+
14
+ # @return [Avm::FileFormats::Base, Avm::FileFormats::Unknown]
15
+ def detect_optional(*registered_initialize_args)
16
+ super || ::Avm::FileFormats::Unknown.new
17
+ end
12
18
  end
13
19
  end
14
20
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Avm
4
- VERSION = '0.65.0'
4
+ VERSION = '0.66.0'
5
5
  end
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
12
12
 
13
13
  s.files = Dir['{lib,locale}/**/*']
14
14
 
15
- s.add_dependency 'avm', '~> 0.64', '>= 0.64.1'
15
+ s.add_dependency 'avm', '~> 0.66'
16
16
  s.add_dependency 'eac_ruby_utils', '~> 0.112'
17
17
 
18
18
  s.add_development_dependency 'eac_ruby_gem_support', '~> 0.5.1'
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/file_formats/base'
4
+ require 'avm/file_formats/file_result'
5
+ require 'avm/file_formats/utf8_assert'
6
+ require 'eac_ruby_utils/core_ext'
7
+
8
+ module Avm
9
+ module EacGenericBase0
10
+ class FileFormats
11
+ class Base < ::Avm::FileFormats::Base
12
+ class Apply
13
+ enable_method_class
14
+ common_constructor :file_format, :files
15
+
16
+ # @return [Enumerable<Avm::FileFormats::FileResult>]
17
+ def result
18
+ old_content = Hash[files.map { |f| [f, File.read(f)] }]
19
+ ::Avm::FileFormats::Utf8Assert.assert_files(files) { file_format.internal_apply(files) }
20
+ files.map { |f| file_result(f, old_content[f]) }
21
+ end
22
+
23
+ # @param path [Pathname]
24
+ # @param old_content [String]
25
+ # @return [Avm::FileFormats::FileResult]
26
+ def file_result(file, old_content)
27
+ ::Avm::FileFormats::FileResult.new(file, file_format.class,
28
+ old_content != File.read(file))
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,69 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/file_formats/base'
4
+ require 'eac_fs/file_info'
5
+ require 'eac_ruby_utils/core_ext'
6
+
7
+ module Avm
8
+ module EacGenericBase0
9
+ class FileFormats
10
+ class Base < ::Avm::FileFormats::Base
11
+ class Match
12
+ DEFAULT_TYPE = 'text'
13
+
14
+ common_constructor :file_format, :file
15
+
16
+ # @return [Boolean]
17
+ def result
18
+ result_by_filename? || result_by_type?
19
+ end
20
+
21
+ # @return [Array<String>]
22
+ def valid_basenames
23
+ constant_or_array('VALID_BASENAMES')
24
+ end
25
+
26
+ # @return [Array<String>]
27
+ def valid_types
28
+ constant_or_array('VALID_TYPES').map do |mime_type|
29
+ mime_type_sanitize(mime_type)
30
+ end
31
+ end
32
+
33
+ protected
34
+
35
+ # @return [String]
36
+ def mime_type_sanitize(mime_type)
37
+ if mime_type.split('/').count > 1
38
+ mime_type
39
+ else
40
+ "#{DEFAULT_TYPE}/#{mime_type}"
41
+ end
42
+ end
43
+
44
+ private
45
+
46
+ # @return [Array<String>]
47
+ def constant_or_array(name)
48
+ return [] unless file_format.class.const_defined?(name)
49
+
50
+ file_format.class.const_get(name)
51
+ end
52
+
53
+ # @return [Boolean]
54
+ def result_by_filename?
55
+ valid_basenames.any? do |valid_basename|
56
+ file.basename.fnmatch?(valid_basename)
57
+ end
58
+ end
59
+
60
+ # @return [Boolean]
61
+ def result_by_type?
62
+ info = ::EacFs::FileInfo.new(file)
63
+ valid_types.include?(info.content_type.mime_type)
64
+ end
65
+ end
66
+ end
67
+ end
68
+ end
69
+ end
@@ -7,7 +7,7 @@ module Avm
7
7
  module EacGenericBase0
8
8
  class FileFormats
9
9
  class Base < ::Avm::FileFormats::Base
10
- require_sub __FILE__, include_modules: true
10
+ require_sub __FILE__, include_modules: true, require_dependency: true
11
11
 
12
12
  VALID_BASENAMES = %w[*.asm *.bat *.coffee *.java *.js *.rb *.s *.sql *.tex *.url *.yml
13
13
  *.yaml].freeze
@@ -21,7 +21,7 @@ module Avm
21
21
  # @param file [Pathname]
22
22
  # @return [Boolean]
23
23
  def match?(file)
24
- super(file) || !file.exist?
24
+ ::Avm::EacGenericBase0::FileFormats::Base::Match.new(self, file).result || !file.exist?
25
25
  end
26
26
 
27
27
  def file_apply(file)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module EacGenericBase0
5
- VERSION = '0.11.0'
5
+ VERSION = '0.12.0'
6
6
  end
7
7
  end
@@ -12,12 +12,12 @@ Gem::Specification.new do |s|
12
12
 
13
13
  s.files = Dir['{lib,template}/**/*']
14
14
 
15
- s.add_dependency 'avm', '~> 0.60'
16
- s.add_dependency 'avm-eac_generic_base0', '~> 0.9'
15
+ s.add_dependency 'avm', '~> 0.66'
16
+ s.add_dependency 'avm-eac_generic_base0', '~> 0.12'
17
17
  s.add_dependency 'avm-eac_postgresql_base0', '~> 0.2', '>= 0.2.3'
18
- s.add_dependency 'avm-eac_ubuntu_base0', '~> 0.4'
18
+ s.add_dependency 'avm-eac_ubuntu_base0', '~> 0.4', '>= 0.4.1'
19
19
  s.add_dependency 'avm-files', '~> 0.6'
20
- s.add_dependency 'eac_ruby_utils', '~> 0.110', '>= 0.110.1'
20
+ s.add_dependency 'eac_ruby_utils', '~> 0.112'
21
21
 
22
22
  s.add_development_dependency 'eac_ruby_gem_support', '~> 0.2'
23
23
  end
@@ -7,8 +7,8 @@ module Avm
7
7
  module EacWebappBase0
8
8
  module FileFormats
9
9
  class Xml < ::Avm::EacGenericBase0::FileFormats::Base
10
- VALID_BASENAMES = %w[*.xml].freeze
11
- VALID_TYPES = ['xml'].freeze
10
+ VALID_BASENAMES = %w[*.svg *.xml].freeze
11
+ VALID_TYPES = ['image/svg+xml', 'xml'].freeze
12
12
 
13
13
  def internal_apply(files)
14
14
  format_command(files).system!
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module EacWebappBase0
5
- VERSION = '0.13.1'
5
+ VERSION = '0.14.0'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eac_tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.55.7
4
+ version: 0.56.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Put here the authors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-03-31 00:00:00.000000000 Z
11
+ date: 2023-04-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: avm
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.65'
19
+ version: '0.66'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0.65'
26
+ version: '0.66'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: avm-eac_asciidoctor_base0
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0.11'
47
+ version: '0.12'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '0.11'
54
+ version: '0.12'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: avm-eac_latex_base0
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -220,20 +220,14 @@ dependencies:
220
220
  requirements:
221
221
  - - "~>"
222
222
  - !ruby/object:Gem::Version
223
- version: '0.13'
224
- - - ">="
225
- - !ruby/object:Gem::Version
226
- version: 0.13.1
223
+ version: '0.14'
227
224
  type: :runtime
228
225
  prerelease: false
229
226
  version_requirements: !ruby/object:Gem::Requirement
230
227
  requirements:
231
228
  - - "~>"
232
229
  - !ruby/object:Gem::Version
233
- version: '0.13'
234
- - - ">="
235
- - !ruby/object:Gem::Version
236
- version: 0.13.1
230
+ version: '0.14'
237
231
  - !ruby/object:Gem::Dependency
238
232
  name: avm-eac_wordpress_base0
239
233
  requirement: !ruby/object:Gem::Requirement
@@ -419,7 +413,9 @@ files:
419
413
  - sub/avm-eac_generic_base0/lib/avm/eac_generic_base0.rb
420
414
  - sub/avm-eac_generic_base0/lib/avm/eac_generic_base0/file_formats.rb
421
415
  - sub/avm-eac_generic_base0/lib/avm/eac_generic_base0/file_formats/base.rb
416
+ - sub/avm-eac_generic_base0/lib/avm/eac_generic_base0/file_formats/base/apply.rb
422
417
  - sub/avm-eac_generic_base0/lib/avm/eac_generic_base0/file_formats/base/file_resource_name_helper.rb
418
+ - sub/avm-eac_generic_base0/lib/avm/eac_generic_base0/file_formats/base/match.rb
423
419
  - sub/avm-eac_generic_base0/lib/avm/eac_generic_base0/instances.rb
424
420
  - sub/avm-eac_generic_base0/lib/avm/eac_generic_base0/instances/base.rb
425
421
  - sub/avm-eac_generic_base0/lib/avm/eac_generic_base0/sources.rb
@@ -1111,7 +1107,9 @@ files:
1111
1107
  - sub/avm/lib/avm/executables.rb
1112
1108
  - sub/avm/lib/avm/file_formats.rb
1113
1109
  - sub/avm/lib/avm/file_formats/base.rb
1110
+ - sub/avm/lib/avm/file_formats/file_result.rb
1114
1111
  - sub/avm/lib/avm/file_formats/search_formatter.rb
1112
+ - sub/avm/lib/avm/file_formats/unknown.rb
1115
1113
  - sub/avm/lib/avm/file_formats/utf8_assert.rb
1116
1114
  - sub/avm/lib/avm/instances.rb
1117
1115
  - sub/avm/lib/avm/instances/base.rb