avm-eac_ruby_base1 0.33.2 → 0.34.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/avm/eac_ruby_base1/file_formats/base.rb +1 -1
- data/lib/avm/eac_ruby_base1/launcher_stereotypes/base/publish.rb +10 -10
- data/lib/avm/eac_ruby_base1/rubygems/remote.rb +36 -0
- data/lib/avm/eac_ruby_base1/source_generators/base/dependencies.rb +40 -4
- data/lib/avm/eac_ruby_base1/source_generators/base/options.rb +8 -3
- data/lib/avm/eac_ruby_base1/source_generators/base/version_builder.rb +13 -3
- data/lib/avm/eac_ruby_base1/source_generators/base.rb +38 -37
- data/lib/avm/eac_ruby_base1/sources/gemfile_local/sibling.rb +1 -1
- data/lib/avm/eac_ruby_base1/version.rb +1 -1
- data/template/avm/eac_ruby_base1/source_generators/base/gemspec.template +4 -4
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ba1b2ccbba6af68c7a620b57f52799eab587b01c612b4a469bbd755e0506652b
|
4
|
+
data.tar.gz: dc698a77abe634b26197ceb28241a15988d99c45bcd2d130c3b3a60ed2e2507d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6203de727473926431355e4e945198b91a3566163649ed1fda516a0f8be0f273aab3de661cc7bc782cdafa457d2bae10e801fa60f99924a2327870f7244cd80b
|
7
|
+
data.tar.gz: 5fdf7b83ea6cb8c8113cb84357d3c8a571f539aed4bc6d9cbfb2a1f0114d368a8e01cc7fb4d87192b1c147a9a9dc2e9a6bb22b15d2a393c4b177d8a7d512ba78
|
@@ -3,11 +3,10 @@
|
|
3
3
|
require 'eac_ruby_utils/simple_cache'
|
4
4
|
require 'rubygems'
|
5
5
|
require 'eac_cli/speaker'
|
6
|
+
require 'avm/eac_ruby_base1/rubygems/remote'
|
6
7
|
require 'avm/launcher/publish/base'
|
7
8
|
require 'avm/launcher/publish/check_result'
|
8
9
|
require 'avm/eac_ruby_base1/launcher/gem'
|
9
|
-
require 'eac_envs/http/request'
|
10
|
-
require 'eac_envs/http/response'
|
11
10
|
|
12
11
|
module Avm
|
13
12
|
module EacRubyBase1
|
@@ -98,16 +97,17 @@ module Avm
|
|
98
97
|
end
|
99
98
|
|
100
99
|
# @return [Array]
|
101
|
-
def
|
102
|
-
|
103
|
-
.url("https://rubygems.org/api/v1/versions/#{gem_spec.name}.json")
|
104
|
-
.response.body_data_or_raise
|
105
|
-
rescue EacEnvs::Http::Response => e
|
106
|
-
e.status == 404 ? [] : raise(e)
|
100
|
+
def gem_versions
|
101
|
+
remote_gem.versions
|
107
102
|
end
|
108
103
|
|
109
|
-
def
|
110
|
-
|
104
|
+
def gem_version_max
|
105
|
+
remote_gem.maximum_number
|
106
|
+
end
|
107
|
+
|
108
|
+
# @return [Avm::EacRubyBase1::Rubygems::Remote]
|
109
|
+
def remote_gem_uncached
|
110
|
+
::Avm::EacRubyBase1::Rubygems::Remote.new(gem_spec.name)
|
111
111
|
end
|
112
112
|
|
113
113
|
def push_gem
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
require 'eac_envs/http/request'
|
5
|
+
|
6
|
+
module Avm
|
7
|
+
module EacRubyBase1
|
8
|
+
module Rubygems
|
9
|
+
class Remote
|
10
|
+
enable_simple_cache
|
11
|
+
common_constructor :name
|
12
|
+
|
13
|
+
# @return [Gem::Version, nil]
|
14
|
+
def maximum_number
|
15
|
+
numbers.max.if_present { |v| ::Gem::Version.new(v) }
|
16
|
+
end
|
17
|
+
|
18
|
+
# @return [Array<Gem::Version>]
|
19
|
+
def numbers
|
20
|
+
versions.map { |v| ::Gem::Version.new(v.fetch('number')) }
|
21
|
+
end
|
22
|
+
|
23
|
+
protected
|
24
|
+
|
25
|
+
# @return [Array<Hash>]
|
26
|
+
def versions_uncached
|
27
|
+
::EacEnvs::Http::Request.new
|
28
|
+
.url("https://rubygems.org/api/v1/versions/#{name}.json")
|
29
|
+
.response.body_data_or_raise
|
30
|
+
rescue EacEnvs::Http::Response => e
|
31
|
+
e.status == 404 ? [] : raise(e)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -9,17 +9,53 @@ module Avm
|
|
9
9
|
module SourceGenerators
|
10
10
|
class Base < ::Avm::SourceGenerators::Base
|
11
11
|
module Dependencies
|
12
|
-
|
13
|
-
|
12
|
+
common_concern
|
13
|
+
|
14
|
+
COMMON_DEPENDENCY_GEMS = %w[eac_ruby_utils].freeze
|
15
|
+
DEVELOPMENT_DEPENDENCY_GEMS = %w[eac_ruby_gem_support].freeze
|
16
|
+
|
17
|
+
module ClassMethods
|
18
|
+
# @return [Array<String>]
|
19
|
+
def common_dependency_gems
|
20
|
+
COMMON_DEPENDENCY_GEMS
|
21
|
+
end
|
22
|
+
|
23
|
+
# @return [Array<String>]
|
24
|
+
def development_dependency_gems
|
25
|
+
DEVELOPMENT_DEPENDENCY_GEMS
|
26
|
+
end
|
14
27
|
end
|
15
28
|
|
16
|
-
|
17
|
-
|
29
|
+
# @return [String]
|
30
|
+
def common_dependencies
|
31
|
+
dependencies_section(:common_dependency_gems, '')
|
18
32
|
end
|
19
33
|
|
20
34
|
def dependency_version(gem_name)
|
21
35
|
::Avm::EacRubyBase1::SourceGenerators::Base::VersionBuilder.new(gem_name, options).to_s
|
22
36
|
end
|
37
|
+
|
38
|
+
# @return [String]
|
39
|
+
def development_dependencies
|
40
|
+
dependencies_section(:development_dependency_gems, 'development_')
|
41
|
+
end
|
42
|
+
|
43
|
+
protected
|
44
|
+
|
45
|
+
# @param gem_name [String]
|
46
|
+
# @param prefix [String]
|
47
|
+
# @return [String]
|
48
|
+
def dependency_line(gem_name, prefix)
|
49
|
+
"#{IDENT}s.add_#{prefix}dependency '#{gem_name}', #{dependency_version(gem_name)}\n"
|
50
|
+
end
|
51
|
+
|
52
|
+
# @param setting_key [Symbol]
|
53
|
+
# @param prefix [String]
|
54
|
+
# @return [String]
|
55
|
+
def dependencies_section(gems_method, prefix)
|
56
|
+
self.class.send(gems_method).sort.map { |gem_name| dependency_line(gem_name, prefix) }
|
57
|
+
.join.rstrip
|
58
|
+
end
|
23
59
|
end
|
24
60
|
end
|
25
61
|
end
|
@@ -13,14 +13,19 @@ module Avm
|
|
13
13
|
GEMFILE_LOCK_OPTION = :'gemfile-lock'
|
14
14
|
|
15
15
|
OPTIONS = {
|
16
|
-
:'eac-ruby-utils-version' => 'Version for "eac_ruby_utils" gem.',
|
17
|
-
:'eac-ruby-gem-support-version' => 'Version for "eac_ruby_gem_support" gem.',
|
18
16
|
GEMFILE_LOCK_OPTION => 'Run "bundle install" at the end'
|
19
17
|
}.freeze
|
20
18
|
|
21
19
|
module ClassMethods
|
22
20
|
def option_list
|
23
|
-
OPTIONS.inject(super) { |a, e| a.option(*e) }
|
21
|
+
OPTIONS.merge(dependency_version_options).inject(super) { |a, e| a.option(*e) }
|
22
|
+
end
|
23
|
+
|
24
|
+
# @return [Hash<Symbol, String>]
|
25
|
+
def dependency_version_options
|
26
|
+
(common_dependency_gems + development_dependency_gems).sort.to_h do |gem_name|
|
27
|
+
["#{gem_name}_version".dasherize.to_sym, "Version for \"#{gem_name}\" gem."]
|
28
|
+
end
|
24
29
|
end
|
25
30
|
end
|
26
31
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'avm/source_generators/base'
|
4
|
+
require 'avm/eac_ruby_base1/rubygems/remote'
|
4
5
|
require 'eac_ruby_utils/core_ext'
|
5
6
|
|
6
7
|
module Avm
|
@@ -19,7 +20,7 @@ module Avm
|
|
19
20
|
|
20
21
|
# @return [Gem::Version]
|
21
22
|
def version
|
22
|
-
options_version ||
|
23
|
+
options_version || loaded_version || maximum_version
|
23
24
|
end
|
24
25
|
|
25
26
|
def two_segments
|
@@ -32,12 +33,21 @@ module Avm
|
|
32
33
|
|
33
34
|
private
|
34
35
|
|
36
|
+
# @return [Gem::Version]
|
37
|
+
def maximum_version
|
38
|
+
r = ::Avm::EacRubyBase1::Rubygems::Remote.new(gem_name).maximum_number
|
39
|
+
return ::Gem::Version.new(r) if r.present?
|
40
|
+
|
41
|
+
raise "None version found for gem \"#{gem_name}\""
|
42
|
+
end
|
43
|
+
|
35
44
|
def segments_uncached
|
36
45
|
version.release.to_s.split('.').map(&:to_i)
|
37
46
|
end
|
38
47
|
|
39
|
-
|
40
|
-
|
48
|
+
# @return [Gem::Version, nil]
|
49
|
+
def loaded_version
|
50
|
+
::Gem.loaded_specs[gem_name].if_present(&:version)
|
41
51
|
end
|
42
52
|
|
43
53
|
def options_version
|
@@ -9,33 +9,49 @@ module Avm
|
|
9
9
|
module EacRubyBase1
|
10
10
|
module SourceGenerators
|
11
11
|
class Base < ::Avm::SourceGenerators::Base
|
12
|
+
GEMSPEC_FILES_DIRECTORY_PATHS = %w[lib].freeze
|
13
|
+
GEMSPEC_FILES_FILE_PATHS = [].freeze
|
12
14
|
IDENT = ' '
|
13
|
-
JOBS = %w[
|
15
|
+
JOBS = %w[gemspec root_lib version_lib gemfile_lock].freeze
|
14
16
|
TEMPLATE_VARIABLES = %w[lib_path name root_module].freeze
|
15
17
|
|
16
18
|
enable_speaker
|
17
19
|
enable_simple_cache
|
18
20
|
require_sub __FILE__, include_modules: true
|
19
21
|
|
20
|
-
|
21
|
-
|
22
|
+
# @return [String]
|
23
|
+
def gemspec_extra
|
24
|
+
gemspec_extra_lines.map { |line| "\n#{IDENT}#{line}" }.join
|
22
25
|
end
|
23
26
|
|
24
|
-
|
25
|
-
|
27
|
+
# @return [Array<String>]
|
28
|
+
def gemspec_extra_lines
|
29
|
+
[]
|
26
30
|
end
|
27
31
|
|
28
|
-
|
29
|
-
|
32
|
+
# @return [String]
|
33
|
+
def gemspec_files_value
|
34
|
+
"Dir[#{gemspec_files_paths.map { |path| "'#{path}'" }.join(', ')}]"
|
30
35
|
end
|
31
36
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
37
|
+
# @return [Array<String>]
|
38
|
+
def gemspec_files_paths
|
39
|
+
["{#{gemspec_files_directory_paths.sort.join(',')}}/**/*"] +
|
40
|
+
gemspec_files_file_paths.sort
|
41
|
+
end
|
42
|
+
|
43
|
+
# @return [Array<String>]
|
44
|
+
def gemspec_files_directory_paths
|
45
|
+
GEMSPEC_FILES_DIRECTORY_PATHS
|
46
|
+
end
|
47
|
+
|
48
|
+
# @return [Array<String>]
|
49
|
+
def gemspec_files_file_paths
|
50
|
+
GEMSPEC_FILES_FILE_PATHS
|
51
|
+
end
|
52
|
+
|
53
|
+
def lib_path
|
54
|
+
name.split('-').join('/')
|
39
55
|
end
|
40
56
|
|
41
57
|
def root_module
|
@@ -64,46 +80,31 @@ module Avm
|
|
64
80
|
|
65
81
|
protected
|
66
82
|
|
67
|
-
def apply_to_root_directory(template, subpath)
|
68
|
-
if template.is_a?(::EacTemplates::Variables::Directory)
|
69
|
-
template.children.each do |child|
|
70
|
-
apply_to_root_directory(child, subpath.join(child.basename))
|
71
|
-
end
|
72
|
-
elsif template.is_a?(::EacTemplates::Variables::File)
|
73
|
-
template.apply_to_file(template_variables, root_directory.join(subpath))
|
74
|
-
else
|
75
|
-
raise "Unknown template object: #{template}"
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
83
|
def generate_gemspec
|
80
84
|
template_apply('gemspec', "#{name}.gemspec")
|
81
85
|
end
|
82
86
|
|
83
|
-
def generate_root_directory
|
84
|
-
root_directory.mkpath
|
85
|
-
end
|
86
|
-
|
87
87
|
def generate_root_lib
|
88
88
|
template_apply('root_lib', "lib/#{lib_path}.rb")
|
89
89
|
end
|
90
90
|
|
91
|
-
def generate_static
|
92
|
-
template.child('static').apply(self, root_directory)
|
93
|
-
end
|
94
|
-
|
95
91
|
def generate_version_lib
|
96
92
|
template_apply('version', "lib/#{lib_path}/version.rb")
|
97
93
|
end
|
98
94
|
|
95
|
+
# @return [EacTemplates::Modules::Base]
|
96
|
+
def root_template
|
97
|
+
template.child('static')
|
98
|
+
end
|
99
|
+
|
99
100
|
def self_gem_uncached
|
100
|
-
::Avm::EacRubyBase1::Sources::Base.new(
|
101
|
+
::Avm::EacRubyBase1::Sources::Base.new(target_path)
|
101
102
|
end
|
102
103
|
|
103
104
|
def template_apply(from, to)
|
104
|
-
target =
|
105
|
+
target = target_path.join(to)
|
105
106
|
target.dirname.mkpath
|
106
|
-
template.child(
|
107
|
+
template.child(from).apply_to_file(self, target.to_path)
|
107
108
|
end
|
108
109
|
end
|
109
110
|
end
|
@@ -10,10 +10,10 @@ Gem::Specification.new do |s|
|
|
10
10
|
s.authors = ['Put here the authors']
|
11
11
|
s.summary = 'Put here de description.'
|
12
12
|
|
13
|
-
s.files =
|
14
|
-
s.required_ruby_version = '>= 2.7'
|
13
|
+
s.files = %%gemspec_files_value%%
|
14
|
+
s.required_ruby_version = '>= 2.7'%%gemspec_extra%%
|
15
15
|
|
16
|
-
|
16
|
+
%%COMMON_DEPENDENCIES%%
|
17
17
|
|
18
|
-
|
18
|
+
%%DEVELOPMENT_DEPENDENCIES%%
|
19
19
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: avm-eac_ruby_base1
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.34.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Put here the authors
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-06-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: avm
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
19
|
+
version: '0.92'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0.
|
26
|
+
version: '0.92'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: avm-eac_generic_base0
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -131,6 +131,7 @@ files:
|
|
131
131
|
- lib/avm/eac_ruby_base1/rubygems/gemspec.rb
|
132
132
|
- lib/avm/eac_ruby_base1/rubygems/gemspec/add_or_replace_gem_line.rb
|
133
133
|
- lib/avm/eac_ruby_base1/rubygems/gemspec/dependency.rb
|
134
|
+
- lib/avm/eac_ruby_base1/rubygems/remote.rb
|
134
135
|
- lib/avm/eac_ruby_base1/rubygems/version_file.rb
|
135
136
|
- lib/avm/eac_ruby_base1/runners.rb
|
136
137
|
- lib/avm/eac_ruby_base1/runners/base.rb
|