eac_tools 0.19.0 → 0.20.0

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: f682e3e2b625d82f32da7855fb153e206693a1c0d4c934e0bb9b16216b2f7998
4
- data.tar.gz: 7cfa294cbdec42a2f1ad21199d2a744ccff5afc7e0c85714dd6685ee146781b4
3
+ metadata.gz: 93a1c9566bf766012fca596e4627a7a9fdda33311bb370e2dcd652b7c9d60b24
4
+ data.tar.gz: 42d0ac14487052b8a3578059f0f76bc7e3ed96d9005cdf6ad5a494dc4addc23c
5
5
  SHA512:
6
- metadata.gz: 1743063c5a1e76873664826ccfdf0fdb4c78ff668098a4ee1c8da4a8312f43b9e88694f37e0011d394045065572165376a486a9a4cdeef0538fae441f38e7df8
7
- data.tar.gz: 592727978f8b7902f25bc4b03252871dd80ef62611feb5fd0377ae822d6b379ea0c0ae2d050920a455b38ab40625fd67805f23d95209e674f060670e48b7c4fd
6
+ metadata.gz: 175adf6a2e99f67dce013f433fab9bc820fbfb9ba6d2236bf4e551ac23c012e44e476c8588f1e789d95e9433211ccd0e0390c6bd4d02847ad5f793c1219be183
7
+ data.tar.gz: ca95cc7bcbefea6560fa5c16c8f8245911e06493ea90be2a54068435caf4ce0b0bfc9536267abfaf2ac59c88ec61f6c96f9407dd44c2353383a88c680571df9f
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- eac_tools (0.19.0)
4
+ eac_tools (0.20.0)
5
5
  avm (~> 0.35)
6
6
  avm-eac_asciidoctor_base0 (~> 0.4)
7
7
  avm-eac_generic_base0 (~> 0.5)
@@ -10,7 +10,7 @@ PATH
10
10
  avm-eac_rails_base1 (~> 0.4, >= 0.4.2)
11
11
  avm-eac_redmine_base0 (~> 0.11)
12
12
  avm-eac_redmine_plugin_base0 (~> 0.3)
13
- avm-eac_ruby_base1 (~> 0.16)
13
+ avm-eac_ruby_base1 (~> 0.17)
14
14
  avm-eac_webapp_base0 (~> 0.3, >= 0.3.1)
15
15
  avm-eac_wordpress_base0 (~> 0.1, >= 0.1.1)
16
16
  avm-tools (~> 0.131)
@@ -80,7 +80,7 @@ PATH
80
80
  PATH
81
81
  remote: sub/avm-eac_ruby_base1
82
82
  specs:
83
- avm-eac_ruby_base1 (0.16.0)
83
+ avm-eac_ruby_base1 (0.17.0)
84
84
  avm (~> 0.34)
85
85
  avm-eac_generic_base0 (~> 0.2)
86
86
  eac_ruby_utils (~> 0.95, >= 0.95.1)
@@ -138,7 +138,7 @@ PATH
138
138
  PATH
139
139
  remote: sub/eac_cli
140
140
  specs:
141
- eac_cli (0.27.7)
141
+ eac_cli (0.27.8)
142
142
  colorize (~> 0.8.1)
143
143
  eac_config (~> 0.8)
144
144
  eac_ruby_utils (~> 0.95)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacTools
4
- VERSION = '0.19.0'
4
+ VERSION = '0.20.0'
5
5
  end
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/version_number'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module Avm
7
+ module EacRubyBase1
8
+ class PreferredVersionRequirements
9
+ enable_simple_cache
10
+ common_constructor :version do
11
+ self.version = ::Avm::VersionNumber.new(version)
12
+ end
13
+
14
+ # @return [Avm::VersionNumber]
15
+ def prefix_version
16
+ ::Avm::VersionNumber.new(
17
+ normalized_version.segments[0..normalized_version.segments.count - 2]
18
+ )
19
+ end
20
+
21
+ # @return [Gem::Requirement]
22
+ def to_requirement
23
+ r = ["~> #{prefix_version}"]
24
+ r << ">= #{normalized_version}" unless normalized_version.segments[-1].zero?
25
+ ::Gem::Requirement.new(r)
26
+ end
27
+
28
+ # @return [Array<String>]
29
+ def to_requirements_list
30
+ to_requirement.requirements.map { |r| "#{r[0]} #{r[1]}" }
31
+ end
32
+
33
+ private
34
+
35
+ # @return [Avm::VersionNumber]
36
+ def normalized_version_uncached
37
+ r = version
38
+ r = ::Avm::VersionNumber.new(r.segments + [0]) while r.segments.count < 3
39
+ r
40
+ end
41
+ end
42
+ end
43
+ end
@@ -2,8 +2,8 @@
2
2
 
3
3
  require 'avm/eac_generic_base0/sources/base'
4
4
  require 'avm/eac_ruby_base1/rubygems/version_file'
5
+ require 'avm/eac_ruby_base1/sources/runners'
5
6
  require 'avm/eac_ruby_base1/sources/update'
6
- require 'avm/eac_ruby_base1/sources/runners/bundler'
7
7
  require 'avm/version_number'
8
8
  require 'eac_ruby_utils/core_ext'
9
9
 
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/eac_ruby_base1/rubygems/gemspec'
4
+ require 'avm/eac_ruby_base1/sources/update_dependency_requirements'
5
+ require 'eac_cli/core_ext'
6
+
7
+ module Avm
8
+ module EacRubyBase1
9
+ module Sources
10
+ module Runners
11
+ class UpdateDependenciesRequirements
12
+ runner_with :help, :subcommands do
13
+ bool_opt '-a', '--all'
14
+ pos_arg :gem_name, repeat: true, optional: true
15
+ end
16
+
17
+ def run
18
+ runner_context.call(:source_banner)
19
+ infov 'Gems to update', gem_names.count
20
+ gem_names.each do |gem_name|
21
+ infov 'Gem to update', gem_name
22
+ ::Avm::EacRubyBase1::Sources::UpdateDependencyRequirements
23
+ .new(runner_context.call(:source), gem_name).perform
24
+ end
25
+ end
26
+
27
+ def gemspec
28
+ ::Avm::EacRubyBase1::Rubygems::Gemspec.from_file(
29
+ runner_context.call(:source).gemspec_path
30
+ )
31
+ end
32
+
33
+ private
34
+
35
+ def gem_names_uncached
36
+ ::Set.new(parsed.gem_name + gem_names_from_all).sort
37
+ end
38
+
39
+ def gem_names_from_all
40
+ return [] unless parsed.all?
41
+
42
+ gemspec.dependencies.map(&:gem_name)
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,51 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/eac_ruby_base1/preferred_version_requirements'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module Avm
7
+ module EacRubyBase1
8
+ module Sources
9
+ class UpdateDependencyRequirements
10
+ enable_simple_cache
11
+ common_constructor :source, :gem_name
12
+
13
+ def perform
14
+ source.scm.commit_if_change(commit_message) { update_code }
15
+ end
16
+
17
+ private
18
+
19
+ # @return [String]
20
+ def commit_message
21
+ i18n_translate(__method__,
22
+ name: gem_name,
23
+ requirements_list: requirements_list.join(', '),
24
+ __locale: source.locale)
25
+ end
26
+
27
+ # @return [Array<String>]
28
+ def requirements_list_uncached
29
+ ::Avm::EacRubyBase1::PreferredVersionRequirements.new(
30
+ source.gemfile_lock_gem_version(gem_name)
31
+ ).to_requirements_list
32
+ end
33
+
34
+ def gemspec_uncached
35
+ ::Avm::EacRubyBase1::Rubygems::Gemspec.from_file(source.gemspec_path)
36
+ end
37
+
38
+ def update_code
39
+ update_gemspec
40
+ source.bundle.system!
41
+ end
42
+
43
+ def update_gemspec
44
+ gemspec.dependency(gem_name).version_specs = requirements_list
45
+ gemspec.write(source.gemspec_path)
46
+ source.bundle('exec', 'rubocop', source.gemspec_path).system!
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module EacRubyBase1
5
- VERSION = '0.16.0'
5
+ VERSION = '0.17.0'
6
6
  end
7
7
  end
@@ -6,3 +6,5 @@ en:
6
6
  no_scm_update_commit_message: "Gem \"%{name}\" (Local): update to '%{version}'."
7
7
  scm_update_commit_message: '**/.gitrepo: fix/update.'
8
8
  update_gemfile_lock_commit_message: 'All gems: update.'
9
+ update_dependency_requirements:
10
+ commit_message: "Gem \"%{name}\": update to '%{requirements_list}'."
@@ -6,3 +6,5 @@ pt-BR:
6
6
  no_scm_update_commit_message: "Gem \"%{name}\" (Local): atualiza para '%{version}'."
7
7
  scm_update_commit_message: '**/.gitrepo: conserta/atualiza.'
8
8
  update_gemfile_lock_commit_message: 'Todas as gems: atualiza.'
9
+ update_dependency_requirements:
10
+ commit_message: "Gem \"%{name}\": atualiza para to '%{requirements_list}'."
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/eac_ruby_base1/preferred_version_requirements'
4
+
5
+ ::RSpec.describe ::Avm::EacRubyBase1::PreferredVersionRequirements do
6
+ describe '#to_requirements_list' do
7
+ {
8
+ '0.1.0' => ['~> 0.1'],
9
+ '0.1.1' => ['~> 0.1', '>= 0.1.1'],
10
+ '0.5' => ['~> 0.5'],
11
+ '4.2.11.3' => ['~> 4.2.11', '>= 4.2.11.3'],
12
+ '1' => ['~> 1.0']
13
+ }.each do |source, expected|
14
+ context "when version is \"#{source}\"" do
15
+ subject(:instance) { described_class.new(source) }
16
+
17
+ it do
18
+ expect(instance.to_requirements_list).to eq(expected)
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -47,6 +47,10 @@ module EacCli
47
47
  end
48
48
  end
49
49
 
50
+ def available_subcommands_to_s
51
+ available_subcommands.keys.sort.join(', ')
52
+ end
53
+
50
54
  def help_extra_text
51
55
  (['Subcommands:'] + available_subcommands.keys.sort.map { |s| " #{s}" })
52
56
  .map { |v| "#{v}\n" }.join
@@ -101,7 +105,7 @@ module EacCli
101
105
  raise(::EacCli::Parser::Error.new(
102
106
  self.class.runner_definition, runner_context.argv,
103
107
  "Subcommand \"#{subcommand_name}\" not found " \
104
- "(Available: #{available_subcommands.keys})"
108
+ "(Available: #{available_subcommands_to_s})"
105
109
  ))
106
110
  end
107
111
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacCli
4
- VERSION = '0.27.7'
4
+ VERSION = '0.27.8'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eac_tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.19.0
4
+ version: 0.20.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Put here the authors
@@ -140,14 +140,14 @@ dependencies:
140
140
  requirements:
141
141
  - - "~>"
142
142
  - !ruby/object:Gem::Version
143
- version: '0.16'
143
+ version: '0.17'
144
144
  type: :runtime
145
145
  prerelease: false
146
146
  version_requirements: !ruby/object:Gem::Requirement
147
147
  requirements:
148
148
  - - "~>"
149
149
  - !ruby/object:Gem::Version
150
- version: '0.16'
150
+ version: '0.17'
151
151
  - !ruby/object:Gem::Dependency
152
152
  name: avm-eac_webapp_base0
153
153
  requirement: !ruby/object:Gem::Requirement
@@ -436,6 +436,7 @@ files:
436
436
  - sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/bundler/incompatible_parser/line_factory.rb
437
437
  - sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/bundler/incompatible_parser/line_parser_base.rb
438
438
  - sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/bundler/incompatible_parser/version_requirement.rb
439
+ - sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/preferred_version_requirements.rb
439
440
  - sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/rubocop.rb
440
441
  - sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/rubocop/configured.rb
441
442
  - sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/rubocop/envvar.rb
@@ -458,6 +459,7 @@ files:
458
459
  - sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/runners/bundler.rb
459
460
  - sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/runners/bundler/gemfile_local.rb
460
461
  - sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/runners/bundler/incompatible.rb
462
+ - sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/runners/update_dependencies_requirements.rb
461
463
  - sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/tests.rb
462
464
  - sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/tests/base.rb
463
465
  - sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/tests/minitest.rb
@@ -467,6 +469,7 @@ files:
467
469
  - sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/tests/rspec.rb
468
470
  - sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/update.rb
469
471
  - sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/update/sub_update.rb
472
+ - sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/update_dependency_requirements.rb
470
473
  - sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/version.rb
471
474
  - sub/avm-eac_ruby_base1/locale/en.yml
472
475
  - sub/avm-eac_ruby_base1/locale/pt-BR.yml
@@ -475,6 +478,7 @@ files:
475
478
  - sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/bundler/incompatible_parser_spec_files/1.target.yaml
476
479
  - sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/bundler/incompatible_parser_spec_files/2.source.out
477
480
  - sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/bundler/incompatible_parser_spec_files/2.target.yaml
481
+ - sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/preferred_version_requirements_spec.rb
478
482
  - sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/rubygems/version_file_spec.rb
479
483
  - sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/rubygems/version_file_spec_files/a_version_file.rb
480
484
  - sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/source_generators/base_spec.rb