avm-tools 0.43.0 → 0.44.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: 4eaa25ad0b16e1e00f3d9efd040b44b4ce0025c1ad5143892d0849ee8bdff949
4
- data.tar.gz: f67dc9660f344c09deb5af514e06bd24e61f381d640df39b53546f13d55492c9
3
+ metadata.gz: 998ac2a1aa3e9b7cc2ef9ee50fb91ea89ea3e82aa5f185bbfe436bd6e3415b4f
4
+ data.tar.gz: 6a807ba7c42769009199fb6ff63f81076f93bd21d26be66e5fb8bfe3f44e42a9
5
5
  SHA512:
6
- metadata.gz: c0becf6917e2bc8bbbc6052a55100f97584a361cc32ee46bd4c42654649023dee8f9b98318e42640b79073e120be8a3f090e210fa44d70e23e78719ef49593eb
7
- data.tar.gz: e3fbf5efed9dcb5e52ed19020fac23a3f15534921955d48f5df297a29deb685e86903a2905c8d274683b89069bdfa3f2ed7969d46b66498110362c898de3937f
6
+ metadata.gz: 7bf91fa6a966ef1c62031fe6422db8b4a1de4c96c0cb1e2e17c45204ee8e187b9c38c764de962900185e41cf5579472af8b0e9b996c08e0ab5f06347f8d6c446
7
+ data.tar.gz: dbe91e4b2c7275183afdd29608f2bacd32d8f2c09c5b003562e444ac36e02cf2d71c1e4cdd2507da0b295b9bc41531b8c91b90aa81493f4ea6cfceff07de83fd
@@ -16,6 +16,8 @@ module Avm
16
16
  ::ContentType.parse(
17
17
  ::Avm::Executables.file.command.append(['-ib', path]).execute!.strip
18
18
  )
19
+ rescue Parslet::ParseFailed
20
+ ::ContentType.parse('application/unknown')
19
21
  end
20
22
  end
21
23
  end
@@ -29,6 +29,16 @@ module Avm
29
29
  end
30
30
  end
31
31
 
32
+ def root_path
33
+ r = ::Pathname.new(to_s).expand_path
34
+ loop do
35
+ return r if r.join('.git').exist?
36
+ raise "\".git\" not found for \"#{self}\"" if r.dirname.root?
37
+
38
+ r = r.dirname
39
+ end
40
+ end
41
+
32
42
  private
33
43
 
34
44
  def parse_status_line(line)
@@ -27,7 +27,7 @@ module Avm
27
27
  private
28
28
 
29
29
  def mygem_uncached
30
- find_gem(base_path)
30
+ find_gem(::Pathname.new(base_path).expand_path)
31
31
  end
32
32
 
33
33
  def find_gem(path)
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'avm/files/formatter'
4
+ require 'avm/patches/eac_launcher_git_base'
4
5
  require 'eac_ruby_utils/console/docopt_runner'
5
6
  require 'eac_ruby_utils/core_ext'
6
7
 
@@ -23,6 +24,7 @@ module Avm
23
24
  -a --apply Confirm changes.
24
25
  -n --no-recursive No recursive.
25
26
  -v --verbose Verbose
27
+ -d --git-dirty Select Git dirty files to format.
26
28
  DOCOPT
27
29
 
28
30
  def run
@@ -34,8 +36,20 @@ module Avm
34
36
  verbose: options.fetch('--verbose') }
35
37
  end
36
38
 
39
+ def git
40
+ @git ||= ::EacLauncher::Git::Base.new('.')
41
+ end
42
+
43
+ def git_dirty_files
44
+ git.dirty_files.map { |f| git.root_path.join(f.path) }.select(&:exist?).map(&:to_s)
45
+ end
46
+
37
47
  def source_paths
38
- options.fetch('<paths>').if_present(%w[.])
48
+ if options.fetch('--git-dirty')
49
+ options.fetch('<paths>') + git_dirty_files
50
+ else
51
+ options.fetch('<paths>').if_present(%w[.])
52
+ end
39
53
  end
40
54
  end
41
55
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module Tools
5
- VERSION = '0.43.0'
5
+ VERSION = '0.44.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.43.0
4
+ version: 0.44.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-06 00:00:00.000000000 Z
11
+ date: 2020-04-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aranha-parsers