avm-tools 0.44.1 → 0.44.2

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: 9be68fd9248dde307039746994095610b01d6573d51bcbb10fe5e2ea60401e5f
4
- data.tar.gz: 96a8c8a84d42f093c3a9f294c5666a81f5dd4a16c175feb5628cfafddac42d31
3
+ metadata.gz: 7c9d91dc20429e3c9c932f57e47152b19fb1e468f3e564c44f4f395f7d04b5d7
4
+ data.tar.gz: 18bfbdc67f8f8a9c93bccff6798f4b444fc6c20e3a9a4318e1acae168c6cccd1
5
5
  SHA512:
6
- metadata.gz: 6474b6c59010f5e188f80fa6af2680b12f75c6b8c5cc0a944bbe6a8c85beb0be96654fa71eb59f86ebf8937e3cd270a83524b184ea8b7755742752f7c786a59d
7
- data.tar.gz: 0cc329cd19e10c92ab7ffc38d1afda69bb03c07524a39e557d8d337084897c1b40330808a514603a64bba20d5185824a2fcc3464ddde5d3f6c32588addae644e
6
+ metadata.gz: ab35a0b3b98a2885cc1de50a117b5fa579429160aa1cae64d9edf4edc94fa819afad0bb470bcbd7b7f293ca3ff90bda4d56c37460455093dab45ac4879174532
7
+ data.tar.gz: 6f7ec8185a22da62ec5b5ada88065ba74ca6a0971235322732aff502c94d5853be532dc188fae5bef70830de18cd20412af536ff82f3c3dd991d08a69f7a4559
@@ -1,11 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'eac_ruby_utils/core_ext'
4
- require 'eac_ruby_utils/filesystem_traverser'
4
+ require 'eac_ruby_utils/fs/traversable'
5
5
 
6
6
  module Avm
7
7
  module Files
8
8
  class Formatter
9
+ include ::EacRubyUtils::Fs::Traversable
9
10
  require_sub __FILE__
10
11
  enable_simple_cache
11
12
  enable_console_speaker
@@ -32,7 +33,7 @@ module Avm
32
33
  end
33
34
  end
34
35
 
35
- def check_file(file)
36
+ def traverser_check_file(file)
36
37
  format = find_format(file)
37
38
  infov file, format ? format.class : '-' if options.fetch(:verbose)
38
39
  return unless format
@@ -59,18 +60,11 @@ module Avm
59
60
  end
60
61
  end
61
62
 
62
- def fs_traverser_uncached
63
- r = ::EacRubyUtils::FilesystemTraverser.new
64
- r.check_file = method(:check_file)
65
- r.recursive = options.fetch(:recursive)
66
- r
67
- end
68
-
69
63
  def search_files
70
64
  infov 'Directories to search', source_paths.count
71
65
  source_paths.each do |source_path|
72
66
  infom "Searching files on \"#{source_path}\"..."
73
- fs_traverser.check_path(source_path)
67
+ traverser_check_path(source_path)
74
68
  end
75
69
  end
76
70
 
@@ -83,6 +77,10 @@ module Avm
83
77
  end
84
78
  infov('Files changed', "#{changed.count}/#{@result.count}")
85
79
  end
80
+
81
+ def traverser_recursive
82
+ options.fetch(:recursive)
83
+ end
86
84
  end
87
85
  end
88
86
  end
@@ -9,43 +9,66 @@ require 'eac_ruby_utils/require_sub'
9
9
  module Avm
10
10
  module Patches
11
11
  module EacLauncherGitBase
12
- def execute(*args)
13
- args, options = build_args(args)
14
- ::EacRubyUtils::Envs.local.command(*args).execute(options)
15
- end
12
+ extend ::ActiveSupport::Concern
16
13
 
17
- def command(*args)
18
- args, _options = build_args(args)
19
- ::EacRubyUtils::Envs.local.command(*args)
14
+ included do
15
+ extend ClassMethods
16
+ include InstanceMethods
20
17
  end
21
18
 
22
- def dirty?
23
- dirty_files.any?
24
- end
19
+ module ClassMethods
20
+ # @return [EacLauncher::Git::Base]
21
+ def by_root(search_base_path)
22
+ new(find_root(search_base_path).to_path)
23
+ end
24
+
25
+ # Searches the root path for the Git repository which includes +search_base_path+.
26
+ # @return [Pathname]
27
+ def find_root(search_base_path)
28
+ path = search_base_path.to_pathname.expand_path
29
+ loop do
30
+ return path if path.join('.git').exist?
31
+ raise "\".git\" not found for \"#{search_base_path}\"" if path.parent.root?
25
32
 
26
- def dirty_files
27
- execute!('status', '--porcelain', '--untracked-files').each_line.map do |line|
28
- parse_status_line(line.gsub(/\n\z/, ''))
33
+ path = path.parent
34
+ end
29
35
  end
30
36
  end
31
37
 
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?
38
+ module InstanceMethods
39
+ def execute(*args)
40
+ args, options = build_args(args)
41
+ ::EacRubyUtils::Envs.local.command(*args).execute(options)
42
+ end
37
43
 
38
- r = r.dirname
44
+ def command(*args)
45
+ args, _options = build_args(args)
46
+ ::EacRubyUtils::Envs.local.command(*args)
39
47
  end
40
- end
41
48
 
42
- private
49
+ def dirty?
50
+ dirty_files.any?
51
+ end
43
52
 
44
- def parse_status_line(line)
45
- m = /\A(.)(.)\s(.+)\z/.match(line)
46
- ::Kernel.raise "Status pattern does not match \"#{line}\"" unless m
47
- ::OpenStruct.new(index: m[1], worktree: m[2], path: m[3],
48
- absolute_path: ::File.expand_path(m[3], self))
53
+ def dirty_files
54
+ execute!('status', '--porcelain', '--untracked-files').each_line.map do |line|
55
+ parse_status_line(line.gsub(/\n\z/, ''))
56
+ end
57
+ end
58
+
59
+ # @return [Pathname]
60
+ def root_path
61
+ @root_path ||= self.class.find_root(to_s)
62
+ end
63
+
64
+ private
65
+
66
+ def parse_status_line(line)
67
+ m = /\A(.)(.)\s(.+)\z/.match(line)
68
+ ::Kernel.raise "Status pattern does not match \"#{line}\"" unless m
69
+ ::OpenStruct.new(index: m[1], worktree: m[2], path: m[3],
70
+ absolute_path: ::File.expand_path(m[3], self))
71
+ end
49
72
  end
50
73
  end
51
74
  end
@@ -30,7 +30,7 @@ module Avm
30
30
  end
31
31
 
32
32
  def git
33
- @git ||= ::EacLauncher::Git::Base.new(repository_path)
33
+ @git ||= ::EacLauncher::Git::Base.by_root(repository_path)
34
34
  end
35
35
  end
36
36
  end
@@ -33,7 +33,7 @@ module Avm
33
33
 
34
34
  def files_from_option
35
35
  r = options.fetch('<files>')
36
- r.any? ? r : nil
36
+ r.any? ? r.map { |p| p.to_pathname.expand_path } : nil
37
37
  end
38
38
 
39
39
  def dirty_files
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module Tools
5
- VERSION = '0.44.1'
5
+ VERSION = '0.44.2'
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.44.1
4
+ version: 0.44.2
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-11 00:00:00.000000000 Z
11
+ date: 2020-04-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aranha-parsers
@@ -98,14 +98,14 @@ dependencies:
98
98
  requirements:
99
99
  - - "~>"
100
100
  - !ruby/object:Gem::Version
101
- version: '0.22'
101
+ version: '0.30'
102
102
  type: :runtime
103
103
  prerelease: false
104
104
  version_requirements: !ruby/object:Gem::Requirement
105
105
  requirements:
106
106
  - - "~>"
107
107
  - !ruby/object:Gem::Version
108
- version: '0.22'
108
+ version: '0.30'
109
109
  - !ruby/object:Gem::Dependency
110
110
  name: filesize
111
111
  requirement: !ruby/object:Gem::Requirement