avm-tools 0.41.0 → 0.42.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/base.rb +6 -6
- data/lib/avm/files/formatter/formats/generic_plain.rb +2 -2
- data/lib/avm/files/formatter/formats/html.rb +1 -1
- data/lib/avm/files/formatter/formats/json.rb +1 -5
- data/lib/avm/files/formatter/formats/php.rb +1 -1
- data/lib/avm/files/formatter/formats/python.rb +1 -1
- data/lib/avm/files/formatter/formats/ruby.rb +22 -0
- data/lib/avm/instances/configuration.rb +10 -4
- data/lib/avm/tools/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 21c01866f9d3e2aaa7d30b254740a63daf91dcec77fc4da08b8eb0505832aeb0
|
4
|
+
data.tar.gz: d9c0e0771add271642abb587119b4f887b40667882192612a40406c1fc8dca8a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cb36cadc8af5d05e032a5f0fa83a9af30400ef3636d9d2696e41063ad9f6fb0ad947e013a966452e692628b045986d0586c905280f1b98a4e5baa50055f92fa9
|
7
|
+
data.tar.gz: ddb1cbcd59038ce2374a0952eb1d2289da3f0dc621c48334f422d0b7347616702f82f880205afe8a4dda28ca552916032b0119a66b68fdc2aba0bb730962d5c5
|
data/lib/avm/files/formatter.rb
CHANGED
@@ -19,11 +19,11 @@ module Avm
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def match?(file)
|
22
|
-
|
22
|
+
match_by_filename?(file) || match_by_type?(file)
|
23
23
|
end
|
24
24
|
|
25
|
-
def
|
26
|
-
constant_or_array('
|
25
|
+
def valid_basenames
|
26
|
+
constant_or_array('VALID_BASENAMES')
|
27
27
|
end
|
28
28
|
|
29
29
|
def valid_types
|
@@ -43,9 +43,9 @@ module Avm
|
|
43
43
|
changed: (old_content != File.read(file)))
|
44
44
|
end
|
45
45
|
|
46
|
-
def
|
47
|
-
|
48
|
-
file.
|
46
|
+
def match_by_filename?(file)
|
47
|
+
valid_basenames.any? do |valid_basename|
|
48
|
+
file.basename.fnmatch?(valid_basename)
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
@@ -7,8 +7,8 @@ module Avm
|
|
7
7
|
class Formatter
|
8
8
|
module Formats
|
9
9
|
class GenericPlain < ::Avm::Files::Formatter::Formats::Base
|
10
|
-
|
11
|
-
|
10
|
+
VALID_BASENAMES = %w[*.bat *.css.coffee *.java *.js *.rb *.scss *.sql *.tex *.url *.yml
|
11
|
+
*.yaml].freeze
|
12
12
|
|
13
13
|
VALID_TYPES = %w[plain x-shellscript].freeze
|
14
14
|
|
@@ -8,7 +8,7 @@ module Avm
|
|
8
8
|
class Formatter
|
9
9
|
module Formats
|
10
10
|
class Html < ::Avm::Files::Formatter::Formats::GenericPlain
|
11
|
-
|
11
|
+
VALID_BASENAMES = %w[*.html *.html.erb].freeze
|
12
12
|
VALID_TYPES = ['html'].freeze
|
13
13
|
|
14
14
|
def file_apply(path)
|
@@ -7,13 +7,9 @@ module Avm
|
|
7
7
|
class Formatter
|
8
8
|
module Formats
|
9
9
|
class Json < ::Avm::Files::Formatter::Formats::GenericPlain
|
10
|
-
|
10
|
+
VALID_BASENAMES = %w[*.json].freeze
|
11
11
|
VALID_TYPES = [].freeze
|
12
12
|
|
13
|
-
def match?(file)
|
14
|
-
super || json_file?(file)
|
15
|
-
end
|
16
|
-
|
17
13
|
def file_apply(file)
|
18
14
|
::File.write(file, ::JSON.pretty_generate(::JSON.parse(::File.read(file))))
|
19
15
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/files/formatter/formats/generic_plain'
|
4
|
+
require 'avm/ruby/rubocop'
|
5
|
+
|
6
|
+
module Avm
|
7
|
+
module Files
|
8
|
+
class Formatter
|
9
|
+
module Formats
|
10
|
+
class Ruby < ::Avm::Files::Formatter::Formats::GenericPlain
|
11
|
+
VALID_BASENAMES = %w[*.gemspec *.rake *.rb Gemfile Rakefile].freeze
|
12
|
+
VALID_TYPES = ['x-ruby'].freeze
|
13
|
+
|
14
|
+
def internal_apply(files)
|
15
|
+
::Avm::Ruby::Rubocop.new('.', ['-a', '--ignore-parent-exclusion'] + files).run
|
16
|
+
super(files)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -10,14 +10,20 @@ module Avm
|
|
10
10
|
|
11
11
|
class << self
|
12
12
|
def find_by_path(path)
|
13
|
-
path = ::Pathname.new(path.to_s)
|
14
|
-
|
13
|
+
path = ::Pathname.new(path.to_s) unless path.is_a?(::Pathname)
|
14
|
+
internal_find_path(path.expand_path)
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def internal_find_path(absolute_pathname)
|
20
|
+
if absolute_pathname.directory?
|
15
21
|
FILENAMES.each do |filename|
|
16
|
-
file =
|
22
|
+
file = absolute_pathname.join(filename)
|
17
23
|
return new(file) if file.exist?
|
18
24
|
end
|
19
25
|
end
|
20
|
-
|
26
|
+
internal_find_path(absolute_pathname.dirname) unless absolute_pathname.root?
|
21
27
|
end
|
22
28
|
end
|
23
29
|
|
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.42.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Esquilo Azul Company
|
@@ -237,6 +237,7 @@ files:
|
|
237
237
|
- lib/avm/files/formatter/formats/json.rb
|
238
238
|
- lib/avm/files/formatter/formats/php.rb
|
239
239
|
- lib/avm/files/formatter/formats/python.rb
|
240
|
+
- lib/avm/files/formatter/formats/ruby.rb
|
240
241
|
- lib/avm/files/formatter/utf8_assert.rb
|
241
242
|
- lib/avm/files/info.rb
|
242
243
|
- lib/avm/files/rotate.rb
|