avm-tools 0.115.0 → 0.116.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (120) hide show
  1. checksums.yaml +4 -4
  2. data/lib/avm/launcher/instances/settings.rb +7 -3
  3. data/lib/avm/projects/stereotypes.rb +2 -2
  4. data/lib/avm/ruby/bundler/incompatible_parser/depends_on.rb +1 -1
  5. data/lib/avm/ruby/bundler/incompatible_parser/gem_conflict.rb +1 -1
  6. data/lib/avm/ruby/bundler/incompatible_parser/in_gemfile.rb +1 -1
  7. data/lib/avm/ruby/bundler/incompatible_parser/version_requirement.rb +1 -1
  8. data/lib/avm/ruby/bundler/incompatible_parser.rb +1 -1
  9. data/lib/avm/tools/runner/app_src/ruby/bundler/gemfile_lock/git.rb +1 -1
  10. data/lib/avm/tools/runner/app_src/test.rb +2 -2
  11. data/lib/avm/tools/runner/git/deploy.rb +5 -5
  12. data/lib/avm/tools/runner/git/dirty_files.rb +1 -1
  13. data/lib/avm/tools/runner/git/revisions_test.rb +1 -1
  14. data/lib/avm/tools/runner/ruby/rubocop.rb +2 -2
  15. data/lib/avm/tools/version.rb +1 -1
  16. data/sub/avm/avm.gemspec +2 -2
  17. data/sub/avm/lib/avm/instances/base/auto_values/mailer.rb +2 -2
  18. data/sub/avm/lib/avm/instances/entry_keys.rb +2 -0
  19. data/sub/avm/lib/avm/registry/base.rb +2 -2
  20. data/sub/avm/lib/avm/rspec/shared_examples/not_in_avm_registry.rb +1 -1
  21. data/sub/avm/lib/avm/sources/tests/builder.rb +1 -1
  22. data/sub/avm/lib/avm/version.rb +1 -1
  23. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/build/file.rb +1 -1
  24. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/build.rb +2 -2
  25. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/runner/build.rb +1 -1
  26. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/runner.rb +2 -2
  27. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/version.rb +1 -1
  28. data/sub/avm-eac_rails_base0/avm-eac_rails_base0.gemspec +1 -1
  29. data/sub/avm-eac_rails_base0/lib/avm/eac_rails_base0/version.rb +1 -1
  30. data/sub/avm-eac_rails_base1/avm-eac_rails_base1.gemspec +2 -2
  31. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/runner/tasks_scheduler/systemd_unit.rb +46 -0
  32. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/runner/tasks_scheduler.rb +17 -0
  33. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/systemd_unit/service.rb +70 -0
  34. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/systemd_unit/tasks_scheduler_command.rb +29 -0
  35. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/systemd_unit.rb +57 -0
  36. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/version.rb +1 -1
  37. data/sub/avm-eac_rails_base1/template/avm/eac_rails_base1/systemd_unit/tasks_scheduler.service +12 -0
  38. data/sub/avm-eac_rails_base1/template/avm/eac_rails_base1/systemd_unit/tasks_scheduler_command.sh +6 -0
  39. data/sub/avm-eac_redmine_base0/avm-eac_redmine_base0.gemspec +2 -2
  40. data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/core_update.rb +3 -3
  41. data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/docker_image.rb +17 -2
  42. data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/version.rb +1 -1
  43. data/sub/avm-eac_redmine_base0/template/avm/eac_redmine_base0/instances/docker_image/Dockerfile.template +2 -8
  44. data/sub/avm-eac_redmine_base0/template/avm/eac_redmine_base0/instances/docker_image/Dockerfile_apache_setup +8 -0
  45. data/sub/avm-eac_redmine_base0/template/avm/eac_redmine_base0/instances/docker_image/start.sh.template +1 -1
  46. data/sub/avm-eac_ruby_base1/avm-eac_ruby_base1.gemspec +1 -1
  47. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/patches/i18n.rb +1 -1
  48. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/rubocop/configured.rb +31 -0
  49. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/rubocop/envvar.rb +17 -0
  50. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/rubocop/gemfile.rb +41 -0
  51. data/{lib/avm/ruby → sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1}/rubocop.rb +2 -2
  52. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/tester.rb +1 -1
  53. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/update/sub_update.rb +1 -1
  54. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/version.rb +1 -1
  55. data/sub/avm-eac_ubuntu_base0/lib/avm/eac_ubuntu_base0/instances/base.rb +6 -0
  56. data/sub/avm-eac_ubuntu_base0/lib/avm/eac_ubuntu_base0/version.rb +1 -1
  57. data/sub/avm-eac_webapp_base0/avm-eac_webapp_base0.gemspec +1 -1
  58. data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instance.rb +7 -0
  59. data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/version.rb +1 -1
  60. data/sub/avm-files/avm-files.gemspec +1 -1
  61. data/sub/avm-files/lib/avm/files/appendable.rb +1 -1
  62. data/sub/avm-files/lib/avm/files/formatter/formats/ruby.rb +2 -2
  63. data/sub/avm-files/lib/avm/files/version.rb +1 -1
  64. data/sub/eac_cli/eac_cli.gemspec +1 -1
  65. data/sub/eac_cli/lib/eac_cli/old_configs/entry_reader.rb +1 -1
  66. data/sub/eac_cli/lib/eac_cli/old_configs/read_entry_options.rb +1 -1
  67. data/sub/eac_cli/lib/eac_cli/parser.rb +2 -2
  68. data/sub/eac_cli/lib/eac_cli/runner_with/help/builder.rb +1 -1
  69. data/sub/eac_cli/lib/eac_cli/runner_with/subcommands.rb +5 -5
  70. data/sub/eac_cli/lib/eac_cli/runner_with_set.rb +2 -2
  71. data/sub/eac_cli/lib/eac_cli/version.rb +1 -1
  72. data/sub/eac_config/eac_config.gemspec +1 -1
  73. data/sub/eac_config/lib/eac_config/entry.rb +1 -1
  74. data/sub/eac_config/lib/eac_config/envvars_node/entry.rb +1 -1
  75. data/sub/eac_config/lib/eac_config/paths_hash/node.rb +1 -1
  76. data/sub/eac_config/lib/eac_config/version.rb +1 -1
  77. data/sub/eac_fs/eac_fs.gemspec +1 -1
  78. data/sub/eac_fs/lib/eac_fs/version.rb +1 -1
  79. data/sub/eac_git/eac_git.gemspec +1 -1
  80. data/sub/eac_git/lib/eac_git/local/remote.rb +2 -2
  81. data/sub/eac_git/lib/eac_git/local.rb +1 -1
  82. data/sub/eac_git/lib/eac_git/version.rb +1 -1
  83. data/sub/eac_rest/eac_rest.gemspec +1 -1
  84. data/sub/eac_rest/lib/eac_rest/api.rb +14 -3
  85. data/sub/eac_rest/lib/eac_rest/request.rb +22 -1
  86. data/sub/eac_rest/lib/eac_rest/response.rb +41 -1
  87. data/sub/eac_rest/lib/eac_rest/version.rb +1 -1
  88. data/sub/eac_ruby_base0/eac_ruby_base0.gemspec +1 -1
  89. data/sub/eac_ruby_base0/lib/eac_ruby_base0/application.rb +2 -2
  90. data/sub/eac_ruby_base0/lib/eac_ruby_base0/version.rb +1 -1
  91. data/sub/eac_ruby_gems_utils/eac_ruby_gems_utils.gemspec +1 -1
  92. data/sub/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/gem/version_file.rb +2 -2
  93. data/sub/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/version.rb +1 -1
  94. data/sub/eac_ruby_utils/eac_ruby_utils.gemspec +1 -1
  95. data/sub/eac_ruby_utils/lib/eac_ruby_utils/custom_format.rb +1 -1
  96. data/sub/eac_ruby_utils/lib/eac_ruby_utils/gems_registry/gem.rb +1 -1
  97. data/sub/eac_ruby_utils/lib/eac_ruby_utils/gems_registry.rb +1 -1
  98. data/sub/eac_ruby_utils/lib/eac_ruby_utils/inflector.rb +1 -1
  99. data/sub/eac_ruby_utils/lib/eac_ruby_utils/listable/list.rb +16 -4
  100. data/sub/eac_ruby_utils/lib/eac_ruby_utils/listable/value.rb +12 -2
  101. data/sub/eac_ruby_utils/lib/eac_ruby_utils/local_time_zone.rb +1 -1
  102. data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/object/debug.rb +6 -0
  103. data/sub/eac_ruby_utils/lib/eac_ruby_utils/ruby/on_clean_environment.rb +1 -1
  104. data/sub/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
  105. data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/temp/{temp_spec.rb → directory_spec.rb} +0 -0
  106. data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/fs/temp_spec.rb +4 -4
  107. data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/listable_spec.rb +169 -106
  108. data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/options_consumer_spec.rb +52 -17
  109. data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/module/listable_spec.rb +5 -3
  110. data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/module/simple_cache_spec.rb +5 -3
  111. data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/require_sub_spec.rb +3 -3
  112. data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/settings_provider_spec.rb +21 -18
  113. data/sub/eac_ruby_utils/spec/locales/pt-BR.yml +3 -0
  114. data/sub/eac_templates/eac_templates.gemspec +1 -1
  115. data/sub/eac_templates/lib/eac_templates/directory.rb +1 -1
  116. data/sub/eac_templates/lib/eac_templates/version.rb +1 -1
  117. metadata +41 -21
  118. data/lib/avm/ruby/rubocop/_configured.rb +0 -29
  119. data/lib/avm/ruby/rubocop/_envvar.rb +0 -15
  120. data/lib/avm/ruby/rubocop/_gemfile.rb +0 -39
@@ -2,199 +2,262 @@
2
2
 
3
3
  require 'eac_ruby_utils/listable'
4
4
 
5
- class Stub
6
- include ::EacRubyUtils::Listable
7
-
8
- attr_accessor :inteiro, :code, :cadeia, :type
9
-
10
- lists.add_integer :inteiro, :a, :b, :c
11
- lists.add_integer :code, 7 => :a, 13 => :b
12
- lists.add_string :cadeia, :a, :b, :c
13
- lists.add_string :type, 'Namespace::ClazzA' => :a, 'Namespace::ClazzB' => :b
14
- lists.add_symbol :simbolo, :a, :b, :c
15
- lists.add_symbol :tipado, :tipo_aaa => :a, 'tipo_bbb' => :b
16
- end
17
-
18
5
  RSpec.describe ::EacRubyUtils::Listable do
19
- context 'attribute values' do
20
- it { expect(Stub.lists.inteiro.values).to eq([1, 2, 3]) }
21
- it { expect(Stub.lists.code.values).to eq([7, 13]) }
22
- it { expect(Stub.lists.cadeia.values).to eq(%w[a b c]) }
23
- it { expect(Stub.lists.type.values).to eq(%w[Namespace::ClazzA Namespace::ClazzB]) }
24
- it { expect(Stub.lists.simbolo.values).to eq(%i[a b c]) }
25
- it { expect(Stub.lists.tipado.values).to eq(%i[tipo_aaa tipo_bbb]) }
6
+ let(:stub_class) do
7
+ the_described_class = described_class
8
+ ::Class.new do
9
+ class << self
10
+ def name
11
+ 'Stub'
12
+ end
13
+ end
14
+
15
+ include the_described_class
16
+
17
+ attr_accessor :inteiro, :code, :cadeia, :type
18
+
19
+ lists.add_integer :inteiro, :a, :b, :c
20
+ lists.add_integer :code, 7 => :a, 13 => :b
21
+ lists.add_string :cadeia, :a, :b, :c
22
+ lists.add_string :type, 'Namespace::ClazzA' => :a, 'Namespace::ClazzB' => :b
23
+ lists.add_symbol :simbolo, :a, :b, :c
24
+ lists.add_symbol :tipado, :tipo_aaa => :a, 'tipo_bbb' => :b
25
+ end
26
26
  end
27
27
 
28
- context 'value instance options' do
28
+ describe 'attribute values' do
29
+ it { expect(stub_class.lists.inteiro.values).to eq([1, 2, 3]) }
30
+ it { expect(stub_class.lists.code.values).to eq([7, 13]) }
31
+ it { expect(stub_class.lists.cadeia.values).to eq(%w[a b c]) }
32
+ it { expect(stub_class.lists.type.values).to eq(%w[Namespace::ClazzA Namespace::ClazzB]) }
33
+ it { expect(stub_class.lists.simbolo.values).to eq(%i[a b c]) }
34
+ it { expect(stub_class.lists.tipado.values).to eq(%i[tipo_aaa tipo_bbb]) }
35
+ end
36
+
37
+ describe 'value instance options' do
29
38
  it {
30
- expect(Stub.lists.inteiro.options)
39
+ expect(stub_class.lists.inteiro.options)
31
40
  .to eq([['Inteiro A', 1], ['Inteiro BB', 2], ['Inteiro CCC', 3]])
32
41
  }
33
42
 
34
43
  it {
35
- expect(Stub.lists.code.options)
44
+ expect(stub_class.lists.code.options)
36
45
  .to eq([['Código A', 7], ['Código B', 13]])
37
46
  }
38
47
 
39
48
  it {
40
- expect(Stub.lists.cadeia.options)
49
+ expect(stub_class.lists.cadeia.options)
41
50
  .to eq([['Cadeia AAA', 'a'], ['Cadeia BB', 'b'], ['Cadeia C', 'c']])
42
51
  }
43
52
 
44
53
  it {
45
- expect(Stub.lists.type.options)
54
+ expect(stub_class.lists.type.options)
46
55
  .to eq([['Tipo A', 'Namespace::ClazzA'], ['Tipo B', 'Namespace::ClazzB']])
47
56
  }
48
57
 
49
58
  it {
50
- expect(Stub.lists.simbolo.options)
59
+ expect(stub_class.lists.simbolo.options)
51
60
  .to eq([['Simbolo A', :a], ['Simbolo B', :b], ['Simbolo C', :c]])
52
61
  }
53
62
 
54
63
  it {
55
- expect(Stub.lists.tipado.options)
64
+ expect(stub_class.lists.tipado.options)
56
65
  .to eq([['Tipado A', :tipo_aaa], ['Tipado B', :tipo_bbb]])
57
66
  }
58
67
  end
59
68
 
60
- context 'constants' do
61
- it { expect(Stub::INTEIRO_A).to eq(1) }
62
- it { expect(Stub::INTEIRO_B).to eq(2) }
63
- it { expect(Stub::INTEIRO_C).to eq(3) }
64
- it { expect(Stub::CODE_A).to eq(7) }
65
- it { expect(Stub::CODE_B).to eq(13) }
66
- it { expect(Stub::CADEIA_A).to eq('a') }
67
- it { expect(Stub::CADEIA_C).to eq('c') }
68
- it { expect(Stub::TYPE_A).to eq('Namespace::ClazzA') }
69
- it { expect(Stub::TYPE_B).to eq('Namespace::ClazzB') }
70
- it { expect(Stub::SIMBOLO_A).to eq(:a) }
71
- it { expect(Stub::SIMBOLO_B).to eq(:b) }
72
- it { expect(Stub::SIMBOLO_C).to eq(:c) }
73
- it { expect(Stub::TIPADO_A).to eq(:tipo_aaa) }
74
- it { expect(Stub::TIPADO_B).to eq(:tipo_bbb) }
69
+ describe 'constants' do
70
+ it { expect(stub_class::INTEIRO_A).to eq(1) }
71
+ it { expect(stub_class::INTEIRO_B).to eq(2) }
72
+ it { expect(stub_class::INTEIRO_C).to eq(3) }
73
+ it { expect(stub_class::CODE_A).to eq(7) }
74
+ it { expect(stub_class::CODE_B).to eq(13) }
75
+ it { expect(stub_class::CADEIA_A).to eq('a') }
76
+ it { expect(stub_class::CADEIA_C).to eq('c') }
77
+ it { expect(stub_class::TYPE_A).to eq('Namespace::ClazzA') }
78
+ it { expect(stub_class::TYPE_B).to eq('Namespace::ClazzB') }
79
+ it { expect(stub_class::SIMBOLO_A).to eq(:a) }
80
+ it { expect(stub_class::SIMBOLO_B).to eq(:b) }
81
+ it { expect(stub_class::SIMBOLO_C).to eq(:c) }
82
+ it { expect(stub_class::TIPADO_A).to eq(:tipo_aaa) }
83
+ it { expect(stub_class::TIPADO_B).to eq(:tipo_bbb) }
75
84
  end
76
85
 
77
- context 'values instances' do
78
- it { expect(Stub.lists.is_a?(::EacRubyUtils::Listable::Lists)).to eq(true) }
79
- it { expect(Stub.lists.inteiro.value_a.is_a?(::EacRubyUtils::Listable::Value)).to eq(true) }
80
- it { expect(Stub.lists.inteiro.value_b.is_a?(::EacRubyUtils::Listable::Value)).to eq(true) }
81
- it { expect(Stub.lists.inteiro.value_c.is_a?(::EacRubyUtils::Listable::Value)).to eq(true) }
82
- it { expect(Stub.lists.code.value_a.is_a?(::EacRubyUtils::Listable::Value)).to eq(true) }
83
- it { expect(Stub.lists.code.value_b.is_a?(::EacRubyUtils::Listable::Value)).to eq(true) }
84
- it { expect(Stub.lists.cadeia.value_a.is_a?(::EacRubyUtils::Listable::Value)).to eq(true) }
85
- it { expect(Stub.lists.cadeia.value_b.is_a?(::EacRubyUtils::Listable::Value)).to eq(true) }
86
- it { expect(Stub.lists.cadeia.value_c.is_a?(::EacRubyUtils::Listable::Value)).to eq(true) }
87
- it { expect(Stub.lists.type.value_a.is_a?(::EacRubyUtils::Listable::Value)).to eq(true) }
88
- it { expect(Stub.lists.type.value_b.is_a?(::EacRubyUtils::Listable::Value)).to eq(true) }
86
+ describe 'values instances' do
87
+ it { expect(stub_class.lists.is_a?(::EacRubyUtils::Listable::Lists)).to eq(true) }
88
+
89
+ it {
90
+ expect(stub_class.lists.inteiro.value_a.is_a?(::EacRubyUtils::Listable::Value))
91
+ .to eq(true)
92
+ }
93
+
94
+ it {
95
+ expect(stub_class.lists.inteiro.value_b.is_a?(::EacRubyUtils::Listable::Value))
96
+ .to eq(true)
97
+ }
98
+
99
+ it {
100
+ expect(stub_class.lists.inteiro.value_c.is_a?(::EacRubyUtils::Listable::Value))
101
+ .to eq(true)
102
+ }
103
+
104
+ it {
105
+ expect(stub_class.lists.code.value_a.is_a?(::EacRubyUtils::Listable::Value))
106
+ .to eq(true)
107
+ }
108
+
109
+ it {
110
+ expect(stub_class.lists.code.value_b.is_a?(::EacRubyUtils::Listable::Value))
111
+ .to eq(true)
112
+ }
113
+
114
+ it {
115
+ expect(stub_class.lists.cadeia.value_a.is_a?(::EacRubyUtils::Listable::Value))
116
+ .to eq(true)
117
+ }
118
+
119
+ it {
120
+ expect(stub_class.lists.cadeia.value_b.is_a?(::EacRubyUtils::Listable::Value))
121
+ .to eq(true)
122
+ }
123
+
124
+ it {
125
+ expect(stub_class.lists.cadeia.value_c.is_a?(::EacRubyUtils::Listable::Value))
126
+ .to eq(true)
127
+ }
128
+
129
+ it {
130
+ expect(stub_class.lists.type.value_a.is_a?(::EacRubyUtils::Listable::Value))
131
+ .to eq(true)
132
+ }
133
+
134
+ it {
135
+ expect(stub_class.lists.type.value_b.is_a?(::EacRubyUtils::Listable::Value))
136
+ .to eq(true)
137
+ }
89
138
  end
90
139
 
91
- context 'value instance label' do
92
- it { expect(Stub.lists.inteiro.value_a.label).to eq('Inteiro A') }
93
- it { expect(Stub.lists.inteiro.value_b.label).to eq('Inteiro BB') }
94
- it { expect(Stub.lists.inteiro.value_c.label).to eq('Inteiro CCC') }
95
- it { expect(Stub.lists.code.value_a.label).to eq('Código A') }
96
- it { expect(Stub.lists.code.value_b.label).to eq('Código B') }
97
- it { expect(Stub.lists.cadeia.value_a.label).to eq('Cadeia AAA') }
98
- it { expect(Stub.lists.cadeia.value_b.label).to eq('Cadeia BB') }
99
- it { expect(Stub.lists.cadeia.value_c.label).to eq('Cadeia C') }
100
- it { expect(Stub.lists.type.value_a.label).to eq('Tipo A') }
101
- it { expect(Stub.lists.type.value_b.label).to eq('Tipo B') }
140
+ describe 'value instance label' do
141
+ it { expect(stub_class.lists.inteiro.value_a.label).to eq('Inteiro A') }
142
+ it { expect(stub_class.lists.inteiro.value_b.label).to eq('Inteiro BB') }
143
+ it { expect(stub_class.lists.inteiro.value_c.label).to eq('Inteiro CCC') }
144
+ it { expect(stub_class.lists.code.value_a.label).to eq('Código A') }
145
+ it { expect(stub_class.lists.code.value_b.label).to eq('Código B') }
146
+ it { expect(stub_class.lists.cadeia.value_a.label).to eq('Cadeia AAA') }
147
+ it { expect(stub_class.lists.cadeia.value_b.label).to eq('Cadeia BB') }
148
+ it { expect(stub_class.lists.cadeia.value_c.label).to eq('Cadeia C') }
149
+ it { expect(stub_class.lists.type.value_a.label).to eq('Tipo A') }
150
+ it { expect(stub_class.lists.type.value_b.label).to eq('Tipo B') }
102
151
  end
103
152
 
104
- context 'value instance description' do
105
- it { expect(Stub.lists.inteiro.value_a.description).to eq('Inteiro A Descr.') }
106
- it { expect(Stub.lists.inteiro.value_b.description).to eq('Inteiro BB Descr.') }
107
- it { expect(Stub.lists.inteiro.value_c.description).to eq('Inteiro CCC Descr.') }
108
- it { expect(Stub.lists.code.value_a.description).to eq('Código A Descr.') }
109
- it { expect(Stub.lists.code.value_b.description).to eq('Código B Descr.') }
110
- it { expect(Stub.lists.cadeia.value_a.description).to eq('Cadeia AAA Descr.') }
111
- it { expect(Stub.lists.cadeia.value_b.description).to eq('Cadeia BB Descr.') }
112
- it { expect(Stub.lists.cadeia.value_c.description).to eq('Cadeia C Descr.') }
113
- it { expect(Stub.lists.type.value_a.description).to eq('Tipo A Descr.') }
114
- it { expect(Stub.lists.type.value_b.description).to eq('Tipo B Descr.') }
153
+ describe 'value instance description' do
154
+ it { expect(stub_class.lists.inteiro.value_a.description).to eq('Inteiro A Descr.') }
155
+ it { expect(stub_class.lists.inteiro.value_b.description).to eq('Inteiro BB Descr.') }
156
+ it { expect(stub_class.lists.inteiro.value_c.description).to eq('Inteiro CCC Descr.') }
157
+ it { expect(stub_class.lists.code.value_a.description).to eq('Código A Descr.') }
158
+ it { expect(stub_class.lists.code.value_b.description).to eq('Código B Descr.') }
159
+ it { expect(stub_class.lists.cadeia.value_a.description).to eq('Cadeia AAA Descr.') }
160
+ it { expect(stub_class.lists.cadeia.value_b.description).to eq('Cadeia BB Descr.') }
161
+ it { expect(stub_class.lists.cadeia.value_c.description).to eq('Cadeia C Descr.') }
162
+ it { expect(stub_class.lists.type.value_a.description).to eq('Tipo A Descr.') }
163
+ it { expect(stub_class.lists.type.value_b.description).to eq('Tipo B Descr.') }
115
164
  end
116
165
 
117
- context 'value instance constant name' do
118
- it { expect(Stub.lists.inteiro.value_a.constant_name).to eq('INTEIRO_A') }
119
- it { expect(Stub.lists.inteiro.value_b.constant_name).to eq('INTEIRO_B') }
120
- it { expect(Stub.lists.inteiro.value_c.constant_name).to eq('INTEIRO_C') }
121
- it { expect(Stub.lists.code.value_a.constant_name).to eq('CODE_A') }
122
- it { expect(Stub.lists.code.value_b.constant_name).to eq('CODE_B') }
123
- it { expect(Stub.lists.cadeia.value_a.constant_name).to eq('CADEIA_A') }
124
- it { expect(Stub.lists.cadeia.value_b.constant_name).to eq('CADEIA_B') }
125
- it { expect(Stub.lists.cadeia.value_c.constant_name).to eq('CADEIA_C') }
126
- it { expect(Stub.lists.type.value_a.constant_name).to eq('TYPE_A') }
127
- it { expect(Stub.lists.type.value_b.constant_name).to eq('TYPE_B') }
166
+ describe 'value instance constant name' do
167
+ it { expect(stub_class.lists.inteiro.value_a.constant_name).to eq('INTEIRO_A') }
168
+ it { expect(stub_class.lists.inteiro.value_b.constant_name).to eq('INTEIRO_B') }
169
+ it { expect(stub_class.lists.inteiro.value_c.constant_name).to eq('INTEIRO_C') }
170
+ it { expect(stub_class.lists.code.value_a.constant_name).to eq('CODE_A') }
171
+ it { expect(stub_class.lists.code.value_b.constant_name).to eq('CODE_B') }
172
+ it { expect(stub_class.lists.cadeia.value_a.constant_name).to eq('CADEIA_A') }
173
+ it { expect(stub_class.lists.cadeia.value_b.constant_name).to eq('CADEIA_B') }
174
+ it { expect(stub_class.lists.cadeia.value_c.constant_name).to eq('CADEIA_C') }
175
+ it { expect(stub_class.lists.type.value_a.constant_name).to eq('TYPE_A') }
176
+ it { expect(stub_class.lists.type.value_b.constant_name).to eq('TYPE_B') }
128
177
  end
129
178
 
130
- context 'instance label and descriptions' do
131
- let(:instance) { Stub.new }
179
+ describe 'instance label and descriptions' do
180
+ let(:instance) { stub_class.new }
132
181
 
133
182
  context 'when inteiro value is A' do
134
- before { instance.inteiro = Stub::INTEIRO_A }
183
+ before { instance.inteiro = stub_class::INTEIRO_A }
135
184
 
136
185
  it { expect(instance.inteiro_label).to eq('Inteiro A') }
137
186
  it { expect(instance.inteiro_description).to eq('Inteiro A Descr.') }
138
187
  end
139
188
 
140
- context 'when inteiro value is A' do
141
- before { instance.inteiro = Stub::INTEIRO_B }
189
+ context 'when inteiro value is B' do
190
+ before { instance.inteiro = stub_class::INTEIRO_B }
142
191
 
143
192
  it { expect(instance.inteiro_label).to eq('Inteiro BB') }
144
193
  it { expect(instance.inteiro_description).to eq('Inteiro BB Descr.') }
145
194
  end
146
195
 
147
196
  context 'when inteiro value is C' do
148
- before { instance.inteiro = Stub::INTEIRO_C }
197
+ before { instance.inteiro = stub_class::INTEIRO_C }
149
198
 
150
199
  it { expect(instance.inteiro_label).to eq('Inteiro CCC') }
151
200
  it { expect(instance.inteiro_description).to eq('Inteiro CCC Descr.') }
152
201
  end
153
202
 
203
+ context 'when inteiro value is blank' do
204
+ before { instance.inteiro = nil }
205
+
206
+ it { expect(instance.inteiro_label).to eq('Inteiro em branco') }
207
+ it { expect(instance.inteiro_description).to eq('Inteiro em branco Descr.') }
208
+ end
209
+
154
210
  context 'when code value is A' do
155
- before { instance.code = Stub::CODE_A }
211
+ before { instance.code = stub_class::CODE_A }
156
212
 
157
213
  it { expect(instance.code_label).to eq('Código A') }
158
214
  it { expect(instance.code_description).to eq('Código A Descr.') }
159
215
  end
160
216
 
161
217
  context 'when code value is B' do
162
- before { instance.code = Stub::CODE_B }
218
+ before { instance.code = stub_class::CODE_B }
163
219
 
164
220
  it { expect(instance.code_label).to eq('Código B') }
165
221
  it { expect(instance.code_description).to eq('Código B Descr.') }
166
222
  end
167
223
 
224
+ context 'when code value is blank' do
225
+ before { instance.code = nil }
226
+
227
+ it { expect(instance.code_label).to eq('') }
228
+ it { expect(instance.code_description).to eq('') }
229
+ end
230
+
168
231
  context 'when cadeia value is A' do
169
- before { instance.cadeia = Stub::CADEIA_A }
232
+ before { instance.cadeia = stub_class::CADEIA_A }
170
233
 
171
234
  it { expect(instance.cadeia_label).to eq('Cadeia AAA') }
172
235
  it { expect(instance.cadeia_description).to eq('Cadeia AAA Descr.') }
173
236
  end
174
237
 
175
238
  context 'when cadeia value is B' do
176
- before { instance.cadeia = Stub::CADEIA_B }
239
+ before { instance.cadeia = stub_class::CADEIA_B }
177
240
 
178
241
  it { expect(instance.cadeia_label).to eq('Cadeia BB') }
179
242
  it { expect(instance.cadeia_description).to eq('Cadeia BB Descr.') }
180
243
  end
181
244
 
182
245
  context 'when cadeia value is C' do
183
- before { instance.cadeia = Stub::CADEIA_C }
246
+ before { instance.cadeia = stub_class::CADEIA_C }
184
247
 
185
248
  it { expect(instance.cadeia_label).to eq('Cadeia C') }
186
249
  it { expect(instance.cadeia_description).to eq('Cadeia C Descr.') }
187
250
  end
188
251
 
189
252
  context 'when type value is A' do
190
- before { instance.type = Stub::TYPE_A }
253
+ before { instance.type = stub_class::TYPE_A }
191
254
 
192
255
  it { expect(instance.type_label).to eq('Tipo A') }
193
256
  it { expect(instance.type_description).to eq('Tipo A Descr.') }
194
257
  end
195
258
 
196
259
  context 'when type value is B' do
197
- before { instance.type = Stub::TYPE_B }
260
+ before { instance.type = stub_class::TYPE_B }
198
261
 
199
262
  it { expect(instance.type_label).to eq('Tipo B') }
200
263
  it { expect(instance.type_description).to eq('Tipo B Descr.') }
@@ -202,11 +265,11 @@ RSpec.describe ::EacRubyUtils::Listable do
202
265
  end
203
266
 
204
267
  describe '#value_validate!' do
205
- it { expect { Stub.lists.inteiro.value_validate!(1) }.not_to raise_error }
206
- it { expect { Stub.lists.inteiro.value_validate!('1') }.to raise_error }
207
- it { expect { Stub.lists.inteiro.value_validate!(10) }.to raise_error(::StandardError) }
208
- it { expect { Stub.lists.cadeia.value_validate!(:a) }.to raise_error }
209
- it { expect { Stub.lists.cadeia.value_validate!('a') }.not_to raise_error }
210
- it { expect { Stub.lists.cadeia.value_validate!(:z) }.to raise_error(::StandardError) }
268
+ it { expect { stub_class.lists.inteiro.value_validate!(1) }.not_to raise_error }
269
+ it { expect { stub_class.lists.inteiro.value_validate!('1') }.to raise_error(::StandardError) }
270
+ it { expect { stub_class.lists.inteiro.value_validate!(10) }.to raise_error(::StandardError) }
271
+ it { expect { stub_class.lists.cadeia.value_validate!(:a) }.to raise_error(::StandardError) }
272
+ it { expect { stub_class.lists.cadeia.value_validate!('a') }.not_to raise_error }
273
+ it { expect { stub_class.lists.cadeia.value_validate!(:z) }.to raise_error(::StandardError) }
211
274
  end
212
275
  end
@@ -3,9 +3,13 @@
3
3
  require 'eac_ruby_utils/options_consumer'
4
4
 
5
5
  RSpec.describe ::EacRubyUtils::OptionsConsumer do
6
- context 'instance created with some data' do
6
+ context 'with instance created with some data' do
7
7
  subject(:instance) { described_class.new(a: 'a_value', b: 'b_value', c: 'c_value') }
8
8
 
9
+ let(:consumed_a) { instance.consume(:a) }
10
+ let(:consumed_b) { instance.consume(:b) }
11
+ let(:consumed_c) { instance.consume(:c) }
12
+
9
13
  it 'left data should be Hash' do
10
14
  expect(instance.left_data).to be_a(::Hash)
11
15
  end
@@ -14,16 +18,48 @@ RSpec.describe ::EacRubyUtils::OptionsConsumer do
14
18
  expect { instance.validate }.to raise_error(::StandardError)
15
19
  end
16
20
 
17
- it 'parses args' do
18
- expect(instance.left_data).to eq({ a: 'a_value', b: 'b_value', c: 'c_value' }
21
+ context 'when no data is consumed' do
22
+ it do
23
+ expect(instance.left_data).to eq({ a: 'a_value', b: 'b_value', c: 'c_value' }
19
24
  .with_indifferent_access)
20
- expect(instance.consume(:a)).to eq('a_value')
21
- expect(instance.left_data).to eq({ b: 'b_value', c: 'c_value' }.with_indifferent_access)
22
- expect(instance.consume(:c)).to eq('c_value')
23
- expect(instance.left_data).to eq({ b: 'b_value' }.with_indifferent_access)
24
- expect(instance.consume(:b)).to eq('b_value')
25
- expect(instance.left_data).to eq({}.with_indifferent_access)
26
- instance.validate
25
+ end
26
+
27
+ it { expect(consumed_a).to eq('a_value') }
28
+ end
29
+
30
+ context 'when A value is consumed' do
31
+ before { consumed_a }
32
+
33
+ it do
34
+ expect(instance.left_data).to eq({ b: 'b_value', c: 'c_value' }.with_indifferent_access)
35
+ end
36
+
37
+ it { expect(instance.consume(:c)).to eq('c_value') }
38
+ end
39
+
40
+ context 'when A and C values are consumed' do
41
+ before do
42
+ consumed_a
43
+ consumed_c
44
+ end
45
+
46
+ it { expect(instance.left_data).to eq({ b: 'b_value' }.with_indifferent_access) }
47
+
48
+ it { expect(consumed_b).to eq('b_value') }
49
+ end
50
+
51
+ context 'when all values are consumed' do
52
+ before do
53
+ consumed_a
54
+ consumed_b
55
+ consumed_c
56
+ end
57
+
58
+ it { expect(instance.left_data).to eq({}.with_indifferent_access) }
59
+
60
+ it do
61
+ expect { instance.validate }.not_to raise_error
62
+ end
27
63
  end
28
64
 
29
65
  it 'raises if validate has left data' do
@@ -34,12 +70,11 @@ RSpec.describe ::EacRubyUtils::OptionsConsumer do
34
70
  describe '#consume_all' do
35
71
  subject(:instance) { described_class.new(a: 'a_value', b: 'b_value', c: 'c_value') }
36
72
 
37
- it 'return all options in arguments' do
38
- a, b, c, d = instance.consume_all(:a, :b, :c, :d)
39
- expect(a).to eq('a_value')
40
- expect(b).to eq('b_value')
41
- expect(c).to eq('c_value')
42
- expect(d).to eq(nil)
43
- end
73
+ let(:all_consumed) { instance.consume_all(:a, :b, :c, :d) }
74
+
75
+ it { expect(all_consumed[0]).to eq('a_value') }
76
+ it { expect(all_consumed[1]).to eq('b_value') }
77
+ it { expect(all_consumed[2]).to eq('c_value') }
78
+ it { expect(all_consumed[3]).to eq(nil) }
44
79
  end
45
80
  end
@@ -3,11 +3,13 @@
3
3
  require 'eac_ruby_utils/patches/module/listable'
4
4
 
5
5
  RSpec.describe ::Module do
6
- class StubClass
7
- enable_listable
6
+ let(:stub_class) do
7
+ ::Class.new do
8
+ enable_listable
9
+ end
8
10
  end
9
11
 
10
12
  describe '#enable_listable' do
11
- it { expect(StubClass.included_modules).to include(::EacRubyUtils::Listable) }
13
+ it { expect(stub_class.included_modules).to include(::EacRubyUtils::Listable) }
12
14
  end
13
15
  end
@@ -3,11 +3,13 @@
3
3
  require 'eac_ruby_utils/patches/module/simple_cache'
4
4
 
5
5
  RSpec.describe ::Module do
6
- class StubClass
7
- enable_simple_cache
6
+ let(:stub_class) do
7
+ ::Class.new do
8
+ enable_simple_cache
9
+ end
8
10
  end
9
11
 
10
12
  describe '#enable_simple_cache' do
11
- it { expect(StubClass.included_modules).to include(::EacRubyUtils::SimpleCache) }
13
+ it { expect(stub_class.included_modules).to include(::EacRubyUtils::SimpleCache) }
12
14
  end
13
15
  end
@@ -2,10 +2,10 @@
2
2
 
3
3
  require 'eac_ruby_utils/require_sub'
4
4
 
5
- RSpec.describe ::EacRubyUtils::RequireSub do
6
- class RequireSubStubClass
7
- end
5
+ class RequireSubStubClass
6
+ end
8
7
 
8
+ RSpec.describe ::EacRubyUtils::RequireSub do
9
9
  let(:instance) { described_class.new(__FILE__, base: RequireSubStubClass, include_modules: true) }
10
10
 
11
11
  before do
@@ -3,26 +3,29 @@
3
3
  require 'eac_ruby_utils/settings_provider'
4
4
 
5
5
  RSpec.describe ::EacRubyUtils::SettingsProvider do
6
- class MyStubSettingsProvided
7
- include ::EacRubyUtils::SettingsProvider
8
-
9
- KEY_A = 'constant_a'
10
- KEY_D = 'constant_d'
11
-
12
- def key_a
13
- 'method_a'
14
- end
15
-
16
- def key_b
17
- 'method_b'
18
- end
19
-
20
- def settings
21
- { 'key_b' => 'setting_b', key_c: 'setting_c' }
22
- end
6
+ let(:stub_class) do
7
+ the_described_class = described_class
8
+ r = ::Class.new do
9
+ include the_described_class
10
+
11
+ def key_a
12
+ 'method_a'
13
+ end
14
+
15
+ def key_b
16
+ 'method_b'
17
+ end
18
+
19
+ def settings
20
+ { 'key_b' => 'setting_b', key_c: 'setting_c' }
21
+ end
22
+ end
23
+ r.const_set(:KEY_A, 'constant_a')
24
+ r.const_set(:KEY_D, 'constant_d')
25
+ r
23
26
  end
24
27
 
25
- let(:stub) { MyStubSettingsProvided.new }
28
+ let(:stub) { stub_class.new }
26
29
 
27
30
  describe '#setting_value' do
28
31
  {
@@ -12,6 +12,9 @@ pt-BR:
12
12
  c:
13
13
  label: Inteiro CCC
14
14
  description: Inteiro CCC Descr.
15
+ __blank:
16
+ label: Inteiro em branco
17
+ description: Inteiro em branco Descr.
15
18
  cadeia:
16
19
  a:
17
20
  label: Cadeia AAA
@@ -15,5 +15,5 @@ Gem::Specification.new do |s|
15
15
  s.add_dependency 'eac_config', '~> 0.5'
16
16
  s.add_dependency 'eac_ruby_utils', '~> 0.64'
17
17
 
18
- s.add_development_dependency 'eac_ruby_gem_support', '~> 0.2'
18
+ s.add_development_dependency 'eac_ruby_gem_support', '~> 0.5.1'
19
19
  end
@@ -101,7 +101,7 @@ module EacTemplates
101
101
 
102
102
  def target_absolute
103
103
  ::File.expand_path(source_relative, target_root_directory)
104
- .gsub(/#{::Regexp.quote(TEMPLATE_EXTNAME)}\z/, '')
104
+ .gsub(/#{::Regexp.quote(TEMPLATE_EXTNAME)}\z/, '')
105
105
  end
106
106
  end
107
107
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacTemplates
4
- VERSION = '0.3.0'
4
+ VERSION = '0.3.1'
5
5
  end