avm-eac_webapp_base0 0.10.0 → 0.11.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: 8edee65419d483890bcba0f8ada6555f374c637f49baab1ee0b1c3eed87b1a44
4
- data.tar.gz: c233e77be942064f7e1c012f150709550ab76e421f61a2743b7d28de58fc113f
3
+ metadata.gz: e4f5048d43c599391f0cfedc58311f00e158bca25e9cc577fe144bbc77a91ea0
4
+ data.tar.gz: 8a15030ad33dccc81583db298e75b02ffb4074eeac004bc9ffea7fddab4ad9ff
5
5
  SHA512:
6
- metadata.gz: b8367487016eefc17ff0c8d8add87524608cced0af5fa74336ad08392446fa3d0ccf8a4fb5faf399b807d069414bbb0dbcb18465a7c5ea0aae254db6850cdf50
7
- data.tar.gz: '08ecafa72654a72d3015f65b95350a9eb6494870886a386b33104666edcae547b5ae7bd075cea56238b59c6d859d11dd93f877d5fe8e2ea06b2c5b3fc2d1de09'
6
+ metadata.gz: '079dd0246ecbf55073c241931a2be2e53bb920fe87c94b0a07285624d3bc0cce03ba0e6e4b5c0f192f4dfec4f1de60c380d0a11fc25ec507862792b5e52b8bec'
7
+ data.tar.gz: 7ca127278989ce771aac952b8378aed9b51033c467f292b9abe5565523f1c3189d9c120d2d43b1f08178288d14d2eae97787f285cfb66c89685f04b792fc8428
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/eac_generic_base0/file_formats/base'
4
+ require 'htmlbeautifier'
5
+
6
+ module Avm
7
+ module EacWebappBase0
8
+ module FileFormats
9
+ class Html < ::Avm::EacGenericBase0::FileFormats::Base
10
+ VALID_BASENAMES = %w[*.html *.html.erb].freeze
11
+ VALID_TYPES = [].freeze
12
+
13
+ def file_apply(path)
14
+ input = ::File.read(path)
15
+ temppath = tempfile_path
16
+ ::File.open(temppath, 'w') do |output|
17
+ beautify path, input, output
18
+ end
19
+ ::FileUtils.mv(temppath, path)
20
+ super(path)
21
+ end
22
+
23
+ private
24
+
25
+ def beautify(name, input, output)
26
+ output.puts ::HtmlBeautifier.beautify(input, htmlbeautify_options)
27
+ rescue StandardError => e
28
+ raise "Error parsing #{name}: #{e}"
29
+ end
30
+
31
+ def htmlbeautify_options
32
+ @htmlbeautify_options ||= { indent: ' ' }
33
+ end
34
+
35
+ def tempfile_path
36
+ tempfile = ::Tempfile.new
37
+ tempfile.close
38
+ tempfile.path
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/executables'
4
+ require 'avm/eac_generic_base0/file_formats/base'
5
+
6
+ module Avm
7
+ module EacWebappBase0
8
+ module FileFormats
9
+ class Javascript < ::Avm::EacGenericBase0::FileFormats::Base
10
+ VALID_BASENAMES = %w[*.js].freeze
11
+ VALID_TYPES = [].freeze
12
+
13
+ def internal_apply(files)
14
+ ::Avm::Executables.js_beautify.command.append(
15
+ ['--indent-size=2', '--end-with-newline', '--replace', *files]
16
+ ).system!
17
+ super(files)
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/eac_generic_base0/file_formats/base'
4
+
5
+ module Avm
6
+ module EacWebappBase0
7
+ module FileFormats
8
+ class Json < ::Avm::EacGenericBase0::FileFormats::Base
9
+ VALID_BASENAMES = %w[*.json].freeze
10
+ VALID_TYPES = [].freeze
11
+
12
+ def file_apply(file)
13
+ ::File.write(file, ::JSON.pretty_generate(::JSON.parse(::File.read(file))))
14
+ end
15
+
16
+ def json_file?(file)
17
+ ::JSON.parse(::File.read(file))
18
+ true
19
+ rescue JSON::ParserError
20
+ false
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/eac_webapp_base0/file_formats/html'
4
+ require 'avm/eac_webapp_base0/file_formats/javascript'
5
+ require 'avm/eac_webapp_base0/file_formats/json'
6
+ require 'avm/eac_webapp_base0/file_formats/xml'
7
+ require 'eac_ruby_utils/core_ext'
8
+
9
+ module Avm
10
+ module EacWebappBase0
11
+ module FileFormats
12
+ class Provider
13
+ ALL_NAMES = %w[html javascript json xml].freeze
14
+
15
+ def all
16
+ @all ||= ALL_NAMES.map do |name|
17
+ ::Avm::EacWebappBase0::FileFormats.const_get(name.camelize).freeze
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/executables'
4
+ require 'avm/eac_generic_base0/file_formats/base'
5
+
6
+ module Avm
7
+ module EacWebappBase0
8
+ module FileFormats
9
+ class Xml < ::Avm::EacGenericBase0::FileFormats::Base
10
+ VALID_BASENAMES = %w[*.xml].freeze
11
+ VALID_TYPES = ['xml'].freeze
12
+
13
+ def internal_apply(files)
14
+ format_command(files).system!
15
+ super(files)
16
+ end
17
+
18
+ def format_command(files)
19
+ ::Avm::Executables.tidy.command.append(
20
+ %w[-xml -modify --indent auto --indent-spaces 2 --wrap 100] + files
21
+ )
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module EacWebappBase0
7
+ module FileFormats
8
+ require_sub __FILE__
9
+ end
10
+ end
11
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module EacWebappBase0
5
- VERSION = '0.10.0'
5
+ VERSION = '0.11.0'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: avm-eac_webapp_base0
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.11.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: 2022-10-16 00:00:00.000000000 Z
11
+ date: 2022-10-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: avm
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.50'
19
+ version: '0.51'
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.50'
26
+ version: '0.51'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: avm-eac_generic_base0
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.5'
33
+ version: '0.6'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0.5'
40
+ version: '0.6'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: avm-eac_postgresql_base0
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -101,6 +101,12 @@ extensions: []
101
101
  extra_rdoc_files: []
102
102
  files:
103
103
  - lib/avm/eac_webapp_base0.rb
104
+ - lib/avm/eac_webapp_base0/file_formats.rb
105
+ - lib/avm/eac_webapp_base0/file_formats/html.rb
106
+ - lib/avm/eac_webapp_base0/file_formats/javascript.rb
107
+ - lib/avm/eac_webapp_base0/file_formats/json.rb
108
+ - lib/avm/eac_webapp_base0/file_formats/provider.rb
109
+ - lib/avm/eac_webapp_base0/file_formats/xml.rb
104
110
  - lib/avm/eac_webapp_base0/instances/apache_host.rb
105
111
  - lib/avm/eac_webapp_base0/instances/apache_path.rb
106
112
  - lib/avm/eac_webapp_base0/instances/base.rb