avm-tools 0.39.0 → 0.40.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: 0211c8015a2aa7fef610701de30c0a8ae3966a815e273a88e9caa983d1055c26
4
- data.tar.gz: 47303eed16db13dcdaf3b15fc373a20c470ecf074494217507c6dd59554552c1
3
+ metadata.gz: 87c59d534d4e8d100e29772a76fee5fb2442e1893871c7c6c62d2a061cd3d524
4
+ data.tar.gz: 392ae256280e52d2c04e319a0b1ad40ed8029da9ba9fb94fcbdbf4b9a962ff9a
5
5
  SHA512:
6
- metadata.gz: 81eddbd5933240b20c2fb75258dc41c9f351c38a15fc9466ccd719389718977e7c6173d9d2943c9078fc4e639fa9a68c4bb2ba2b89360269a64bd6f33f2d4ec8
7
- data.tar.gz: 732dc09a4318958952cf71820c70b8cc21e3a10013103d4766d63734246f9d0c3b058e6e9dec5f5a8a42bbe388c5022e0769c383fb6eb437fc93988f802878fa
6
+ metadata.gz: 322b86ee2e05bbc436fef2c10e2e7b577b551deb453de80aa2a7e5bf787a243d14f58e5be7e64c2f37dc9177c945b4877f530d85b7c5a3885512bbf550bcd779
7
+ data.tar.gz: f5bbcb44cdc733247020ee60ff0b1d48dbc0b2875c2c27e6ebaaea34c471c8b55fb0a067cb3c7fc79a093a25d6e4ad330333e63cc7656c35b90a528503026d36
@@ -11,7 +11,7 @@ module Avm
11
11
  enable_console_speaker
12
12
  common_constructor :source_paths, :options
13
13
 
14
- FORMATS = %w[html php python generic_plain].freeze
14
+ FORMATS = %w[html php python json generic_plain].freeze
15
15
 
16
16
  def run
17
17
  clear
@@ -7,7 +7,7 @@ module Avm
7
7
  class Formatter
8
8
  module Formats
9
9
  class GenericPlain < ::Avm::Files::Formatter::Formats::Base
10
- VALID_EXTENSIONS = %w[.bat .css.coffee .java .js .json .rb .scss .sql .tex .url .yml
10
+ VALID_EXTENSIONS = %w[.bat .css.coffee .java .js .rb .scss .sql .tex .url .yml
11
11
  .yaml].freeze
12
12
 
13
13
  VALID_TYPES = %w[plain x-shellscript].freeze
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/files/formatter/formats/generic_plain'
4
+
5
+ module Avm
6
+ module Files
7
+ class Formatter
8
+ module Formats
9
+ class Json < ::Avm::Files::Formatter::Formats::GenericPlain
10
+ VALID_EXTENSIONS = %w[.json].freeze
11
+ VALID_TYPES = [].freeze
12
+
13
+ def match?(file)
14
+ super || json_file?(file)
15
+ end
16
+
17
+ def file_apply(file)
18
+ ::File.write(file, ::JSON.pretty_generate(::JSON.parse(::File.read(file))))
19
+ end
20
+
21
+ def json_file?(file)
22
+ ::JSON.parse(::File.read(file))
23
+ true
24
+ rescue JSON::ParserError
25
+ false
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module Tools
5
- VERSION = '0.39.0'
5
+ VERSION = '0.40.0'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: avm-tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.39.0
4
+ version: 0.40.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esquilo Azul Company
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-04-02 00:00:00.000000000 Z
11
+ date: 2020-04-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aranha-parsers
@@ -234,6 +234,7 @@ files:
234
234
  - lib/avm/files/formatter/formats/base.rb
235
235
  - lib/avm/files/formatter/formats/generic_plain.rb
236
236
  - lib/avm/files/formatter/formats/html.rb
237
+ - lib/avm/files/formatter/formats/json.rb
237
238
  - lib/avm/files/formatter/formats/php.rb
238
239
  - lib/avm/files/formatter/formats/python.rb
239
240
  - lib/avm/files/formatter/utf8_assert.rb