avm-eac_ruby_base1 0.20.1 → 0.21.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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8aa6fb2c75a6703bcdd4ceed8ead247dadbf815b655dad7b109f8ecbb91e5d0f
|
|
4
|
+
data.tar.gz: 8c0f0df2c68515851f468c2cfa289850b61d1ad3bdec8803245d4367c696e838
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0b1ecc88e497cb8a525c9cf4b628ea656bc3220ba84b5a8440d9f0083af30737d8d9f5195cdf5e1a315138a8bbc3309df2dd8aa963c0e10aacf949eac319d892
|
|
7
|
+
data.tar.gz: a506c42ac49b68c2845b490567eacd8de4b2d38e991016ce21d3f8727df372510ddb1c2cb46475ac5dc1151d3a34f57371090e7bbaebe3c218eaca1f9a9cae39
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'eac_cli/core_ext'
|
|
4
|
+
require 'avm/eac_ruby_base1/sources/namespace_replacer'
|
|
5
|
+
|
|
6
|
+
module Avm
|
|
7
|
+
module EacRubyBase1
|
|
8
|
+
module Runners
|
|
9
|
+
class Base
|
|
10
|
+
class LibRename
|
|
11
|
+
runner_with :help, :file_replacer do
|
|
12
|
+
desc 'Rename Ruby modules classes Ruby.'
|
|
13
|
+
arg_opt '-f', '--from', 'Rename "from".'
|
|
14
|
+
arg_opt '-t', '--to', 'Rename "to".'
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def run
|
|
18
|
+
start_banner
|
|
19
|
+
validate
|
|
20
|
+
replacements_banner
|
|
21
|
+
run_filesystem_traverser
|
|
22
|
+
success 'Done!'
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def validate
|
|
26
|
+
%w[from to].each do |opt|
|
|
27
|
+
fatal_error "No \"#{opt}\" option" if send(opt).blank?
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def start_banner
|
|
32
|
+
infov 'From', from
|
|
33
|
+
infov 'To', to
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
private
|
|
37
|
+
|
|
38
|
+
def namespace_replacer_uncached
|
|
39
|
+
::Avm::EacRubyBase1::Sources::NamespaceReplacer.new(from, to)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def text_replacer
|
|
43
|
+
@text_replacer ||= super.gsub(from, to).gsub(from_path, to_path)
|
|
44
|
+
.gsub(namespace_replacer.from_result, namespace_replacer.to_result)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def replace_file?(file)
|
|
48
|
+
file.extname == '.rb'
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def replacements_banner
|
|
52
|
+
infov 'Replacements', text_replacer.replacements.count
|
|
53
|
+
text_replacer.replacements.each do |rep|
|
|
54
|
+
infov ' * ', rep
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def from
|
|
59
|
+
parsed.from.to_s
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def to
|
|
63
|
+
parsed.to.to_s
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def from_path
|
|
67
|
+
from.underscore
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def to_path
|
|
71
|
+
to.underscore
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
end
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Avm
|
|
4
|
+
module EacRubyBase1
|
|
5
|
+
module Sources
|
|
6
|
+
class NamespaceReplacer
|
|
7
|
+
common_constructor :from, :to
|
|
8
|
+
|
|
9
|
+
def concat_regex(regexes)
|
|
10
|
+
r = regexes.first
|
|
11
|
+
regexes[1..-1].each do |x|
|
|
12
|
+
r = ::Regexp.new(r.source + x.source)
|
|
13
|
+
end
|
|
14
|
+
r
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def from_result
|
|
18
|
+
/\n#{from_open.source}(.+)#{from_close.source}/m
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def from_open
|
|
22
|
+
concat_regex(from.split('::')
|
|
23
|
+
.map { |v| / *(?:class|module) +#{::Regexp.quote(v)} *\n/m })
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def from_close
|
|
27
|
+
concat_regex(from.split('::').count.times.map { / *end *\n/m })
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def to_result
|
|
31
|
+
"\n\n#{to_open}\\1#{to_close}"
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def to_open
|
|
35
|
+
s = ''
|
|
36
|
+
to.split('::').each_with_index do |part, index|
|
|
37
|
+
s += (' ' * index) + "module #{part}\n"
|
|
38
|
+
end
|
|
39
|
+
s
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def to_close
|
|
43
|
+
parts = to.split('::')
|
|
44
|
+
s = ''
|
|
45
|
+
parts.each_with_index do |_part, index|
|
|
46
|
+
tabc = (parts.count - 1 - index)
|
|
47
|
+
tabc -= 1 if index.zero?
|
|
48
|
+
s += (' ' * tabc) + "end\n"
|
|
49
|
+
end
|
|
50
|
+
s
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
@@ -16,13 +16,9 @@ module Avm
|
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
def run
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
infov 'Gem to update', gem_name
|
|
23
|
-
::Avm::EacRubyBase1::Sources::UpdateDependencyRequirements
|
|
24
|
-
.new(runner_context.call(:source), gem_name).perform
|
|
25
|
-
end
|
|
19
|
+
start_banner
|
|
20
|
+
update_gemfile_lock
|
|
21
|
+
process_all_gems
|
|
26
22
|
end
|
|
27
23
|
|
|
28
24
|
def gemspec
|
|
@@ -47,6 +43,24 @@ module Avm
|
|
|
47
43
|
|
|
48
44
|
gemspec.dependencies.map(&:gem_name)
|
|
49
45
|
end
|
|
46
|
+
|
|
47
|
+
def process_all_gems
|
|
48
|
+
gem_names.each do |gem_name|
|
|
49
|
+
infov 'Gem to update', gem_name
|
|
50
|
+
::Avm::EacRubyBase1::Sources::UpdateDependencyRequirements
|
|
51
|
+
.new(runner_context.call(:source), gem_name).perform
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def start_banner
|
|
56
|
+
runner_context.call(:source_banner)
|
|
57
|
+
infov 'Gems to update', gem_names.count
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def update_gemfile_lock
|
|
61
|
+
infom 'Updating Gemfile\'s lock...'
|
|
62
|
+
runner_context.call(:source).bundle('update').execute!
|
|
63
|
+
end
|
|
50
64
|
end
|
|
51
65
|
end
|
|
52
66
|
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.21.0
|
|
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: 2022-09-
|
|
11
|
+
date: 2022-09-14 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: avm
|
|
@@ -50,14 +50,14 @@ dependencies:
|
|
|
50
50
|
requirements:
|
|
51
51
|
- - "~>"
|
|
52
52
|
- !ruby/object:Gem::Version
|
|
53
|
-
version: '0.
|
|
53
|
+
version: '0.103'
|
|
54
54
|
type: :runtime
|
|
55
55
|
prerelease: false
|
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
|
57
57
|
requirements:
|
|
58
58
|
- - "~>"
|
|
59
59
|
- !ruby/object:Gem::Version
|
|
60
|
-
version: '0.
|
|
60
|
+
version: '0.103'
|
|
61
61
|
- !ruby/object:Gem::Dependency
|
|
62
62
|
name: aranha-parsers
|
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -123,6 +123,7 @@ files:
|
|
|
123
123
|
- lib/avm/eac_ruby_base1/rubygems/version_file.rb
|
|
124
124
|
- lib/avm/eac_ruby_base1/runners.rb
|
|
125
125
|
- lib/avm/eac_ruby_base1/runners/base.rb
|
|
126
|
+
- lib/avm/eac_ruby_base1/runners/base/lib_rename.rb
|
|
126
127
|
- lib/avm/eac_ruby_base1/runners/base/rubocop.rb
|
|
127
128
|
- lib/avm/eac_ruby_base1/source_generators.rb
|
|
128
129
|
- lib/avm/eac_ruby_base1/source_generators/base.rb
|
|
@@ -134,6 +135,7 @@ files:
|
|
|
134
135
|
- lib/avm/eac_ruby_base1/sources/base/rubygems.rb
|
|
135
136
|
- lib/avm/eac_ruby_base1/sources/base/version_bump.rb
|
|
136
137
|
- lib/avm/eac_ruby_base1/sources/bundle_update.rb
|
|
138
|
+
- lib/avm/eac_ruby_base1/sources/namespace_replacer.rb
|
|
137
139
|
- lib/avm/eac_ruby_base1/sources/runners.rb
|
|
138
140
|
- lib/avm/eac_ruby_base1/sources/runners/bundler.rb
|
|
139
141
|
- lib/avm/eac_ruby_base1/sources/runners/bundler/gemfile_local.rb
|