avm 0.3.2 → 0.4.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/app_src/base.rb +45 -0
- data/lib/avm/app_src/configuration/_locale.rb +16 -0
- data/lib/avm/app_src/configuration/_rubocop.rb +24 -0
- data/lib/avm/app_src/configuration/_tests.rb +27 -0
- data/lib/avm/app_src/configuration.rb +55 -0
- data/lib/avm/app_src.rb +9 -0
- data/lib/avm/files/formatter/formats/base.rb +2 -2
- data/lib/avm/files/formatter/formats/javascript.rb +1 -0
- data/lib/avm/files/formatter/formats/php.rb +1 -0
- data/lib/avm/files/formatter/formats/python.rb +1 -0
- data/lib/avm/files/formatter/formats/xml.rb +1 -0
- data/lib/avm/files/formatter/utf8_assert.rb +2 -2
- data/lib/avm/git/issue/complete/test.rb +2 -2
- data/lib/avm/git/revision_test.rb +2 -3
- data/lib/avm/jobs/base.rb +62 -0
- data/lib/avm/jobs/variables_source.rb +22 -0
- data/lib/avm/jobs.rb +9 -0
- data/lib/avm/version.rb +1 -1
- metadata +59 -3
- data/lib/avm/files/info.rb +0 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0a5a8832847c76afcae4e76ef3e8f7d1391d7cfb0b13788c3dc7273f9ef879f1
|
4
|
+
data.tar.gz: 0b89bd147edb92e0e3e4d158d16f0995ef41f0544a680beb053f9fa55b96a282
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a70af189af9aee66a693706ba031e5eb7c6d4c8533144099f325dfe2b88b9ef08daae16de8d2f09857f194816d653d3669527d6bc9c07d173566c9ab9121c3f6
|
7
|
+
data.tar.gz: d66a1741ec6295f54166a2007a4d168eddd4e7de30f538f87329067b580faf2572514d99302bb467e0b408dfe1a44dd54a9e4e2abaaed0292b3a7ba69bb02b95
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_git'
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
5
|
+
|
6
|
+
module Avm
|
7
|
+
module AppSrc
|
8
|
+
class Base
|
9
|
+
enable_simple_cache
|
10
|
+
enable_listable
|
11
|
+
lists.add_symbol :option, :parent
|
12
|
+
common_constructor :path, :options, default: [{}] do
|
13
|
+
self.path = path.to_pathname
|
14
|
+
self.options = self.class.lists.option.hash_keys_validate!(options)
|
15
|
+
end
|
16
|
+
|
17
|
+
delegate :to_s, to: :path
|
18
|
+
|
19
|
+
# @return [Avm::AppSrc::Base]
|
20
|
+
def parent
|
21
|
+
options[OPTION_PARENT]
|
22
|
+
end
|
23
|
+
|
24
|
+
# @return [Pathname]
|
25
|
+
def relative_path
|
26
|
+
return path if parent.blank?
|
27
|
+
|
28
|
+
path.relative_path_from(parent.path)
|
29
|
+
end
|
30
|
+
|
31
|
+
# @return [Enumerable<Avm::AppSrc::Base>]
|
32
|
+
def subs
|
33
|
+
git_repo.subrepos
|
34
|
+
.map { |subrepo| self.class.new(subrepo.subpath.expand_path(path), parent: self) }
|
35
|
+
end
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
# @return [EacGit::Local]
|
40
|
+
def git_repo_uncached
|
41
|
+
::EacGit::Local.new(path)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/patches/eac_ruby_gems_utils/gem'
|
4
|
+
require 'i18n'
|
5
|
+
|
6
|
+
module Avm
|
7
|
+
module AppSrc
|
8
|
+
class Configuration < ::EacConfig::OldConfigs
|
9
|
+
LOCALE_KEY = :locale
|
10
|
+
|
11
|
+
def locale
|
12
|
+
read_entry(LOCALE_KEY) || ::I18n.default_locale
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Avm
|
4
|
+
module AppSrc
|
5
|
+
class Configuration < ::EacConfig::OldConfigs
|
6
|
+
RUBOCOP_COMMAND_KEY = 'ruby.rubocop.command'
|
7
|
+
RUBOCOP_GEMFILE_KEY = 'ruby.rubocop.gemfile'
|
8
|
+
|
9
|
+
def rubocop_command
|
10
|
+
read_command(RUBOCOP_COMMAND_KEY)
|
11
|
+
end
|
12
|
+
|
13
|
+
def rubocop_gemfile
|
14
|
+
gemfile_path = read_entry(RUBOCOP_GEMFILE_KEY)
|
15
|
+
return nil if gemfile_path.blank?
|
16
|
+
|
17
|
+
gemfile_path = gemfile_path.to_pathname.expand_path(storage_path.parent)
|
18
|
+
return gemfile_path if gemfile_path.file?
|
19
|
+
|
20
|
+
raise "Gemfile path \"#{gemfile_path}\" does not exist or is not a file"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/patches/eac_ruby_gems_utils/gem'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module AppSrc
|
7
|
+
class Configuration < ::EacConfig::OldConfigs
|
8
|
+
BUNDLE_TEST_COMMAND_KEY = 'test.bundle_command'
|
9
|
+
TEST_COMMAND_KEY = 'test.command'
|
10
|
+
|
11
|
+
def any_test_command
|
12
|
+
bundle_test_command || test_command
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_command
|
16
|
+
read_command(TEST_COMMAND_KEY)
|
17
|
+
end
|
18
|
+
|
19
|
+
def bundle_test_command
|
20
|
+
read_entry(BUNDLE_TEST_COMMAND_KEY).if_present do |v|
|
21
|
+
args = v.is_a?(::Enumerable) ? v.map(&:to_s) : ::Shellwords.split(v)
|
22
|
+
::EacRubyGemsUtils::Gem.new(::File.dirname(storage_path)).bundle(*args).chdir_root
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_config/old_configs'
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
5
|
+
require 'yaml'
|
6
|
+
|
7
|
+
module Avm
|
8
|
+
module AppSrc
|
9
|
+
class Configuration < ::EacConfig::OldConfigs
|
10
|
+
require_sub __FILE__
|
11
|
+
|
12
|
+
FILENAMES = %w[.avm.yml .avm.yaml].freeze
|
13
|
+
|
14
|
+
class << self
|
15
|
+
def find_by_path(path)
|
16
|
+
path = ::Pathname.new(path.to_s) unless path.is_a?(::Pathname)
|
17
|
+
internal_find_path(path.expand_path)
|
18
|
+
end
|
19
|
+
|
20
|
+
def find_in_path(path)
|
21
|
+
absolute_pathname = path.to_pathname.expand_path
|
22
|
+
if absolute_pathname.directory?
|
23
|
+
FILENAMES.each do |filename|
|
24
|
+
file = absolute_pathname.join(filename)
|
25
|
+
return new(file) if file.exist?
|
26
|
+
end
|
27
|
+
end
|
28
|
+
nil
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def internal_find_path(absolute_pathname)
|
34
|
+
r = find_in_path(absolute_pathname)
|
35
|
+
return r if r.present?
|
36
|
+
|
37
|
+
internal_find_path(absolute_pathname.dirname) unless absolute_pathname.root?
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def initialize(path)
|
42
|
+
super(nil, storage_path: path)
|
43
|
+
end
|
44
|
+
|
45
|
+
# Utility to read a configuration as a [EacRubyUtils::Envs::Command].
|
46
|
+
# @return [EacRubyUtils::Envs::Command]
|
47
|
+
def read_command(key)
|
48
|
+
read_entry(key).if_present do |v|
|
49
|
+
args = v.is_a?(::Enumerable) ? v.map(&:to_s) : ::Shellwords.split(v)
|
50
|
+
::EacRubyUtils::Envs.local.command(args).chdir(::File.dirname(storage_path))
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
data/lib/avm/app_src.rb
ADDED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require '
|
3
|
+
require 'eac_fs/file_info'
|
4
4
|
require 'ostruct'
|
5
5
|
|
6
6
|
module Avm
|
@@ -50,7 +50,7 @@ module Avm
|
|
50
50
|
end
|
51
51
|
|
52
52
|
def match_by_type?(file)
|
53
|
-
info = ::
|
53
|
+
info = ::EacFs::FileInfo.new(file)
|
54
54
|
return unless info.content_type.type == 'text'
|
55
55
|
|
56
56
|
valid_types.include?(info.content_type.subtype)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require '
|
3
|
+
require 'eac_fs/file_info'
|
4
4
|
|
5
5
|
module Avm
|
6
6
|
module Files
|
@@ -39,7 +39,7 @@ module Avm
|
|
39
39
|
private
|
40
40
|
|
41
41
|
def original_info_uncached
|
42
|
-
::
|
42
|
+
::EacFs::FileInfo.new(path)
|
43
43
|
end
|
44
44
|
|
45
45
|
def original_charset_uncached
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'avm/
|
3
|
+
require 'avm/app_src/configuration'
|
4
4
|
require 'avm/result'
|
5
5
|
require 'eac_ruby_utils/fs/temp'
|
6
6
|
|
@@ -36,7 +36,7 @@ module Avm
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def configuration_uncached
|
39
|
-
::Avm::
|
39
|
+
::Avm::AppSrc::Configuration.find_by_path(@git)
|
40
40
|
end
|
41
41
|
end
|
42
42
|
end
|
@@ -1,6 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'avm/fs_cache'
|
4
3
|
require 'eac_ruby_utils/core_ext'
|
5
4
|
require 'eac_ruby_utils/ruby'
|
6
5
|
|
@@ -53,8 +52,8 @@ module Avm
|
|
53
52
|
end
|
54
53
|
|
55
54
|
def root_cache
|
56
|
-
|
57
|
-
|
55
|
+
fs_cache.child(git_absolute_path.parameterize, sha1,
|
56
|
+
options.fetch(:test_command).to_s.parameterize)
|
58
57
|
end
|
59
58
|
|
60
59
|
def run_test
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'avm/jobs/variables_source'
|
4
|
+
require 'eac_cli/core_ext'
|
5
|
+
|
6
|
+
module Avm
|
7
|
+
module Jobs
|
8
|
+
module Base
|
9
|
+
common_concern do
|
10
|
+
include ::ActiveSupport::Callbacks
|
11
|
+
|
12
|
+
enable_speaker
|
13
|
+
enable_simple_cache
|
14
|
+
enable_listable
|
15
|
+
common_constructor :instance, :options, default: [{}] do
|
16
|
+
if option_list.present?
|
17
|
+
self.options = option_list.hash_keys_validate!(options.symbolize_keys)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
define_callbacks(*jobs)
|
21
|
+
end
|
22
|
+
|
23
|
+
module ClassMethods
|
24
|
+
def jobs
|
25
|
+
const_get('JOBS').dup
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
module InstanceMethods
|
30
|
+
def option_list
|
31
|
+
nil
|
32
|
+
end
|
33
|
+
|
34
|
+
def run
|
35
|
+
start_banner if respond_to?(:start_banner)
|
36
|
+
run_jobs
|
37
|
+
::Avm::Result.success('Done!')
|
38
|
+
rescue ::Avm::Result::Error => e
|
39
|
+
e.to_result
|
40
|
+
end
|
41
|
+
|
42
|
+
def variables_source
|
43
|
+
::Avm::Jobs::VariablesSource.new(self, instance)
|
44
|
+
end
|
45
|
+
|
46
|
+
protected
|
47
|
+
|
48
|
+
def run_jobs
|
49
|
+
jobs.each do |job|
|
50
|
+
run_callbacks job do
|
51
|
+
send(job)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def jobs
|
57
|
+
self.class.jobs
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module Avm
|
6
|
+
module Jobs
|
7
|
+
class VariablesSource
|
8
|
+
common_constructor :job, :instance
|
9
|
+
|
10
|
+
def read_entry(path, options = {})
|
11
|
+
entry_from_job(path) || instance.read_entry(path, options)
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def entry_from_job(path)
|
17
|
+
method = path.gsub('.', '_').underscore
|
18
|
+
return job.send(method) if job.respond_to?(method, true)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/lib/avm/jobs.rb
ADDED
data/lib/avm/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: avm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eduardo H. Bogoni
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-09-
|
11
|
+
date: 2021-09-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: eac_docker
|
@@ -72,6 +72,54 @@ dependencies:
|
|
72
72
|
- - ">="
|
73
73
|
- !ruby/object:Gem::Version
|
74
74
|
version: 0.1.1
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: filesize
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - "~>"
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '0.2'
|
82
|
+
type: :runtime
|
83
|
+
prerelease: false
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - "~>"
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0.2'
|
89
|
+
- !ruby/object:Gem::Dependency
|
90
|
+
name: htmlbeautifier
|
91
|
+
requirement: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - "~>"
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '1.3'
|
96
|
+
- - ">="
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: 1.3.1
|
99
|
+
type: :runtime
|
100
|
+
prerelease: false
|
101
|
+
version_requirements: !ruby/object:Gem::Requirement
|
102
|
+
requirements:
|
103
|
+
- - "~>"
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: '1.3'
|
106
|
+
- - ">="
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: 1.3.1
|
109
|
+
- !ruby/object:Gem::Dependency
|
110
|
+
name: minitar
|
111
|
+
requirement: !ruby/object:Gem::Requirement
|
112
|
+
requirements:
|
113
|
+
- - "~>"
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
version: '0.9'
|
116
|
+
type: :runtime
|
117
|
+
prerelease: false
|
118
|
+
version_requirements: !ruby/object:Gem::Requirement
|
119
|
+
requirements:
|
120
|
+
- - "~>"
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: '0.9'
|
75
123
|
- !ruby/object:Gem::Dependency
|
76
124
|
name: aranha-parsers
|
77
125
|
requirement: !ruby/object:Gem::Requirement
|
@@ -113,6 +161,12 @@ extensions: []
|
|
113
161
|
extra_rdoc_files: []
|
114
162
|
files:
|
115
163
|
- lib/avm.rb
|
164
|
+
- lib/avm/app_src.rb
|
165
|
+
- lib/avm/app_src/base.rb
|
166
|
+
- lib/avm/app_src/configuration.rb
|
167
|
+
- lib/avm/app_src/configuration/_locale.rb
|
168
|
+
- lib/avm/app_src/configuration/_rubocop.rb
|
169
|
+
- lib/avm/app_src/configuration/_tests.rb
|
116
170
|
- lib/avm/docker.rb
|
117
171
|
- lib/avm/docker/container.rb
|
118
172
|
- lib/avm/docker/image.rb
|
@@ -139,7 +193,6 @@ files:
|
|
139
193
|
- lib/avm/files/formatter/formats/ruby.rb
|
140
194
|
- lib/avm/files/formatter/formats/xml.rb
|
141
195
|
- lib/avm/files/formatter/utf8_assert.rb
|
142
|
-
- lib/avm/files/info.rb
|
143
196
|
- lib/avm/files/rotate.rb
|
144
197
|
- lib/avm/git.rb
|
145
198
|
- lib/avm/git/auto_commit/commit_info.rb
|
@@ -183,6 +236,9 @@ files:
|
|
183
236
|
- lib/avm/git/subrepo_check/show_result.rb
|
184
237
|
- lib/avm/git/subrepo_checks.rb
|
185
238
|
- lib/avm/instances/docker_image.rb
|
239
|
+
- lib/avm/jobs.rb
|
240
|
+
- lib/avm/jobs/base.rb
|
241
|
+
- lib/avm/jobs/variables_source.rb
|
186
242
|
- lib/avm/result.rb
|
187
243
|
- lib/avm/version.rb
|
188
244
|
- lib/avm/version_number.rb
|
data/lib/avm/files/info.rb
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'avm/executables'
|
4
|
-
require 'eac_ruby_utils/core_ext'
|
5
|
-
require 'content-type'
|
6
|
-
|
7
|
-
module Avm
|
8
|
-
module Files
|
9
|
-
class Info
|
10
|
-
enable_simple_cache
|
11
|
-
common_constructor :path
|
12
|
-
|
13
|
-
private
|
14
|
-
|
15
|
-
def content_type_uncached
|
16
|
-
::ContentType.parse(
|
17
|
-
::Avm::Executables.file.command.append(['-ib', path]).execute!.strip
|
18
|
-
)
|
19
|
-
rescue Parslet::ParseFailed
|
20
|
-
::ContentType.parse('application/unknown')
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|