avm-tools 0.139.0 → 0.141.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/projects/stereotypes/git/publish.rb +2 -2
- data/lib/avm/projects/stereotypes/git/warp.rb +2 -2
- data/lib/avm/projects/stereotypes/git.rb +2 -2
- data/lib/avm/projects/stereotypes/git_subrepo/publish.rb +2 -2
- data/lib/avm/projects/stereotypes/git_subrepo/warp.rb +7 -7
- data/lib/avm/projects/stereotypes/git_subrepo.rb +4 -4
- data/lib/avm/projects/stereotypes/git_subtree/publish.rb +2 -2
- data/lib/avm/projects/stereotypes/git_subtree/warp.rb +4 -4
- data/lib/avm/projects/stereotypes/git_subtree.rb +3 -3
- data/lib/avm/projects/stereotypes/ruby_gem/publish.rb +2 -2
- data/lib/avm/projects/stereotypes/ruby_gem.rb +4 -4
- data/lib/avm/projects/stereotypes.rb +0 -9
- data/lib/avm/tools/core_ext.rb +0 -1
- data/lib/avm/tools/runner/files/format.rb +2 -2
- data/lib/avm/tools/runner/git/commit.rb +2 -2
- data/lib/avm/tools/runner/git/deploy.rb +2 -2
- data/lib/avm/tools/runner/git.rb +2 -2
- data/lib/avm/tools/runner/launcher.rb +1 -0
- data/lib/avm/tools/runner/source/info.rb +0 -4
- data/lib/avm/tools/runner/source/test.rb +1 -1
- data/lib/avm/tools/runner/source.rb +0 -12
- data/lib/avm/tools/version.rb +1 -1
- metadata +8 -40
- data/lib/avm/launcher/git/base/class_methods.rb +0 -28
- data/lib/avm/launcher/git/base/dirty_files.rb +0 -23
- data/lib/avm/launcher/git/base/remotes.rb +0 -40
- data/lib/avm/launcher/git/base/subrepo.rb +0 -44
- data/lib/avm/launcher/git/base/underlying.rb +0 -63
- data/lib/avm/launcher/git/base.rb +0 -86
- data/lib/avm/launcher/git/error.rb +0 -13
- data/lib/avm/launcher/git/mirror_update.rb +0 -38
- data/lib/avm/launcher/git/publish_base.rb +0 -125
- data/lib/avm/launcher/git/remote.rb +0 -55
- data/lib/avm/launcher/git/sub_warp_base.rb +0 -33
- data/lib/avm/launcher/git/warp_base.rb +0 -67
- data/lib/avm/launcher/git.rb +0 -7
- data/lib/avm/launcher/instances.rb +0 -6
- data/lib/avm/launcher/paths.rb +0 -4
- data/lib/avm/launcher/project.rb +0 -18
- data/lib/avm/launcher/publish.rb +0 -4
- data/lib/avm/launcher/ruby/gem/build.rb +0 -125
- data/lib/avm/launcher/ruby/gem/specification.rb +0 -63
- data/lib/avm/launcher/ruby/gem.rb +0 -4
- data/lib/avm/launcher/ruby.rb +0 -3
- data/lib/avm/patches/i18n.rb +0 -22
- data/lib/avm/patches.rb +0 -9
- data/lib/avm/projects/stereotype/job_comparator.rb +0 -32
- data/lib/avm/projects/stereotype.rb +0 -63
- data/lib/avm/projects/stereotypes/rails_application/local_project_mixin.rb +0 -18
- data/lib/avm/projects/stereotypes/rails_application.rb +0 -25
- data/lib/avm/projects/stereotypes/redmine_plugin.rb +0 -23
- data/lib/avm/stereotypes.rb +0 -9
- data/lib/avm/tools/source.rb +0 -64
- data/locale/en.yml +0 -7
- data/locale/pt-BR.yml +0 -7
@@ -1,125 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'tmpdir'
|
4
|
-
require 'eac_cli/speaker'
|
5
|
-
require 'eac_ruby_utils/envs'
|
6
|
-
require 'avm/launcher/ruby/gem/specification'
|
7
|
-
|
8
|
-
module Avm
|
9
|
-
module Launcher
|
10
|
-
module Ruby
|
11
|
-
module Gem
|
12
|
-
class Build
|
13
|
-
enable_speaker
|
14
|
-
|
15
|
-
def initialize(original_gem_root)
|
16
|
-
@original_gem_root = original_gem_root
|
17
|
-
end
|
18
|
-
|
19
|
-
def output_file
|
20
|
-
return nil unless @gem_root
|
21
|
-
|
22
|
-
@gem_root.find_files_with_extension('.gem').first
|
23
|
-
end
|
24
|
-
|
25
|
-
def builded?
|
26
|
-
output_file.present? && ::File.exist?(output_file)
|
27
|
-
end
|
28
|
-
|
29
|
-
def build
|
30
|
-
return if builded?
|
31
|
-
|
32
|
-
copy_gem_files
|
33
|
-
build_gem
|
34
|
-
check_gem_empty_size
|
35
|
-
check_gem_version
|
36
|
-
end
|
37
|
-
|
38
|
-
def close
|
39
|
-
::FileUtils.remove_entry(@gem_root) if @gem_root && ::File.directory?(@gem_root)
|
40
|
-
@gem_root = nil
|
41
|
-
end
|
42
|
-
|
43
|
-
private
|
44
|
-
|
45
|
-
def copy_gem_files
|
46
|
-
@gem_root = ::Avm::Launcher::Paths::Real.new(::Dir.mktmpdir)
|
47
|
-
FileUtils.cp_r "#{@original_gem_root}/.", @gem_root
|
48
|
-
end
|
49
|
-
|
50
|
-
def build_gem
|
51
|
-
info("Building gemspec #{gemspec_file}...")
|
52
|
-
clear_gems
|
53
|
-
Dir.chdir @gem_root do
|
54
|
-
isolated_build_gem
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
def isolated_build_gem
|
59
|
-
on_clean_ruby do
|
60
|
-
EacRubyUtils::Envs.local.command('gem', 'build', gemspec_file).execute!
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
def check_gem_empty_size
|
65
|
-
Dir.mktmpdir do |dir|
|
66
|
-
Dir.chdir dir do
|
67
|
-
EacRubyUtils::Envs.local.command('gem', 'unpack', gem).system
|
68
|
-
gs = File.join(dir, File.basename(gem, '.gem'))
|
69
|
-
if (Dir.entries(gs) - %w[. ..]).empty?
|
70
|
-
raise "\"#{dir}\" (Unpacked from #{gem}) has no source code"
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
def clear_gems
|
77
|
-
@gem_root.find_files_with_extension('.gem').each do |f|
|
78
|
-
FileUtils.rm_rf(f)
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
def gemspec_file
|
83
|
-
@gem_root.find_file_with_extension('.gemspec')
|
84
|
-
end
|
85
|
-
|
86
|
-
def gem
|
87
|
-
@gem_root.find_file_with_extension('.gem')
|
88
|
-
end
|
89
|
-
|
90
|
-
def check_gem_version
|
91
|
-
spec = ::Avm::Launcher::Ruby::Gem::Specification.new(gemspec_file)
|
92
|
-
return if ::File.basename(output_file, '.gem') == spec.full_name
|
93
|
-
|
94
|
-
raise("Builded gem is not the same version of gemspec (#{spec}, #{output_file})")
|
95
|
-
end
|
96
|
-
|
97
|
-
def bundle_dependencies
|
98
|
-
gemfile = @gem_root.subpath('Gemfile')
|
99
|
-
return unless ::File.exist?(gemfile)
|
100
|
-
|
101
|
-
Dir.chdir(@gem_root) do
|
102
|
-
EacRubyUtils::Envs.local.command('bundle', 'install').execute!
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
|
-
def on_clean_ruby
|
107
|
-
on_clear_envvars('BUNDLE', 'RUBY') { yield }
|
108
|
-
end
|
109
|
-
|
110
|
-
def on_clear_envvars(*start_with_vars)
|
111
|
-
old_values = envvars_starting_with(start_with_vars)
|
112
|
-
old_values.each_key { |k| ENV.delete(k) }
|
113
|
-
yield
|
114
|
-
ensure
|
115
|
-
old_values&.each { |k, v| ENV[k] = v }
|
116
|
-
end
|
117
|
-
|
118
|
-
def envvars_starting_with(start_with_vars)
|
119
|
-
ENV.select { |k, _v| start_with_vars.any? { |var| k.start_with?(var) } }
|
120
|
-
end
|
121
|
-
end
|
122
|
-
end
|
123
|
-
end
|
124
|
-
end
|
125
|
-
end
|
@@ -1,63 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'active_support/core_ext/object'
|
4
|
-
|
5
|
-
module Avm
|
6
|
-
module Launcher
|
7
|
-
module Ruby
|
8
|
-
module Gem
|
9
|
-
class Specification
|
10
|
-
class << self
|
11
|
-
def parse_version_file(file)
|
12
|
-
s = ::File.read(file)
|
13
|
-
m = /VERSION\s*=\s*[\'\"]([^\'\"]+)[\'\"]/.match(s)
|
14
|
-
m ? m[1] : nil
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
attr_reader :gemspec_file
|
19
|
-
|
20
|
-
def initialize(gemspec_file)
|
21
|
-
@gemspec_file = gemspec_file
|
22
|
-
end
|
23
|
-
|
24
|
-
def version
|
25
|
-
v = self.class.parse_version_file(version_file)
|
26
|
-
return v if v.present?
|
27
|
-
|
28
|
-
raise "Version not found on file \"#{version_file}\""
|
29
|
-
end
|
30
|
-
|
31
|
-
def name
|
32
|
-
::File.basename(gemspec_file).gsub(/\.gemspec\z/, '')
|
33
|
-
end
|
34
|
-
|
35
|
-
def full_name
|
36
|
-
"#{name}-#{version}"
|
37
|
-
end
|
38
|
-
|
39
|
-
def to_s
|
40
|
-
full_name
|
41
|
-
end
|
42
|
-
|
43
|
-
private
|
44
|
-
|
45
|
-
def gem_root
|
46
|
-
::File.dirname(gemspec_file)
|
47
|
-
end
|
48
|
-
|
49
|
-
def version_file
|
50
|
-
f = ::File.join(gem_root, 'lib', *namespace_parts, 'version.rb')
|
51
|
-
return f if ::File.exist?(f)
|
52
|
-
|
53
|
-
raise "Version file \"#{f}\" does not exist"
|
54
|
-
end
|
55
|
-
|
56
|
-
def namespace_parts
|
57
|
-
name.split('-')
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
data/lib/avm/launcher/ruby.rb
DELETED
data/lib/avm/patches/i18n.rb
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'avm/tools/self'
|
4
|
-
require 'i18n'
|
5
|
-
|
6
|
-
module Avm
|
7
|
-
module Patches
|
8
|
-
module I18n
|
9
|
-
class << self
|
10
|
-
def setup_i18n
|
11
|
-
::I18n.load_path += locale_files_paths.map(&:to_path)
|
12
|
-
end
|
13
|
-
|
14
|
-
def locale_files_paths
|
15
|
-
::Avm::Tools::Self.root.join('locale').glob('*.yml')
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
::Avm::Patches::I18n.setup_i18n
|
data/lib/avm/patches.rb
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'eac_ruby_utils/core_ext'
|
4
|
-
|
5
|
-
module Avm
|
6
|
-
module Projects
|
7
|
-
module Stereotype
|
8
|
-
class JobComparator
|
9
|
-
common_constructor :job1, :job2
|
10
|
-
|
11
|
-
def result
|
12
|
-
return -1 if run_before?(job1, job2)
|
13
|
-
return 1 if run_before?(job2, job1)
|
14
|
-
|
15
|
-
job1.object_id <=> job2.class.name
|
16
|
-
end
|
17
|
-
|
18
|
-
private
|
19
|
-
|
20
|
-
def run_before?(a_job, other_job)
|
21
|
-
return false unless a_job.respond_to?(:run_before)
|
22
|
-
|
23
|
-
a_job.run_before.map(&:to_sym).include?(job_stereotype_key(other_job))
|
24
|
-
end
|
25
|
-
|
26
|
-
def job_stereotype_key(job)
|
27
|
-
job.class.name.split('::')[0..-2].join('::').demodulize.variableize.to_sym
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
@@ -1,63 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'active_support/core_ext/string/inflections'
|
4
|
-
require 'colorized_string'
|
5
|
-
|
6
|
-
module Avm
|
7
|
-
module Projects
|
8
|
-
module Stereotype
|
9
|
-
class << self
|
10
|
-
attr_reader :stereotypes
|
11
|
-
|
12
|
-
def included(base)
|
13
|
-
@stereotypes ||= []
|
14
|
-
@stereotypes << base
|
15
|
-
base.extend(ClassMethods)
|
16
|
-
end
|
17
|
-
|
18
|
-
def git_stereotypes
|
19
|
-
stereotypes.select { |c| c.name.demodulize.downcase.match('git') }
|
20
|
-
end
|
21
|
-
|
22
|
-
def nogit_stereotypes
|
23
|
-
stereotypes - git_stereotypes
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
module ClassMethods
|
28
|
-
def label
|
29
|
-
::ColorizedString.new(stereotype_name).send(color)
|
30
|
-
end
|
31
|
-
|
32
|
-
def stereotype_name
|
33
|
-
name.demodulize
|
34
|
-
end
|
35
|
-
|
36
|
-
{
|
37
|
-
local_project_mixin: ::Module,
|
38
|
-
publish: ::Class,
|
39
|
-
update: ::Class,
|
40
|
-
version_bump: ::Class,
|
41
|
-
warp: ::Class
|
42
|
-
}.each do |name, is_a|
|
43
|
-
define_method "#{name}_#{is_a.name.underscore}" do
|
44
|
-
sub_constant(name.to_s.camelcase, is_a)
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
private
|
49
|
-
|
50
|
-
def sub_constant(constant_name, is_a)
|
51
|
-
return nil unless const_defined?(constant_name)
|
52
|
-
|
53
|
-
constant = const_get(constant_name)
|
54
|
-
unless is_a.if_present(true) { |v| constant.is_a?(v) }
|
55
|
-
raise("#{constant} is not a #{is_a}")
|
56
|
-
end
|
57
|
-
|
58
|
-
constant
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'avm/projects/stereotypes/ruby_gem/local_project_mixin'
|
4
|
-
require 'eac_ruby_utils/core_ext'
|
5
|
-
|
6
|
-
module Avm
|
7
|
-
module Projects
|
8
|
-
module Stereotypes
|
9
|
-
class RailsApplication
|
10
|
-
module LocalProjectMixin
|
11
|
-
common_concern do
|
12
|
-
include ::Avm::Projects::Stereotypes::RubyGem::LocalProjectMixin
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'avm/projects/stereotype'
|
4
|
-
require 'eac_ruby_utils/core_ext'
|
5
|
-
|
6
|
-
module Avm
|
7
|
-
module Projects
|
8
|
-
module Stereotypes
|
9
|
-
class RailsApplication
|
10
|
-
require_sub __FILE__
|
11
|
-
include Avm::Projects::Stereotype
|
12
|
-
|
13
|
-
class << self
|
14
|
-
def match?(path)
|
15
|
-
File.exist?(path.real.subpath('config.ru')) && path.real.basename != 'dummy'
|
16
|
-
end
|
17
|
-
|
18
|
-
def color
|
19
|
-
:magenta
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'avm/projects/stereotype'
|
4
|
-
|
5
|
-
module Avm
|
6
|
-
module Projects
|
7
|
-
module Stereotypes
|
8
|
-
class RedminePlugin
|
9
|
-
include Avm::Projects::Stereotype
|
10
|
-
|
11
|
-
class << self
|
12
|
-
def match?(path)
|
13
|
-
File.exist?(path.real.subpath('init.rb'))
|
14
|
-
end
|
15
|
-
|
16
|
-
def color
|
17
|
-
:light_magenta
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
data/lib/avm/stereotypes.rb
DELETED
data/lib/avm/tools/source.rb
DELETED
@@ -1,64 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'avm/registry'
|
4
|
-
require 'avm/sources/configuration'
|
5
|
-
require 'avm/launcher/paths/real'
|
6
|
-
require 'avm/projects/stereotype/job_comparator'
|
7
|
-
require 'eac_ruby_utils/core_ext'
|
8
|
-
require 'avm/projects/stereotypes'
|
9
|
-
require 'i18n'
|
10
|
-
|
11
|
-
module Avm
|
12
|
-
module Tools
|
13
|
-
class Source
|
14
|
-
enable_simple_cache
|
15
|
-
common_constructor :path do
|
16
|
-
self.path = path.to_pathname
|
17
|
-
source_stereotypes_mixins
|
18
|
-
end
|
19
|
-
|
20
|
-
delegate :configuration, to: :avm_instance
|
21
|
-
delegate :to_s, to: :path
|
22
|
-
|
23
|
-
def locale
|
24
|
-
configuration.if_present(&:locale) || ::I18n.default_locale
|
25
|
-
end
|
26
|
-
|
27
|
-
# Backward compatibility with [Avm::Launcher::Paths::Logical].
|
28
|
-
# @return [Avm::Launcher::Paths::Real].
|
29
|
-
def real
|
30
|
-
::Avm::Launcher::Paths::Real.new(path.to_path)
|
31
|
-
end
|
32
|
-
|
33
|
-
def run_job(job, job_args = [])
|
34
|
-
stereotypes_jobs(job, job_args).each(&:run)
|
35
|
-
end
|
36
|
-
|
37
|
-
private
|
38
|
-
|
39
|
-
def avm_instance_uncached
|
40
|
-
::Avm::Registry.sources.detect(path)
|
41
|
-
end
|
42
|
-
|
43
|
-
def stereotypes_jobs(job, job_args)
|
44
|
-
job_class_method = "#{job}_class"
|
45
|
-
r = []
|
46
|
-
stereotypes.each do |stereotype|
|
47
|
-
r << stereotype.send(job_class_method).new(self, *job_args) if
|
48
|
-
stereotype.send(job_class_method).present?
|
49
|
-
end
|
50
|
-
r.sort { |a, b| ::Avm::Projects::Stereotype::JobComparator.new(a, b).result }
|
51
|
-
end
|
52
|
-
|
53
|
-
def stereotypes_uncached
|
54
|
-
::Avm::Projects::Stereotypes.list.select { |s| s.match?(self) }
|
55
|
-
end
|
56
|
-
|
57
|
-
def source_stereotypes_mixins
|
58
|
-
stereotypes.each do |s|
|
59
|
-
s.local_project_mixin_module.if_present { |v| singleton_class.include(v) }
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
data/locale/en.yml
DELETED