avm-tools 0.37.1 → 0.38.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: 265ec590d53bde1eff714c1789cb317e4fe855cce54bf12535f60ab4b508b811
4
- data.tar.gz: 2ac59d6b0c89adb5e091ebe88a65062ccd0ded1c2cb98e5046296701b8cb3604
3
+ metadata.gz: 585031f042e816f18293f7db1e5319c947db381562c87a6aad9f6c61ddfb1f1b
4
+ data.tar.gz: 44f66d7bdd9776e640dd4cd2e3df43acfea139366676f84d32bf07877c04c9b5
5
5
  SHA512:
6
- metadata.gz: 38828cff9cfdc2d3aed17d93f81cc2254bb4f3bae27bd35320f1e5e4d4a7d38d6b24d0a95251aedb35fb7c2d9178ba705b7eb402306a66d2827f310e9e8a3d7e
7
- data.tar.gz: 1e557150968a16d21a5002d30febe4f6812deac5b8f87f8faf84b07b6790ce71608353fa6ffe7d3727536bf4b1b4572914166eb6066f07b27c82c2d875a1f79b
6
+ metadata.gz: debbe214e6e984483870ed64d9a0a8d2eac5dc5231b6dc5d4f1408e93f81aaa98baec2d1c260aaaf9366a6565eacc49a7e090c2f188eac766d2e74ceeb48f9b5
7
+ data.tar.gz: d7a5a4597ee14bf3e1f05c4a021fc678c4cc297bafda9f5e3268160210d9605d5ef7be1408b41b0a9aa2439b9ebe1550082fa58f0accc4aa08b16dd29b03621a
@@ -1,28 +1,23 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'eac_ruby_utils/envs'
4
+ require 'eac_ruby_utils/simple_cache'
4
5
 
5
6
  module Avm
6
7
  module Executables
7
8
  class << self
9
+ include ::EacRubyUtils::SimpleCache
10
+
8
11
  def env
9
12
  ::EacRubyUtils::Envs.local
10
13
  end
11
14
 
12
- def file
13
- @file ||= env.executable('file', '--version')
14
- end
15
-
16
- def git
17
- @git ||= env.executable('git', '--version')
18
- end
19
-
20
- def docker
21
- @docker ||= env.executable('docker', '--version')
22
- end
15
+ private
23
16
 
24
- def php_cs_fixer
25
- @php_cs_fixer ||= env.executable('php-cs-fixer', '--version')
17
+ %w[docker file git php-cs-fixer yapf].each do |program|
18
+ define_method(program.underscore + '_uncached') do
19
+ env.executable(program, '--version')
20
+ end
26
21
  end
27
22
  end
28
23
  end
@@ -11,7 +11,7 @@ module Avm
11
11
  enable_console_speaker
12
12
  common_constructor :source_paths, :options
13
13
 
14
- FORMATS = %w[php generic_plain].freeze
14
+ FORMATS = %w[php python generic_plain].freeze
15
15
 
16
16
  def run
17
17
  clear
@@ -1,12 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/files/formatter/formats/per_file_base'
3
+ require 'avm/files/formatter/formats/base'
4
4
 
5
5
  module Avm
6
6
  module Files
7
7
  class Formatter
8
8
  module Formats
9
- class GenericPlain < ::Avm::Files::Formatter::Formats::PerFileBase
9
+ class GenericPlain < ::Avm::Files::Formatter::Formats::Base
10
10
  VALID_EXTENSIONS = %w[.bat .css.coffee .java .js .json .rb .scss .sql .tex .url .yml
11
11
  .yaml].freeze
12
12
 
@@ -1,19 +1,18 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/files/formatter/formats/per_file_base'
4
3
  require 'avm/files/formatter/formats/generic_plain'
5
4
 
6
5
  module Avm
7
6
  module Files
8
7
  class Formatter
9
8
  module Formats
10
- class Php < ::Avm::Files::Formatter::Formats::PerFileBase
9
+ class Php < ::Avm::Files::Formatter::Formats::GenericPlain
11
10
  VALID_EXTENSIONS = %w[.php].freeze
12
11
  VALID_TYPES = ['x-php'].freeze
13
12
 
14
13
  def file_apply(file)
15
14
  ::Avm::Executables.php_cs_fixer.command.append(['fix', file]).system!
16
- ::Avm::Files::Formatter::Formats::GenericPlain.new.file_apply(file)
15
+ super(file)
17
16
  end
18
17
  end
19
18
  end
@@ -0,0 +1,21 @@
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 Python < ::Avm::Files::Formatter::Formats::GenericPlain
10
+ VALID_EXTENSIONS = %w[.py].freeze
11
+ VALID_TYPES = ['x-python'].freeze
12
+
13
+ def internal_apply(files)
14
+ ::Avm::Executables.yapf.command.append(['--in-place', *files]).system!
15
+ super(files)
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module Tools
5
- VERSION = '0.37.1'
5
+ VERSION = '0.38.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.37.1
4
+ version: 0.38.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-01 00:00:00.000000000 Z
11
+ date: 2020-04-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aranha-parsers
@@ -213,8 +213,8 @@ files:
213
213
  - lib/avm/files/formatter/formats.rb
214
214
  - lib/avm/files/formatter/formats/base.rb
215
215
  - lib/avm/files/formatter/formats/generic_plain.rb
216
- - lib/avm/files/formatter/formats/per_file_base.rb
217
216
  - lib/avm/files/formatter/formats/php.rb
217
+ - lib/avm/files/formatter/formats/python.rb
218
218
  - lib/avm/files/formatter/utf8_assert.rb
219
219
  - lib/avm/files/info.rb
220
220
  - lib/avm/files/rotate.rb
@@ -1,17 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'avm/files/formatter/formats/base'
4
-
5
- module Avm
6
- module Files
7
- class Formatter
8
- module Formats
9
- class PerFileBase < ::Avm::Files::Formatter::Formats::Base
10
- def internal_apply(files)
11
- files.each { |file| file_apply(file) }
12
- end
13
- end
14
- end
15
- end
16
- end
17
- end