avm-tools 0.38.0 → 0.39.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/avm/files/formatter.rb +1 -1
- data/lib/avm/files/formatter/formats/html.rb +45 -0
- data/lib/avm/tools/version.rb +1 -1
- metadata +22 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0211c8015a2aa7fef610701de30c0a8ae3966a815e273a88e9caa983d1055c26
|
4
|
+
data.tar.gz: 47303eed16db13dcdaf3b15fc373a20c470ecf074494217507c6dd59554552c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 81eddbd5933240b20c2fb75258dc41c9f351c38a15fc9466ccd719389718977e7c6173d9d2943c9078fc4e639fa9a68c4bb2ba2b89360269a64bd6f33f2d4ec8
|
7
|
+
data.tar.gz: 732dc09a4318958952cf71820c70b8cc21e3a10013103d4766d63734246f9d0c3b058e6e9dec5f5a8a42bbe388c5022e0769c383fb6eb437fc93988f802878fa
|
data/lib/avm/files/formatter.rb
CHANGED
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/files/formatter/formats/generic_plain'
|
4
|
+
require 'htmlbeautifier'
|
5
|
+
|
6
|
+
module Avm
|
7
|
+
module Files
|
8
|
+
class Formatter
|
9
|
+
module Formats
|
10
|
+
class Html < ::Avm::Files::Formatter::Formats::GenericPlain
|
11
|
+
VALID_EXTENSIONS = %w[.html .html.erb].freeze
|
12
|
+
VALID_TYPES = ['html'].freeze
|
13
|
+
|
14
|
+
def file_apply(path)
|
15
|
+
input = ::File.read(path)
|
16
|
+
temppath = tempfile_path
|
17
|
+
::File.open(temppath, 'w') do |output|
|
18
|
+
beautify path, input, output
|
19
|
+
end
|
20
|
+
::FileUtils.mv(temppath, path)
|
21
|
+
super(path)
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def beautify(name, input, output)
|
27
|
+
output.puts ::HtmlBeautifier.beautify(input, htmlbeautify_options)
|
28
|
+
rescue StandardError => e
|
29
|
+
raise "Error parsing #{name}: #{e}"
|
30
|
+
end
|
31
|
+
|
32
|
+
def htmlbeautify_options
|
33
|
+
@htmlbeautify_options ||= { indent: ' ' }
|
34
|
+
end
|
35
|
+
|
36
|
+
def tempfile_path
|
37
|
+
tempfile = ::Tempfile.new
|
38
|
+
tempfile.close
|
39
|
+
tempfile.path
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
data/lib/avm/tools/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: avm-tools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.39.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Esquilo Azul Company
|
@@ -120,6 +120,26 @@ dependencies:
|
|
120
120
|
- - ">="
|
121
121
|
- !ruby/object:Gem::Version
|
122
122
|
version: '0'
|
123
|
+
- !ruby/object:Gem::Dependency
|
124
|
+
name: htmlbeautifier
|
125
|
+
requirement: !ruby/object:Gem::Requirement
|
126
|
+
requirements:
|
127
|
+
- - "~>"
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
version: '1.3'
|
130
|
+
- - ">="
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: 1.3.1
|
133
|
+
type: :runtime
|
134
|
+
prerelease: false
|
135
|
+
version_requirements: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - "~>"
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '1.3'
|
140
|
+
- - ">="
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: 1.3.1
|
123
143
|
- !ruby/object:Gem::Dependency
|
124
144
|
name: minitar
|
125
145
|
requirement: !ruby/object:Gem::Requirement
|
@@ -213,6 +233,7 @@ files:
|
|
213
233
|
- lib/avm/files/formatter/formats.rb
|
214
234
|
- lib/avm/files/formatter/formats/base.rb
|
215
235
|
- lib/avm/files/formatter/formats/generic_plain.rb
|
236
|
+
- lib/avm/files/formatter/formats/html.rb
|
216
237
|
- lib/avm/files/formatter/formats/php.rb
|
217
238
|
- lib/avm/files/formatter/formats/python.rb
|
218
239
|
- lib/avm/files/formatter/utf8_assert.rb
|