eac_tools 0.87.1 → 0.89.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +27 -32
  3. data/lib/eac_tools/version.rb +1 -1
  4. data/sub/avm/lib/avm/applications/base/local_source.rb +6 -1
  5. data/sub/avm/lib/avm/launcher/context/instance_discovery/root_instance_paths.rb +53 -0
  6. data/sub/avm/lib/avm/launcher/context/instance_discovery.rb +25 -6
  7. data/sub/avm/lib/avm/launcher/context.rb +3 -3
  8. data/sub/avm/lib/avm/rspec/setup.rb +2 -1
  9. data/sub/avm/lib/avm/rspec/shared_examples/entries_values.rb +1 -3
  10. data/sub/avm/lib/avm/rspec/shared_examples/with_config.rb +11 -0
  11. data/sub/avm/lib/avm/version.rb +1 -1
  12. data/sub/avm/spec/lib/avm/launcher/context_spec.rb +11 -0
  13. data/sub/avm/spec/lib/avm/launcher/context_spec_files/config.yml +9 -0
  14. data/sub/avm/spec/lib/avm/launcher/instances/base_spec.rb +7 -8
  15. data/sub/avm/spec/lib/avm/launcher/instances/base_spec_files/config.yml +5 -0
  16. data/sub/avm/spec/spec_helper/{eac_launcher.rb → launcher_context.rb} +34 -11
  17. metadata +12 -75
  18. data/sub/avm/spec/lib/avm/launcher/instances/base_spec_files/projects/avm-tools_stub/avm-tools.gemspec +0 -29
  19. data/sub/avm/spec/lib/avm/launcher/instances/base_spec_files/projects/avm-tools_stub/lib/avm/tools/version.rb +0 -7
  20. data/sub/avm/spec/lib/avm/launcher/instances/base_spec_files/projects/avm-tools_stub/lib/avm/tools.rb +0 -6
  21. data/sub/avm/spec/lib/avm/launcher/instances/base_spec_files/projects/ruby_gem_stub/lib/ruby_gem_stub/version.rb +0 -5
  22. data/sub/avm/spec/lib/avm/launcher/instances/base_spec_files/projects/ruby_gem_stub/lib/ruby_gem_stub.rb +0 -3
  23. data/sub/avm/spec/lib/avm/launcher/instances/base_spec_files/projects/ruby_gem_stub/ruby_gem_stub.gemspec +0 -16
  24. data/sub/avm-eac_redmine_base0/Gemfile +0 -8
  25. data/sub/avm-eac_redmine_base0/avm-eac_redmine_base0.gemspec +0 -27
  26. data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/apache_host.rb +0 -12
  27. data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/base/database.rb +0 -30
  28. data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/base/files.rb +0 -22
  29. data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/base/gitolite.rb +0 -55
  30. data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/base/install.rb +0 -46
  31. data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/base/nodejs.rb +0 -22
  32. data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/base/web.rb +0 -20
  33. data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/base.rb +0 -59
  34. data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/deploy.rb +0 -19
  35. data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/docker_image.rb +0 -106
  36. data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/rest_api/entity_base.rb +0 -35
  37. data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/rest_api/project.rb +0 -26
  38. data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/rest_api/root.rb +0 -21
  39. data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/rest_api/wiki_page.rb +0 -54
  40. data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/rest_api.rb +0 -14
  41. data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/runners/docker.rb +0 -17
  42. data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/runners/project/wiki_page/read.rb +0 -27
  43. data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/runners/project/wiki_page/write.rb +0 -70
  44. data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/runners/project/wiki_page.rb +0 -30
  45. data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/runners/project.rb +0 -26
  46. data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/runners/project_rename.rb +0 -56
  47. data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances/runners.rb +0 -14
  48. data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/instances.rb +0 -11
  49. data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/sources/base.rb +0 -36
  50. data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/sources/core_update.rb +0 -131
  51. data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/sources/runners/core_update.rb +0 -65
  52. data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/sources/runners/docker.rb +0 -19
  53. data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/sources/runners.rb +0 -13
  54. data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/sources.rb +0 -11
  55. data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/version.rb +0 -7
  56. data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0.rb +0 -9
  57. data/sub/avm-eac_redmine_base0/locale/en.yml +0 -6
  58. data/sub/avm-eac_redmine_base0/locale/pt-BR.yml +0 -6
  59. data/sub/avm-eac_redmine_base0/spec/lib/avm/eac_redmine_base0/instances/apache_host_spec.rb +0 -22
  60. data/sub/avm-eac_redmine_base0/spec/lib/avm/eac_redmine_base0/instances/apache_host_spec_files/apache_host_spec_no_ssl_content.conf +0 -11
  61. data/sub/avm-eac_redmine_base0/spec/lib/avm/eac_redmine_base0/instances/base/gitolite_spec.rb +0 -26
  62. data/sub/avm-eac_redmine_base0/spec/lib/avm/eac_redmine_base0/instances/base/gitolite_spec_files/config.yml +0 -10
  63. data/sub/avm-eac_redmine_base0/spec/rubocop_spec.rb +0 -3
  64. data/sub/avm-eac_redmine_base0/spec/spec_helper.rb +0 -5
  65. data/sub/avm-eac_redmine_base0/template/avm/eac_redmine_base0/instances/deploy/config/install.sh.template +0 -45
  66. data/sub/avm-eac_redmine_base0/template/avm/eac_redmine_base0/instances/deploy/config/secrets.yml +0 -8
  67. data/sub/avm-eac_redmine_base0/template/avm/eac_redmine_base0/instances/docker_image/Dockerfile.template +0 -33
  68. data/sub/avm-eac_redmine_base0/template/avm/eac_redmine_base0/instances/docker_image/apache_host_dockerfile +0 -8
  69. data/sub/avm-eac_redmine_base0/template/avm/eac_redmine_base0/instances/docker_image/apache_http_virtualhost.conf.template +0 -10
  70. data/sub/avm-eac_redmine_base0/template/avm/eac_redmine_base0/instances/docker_image/apache_https_virtualhost.conf.template +0 -16
  71. data/sub/avm-eac_redmine_base0/template/avm/eac_redmine_base0/instances/docker_image/apache_path_dockerfile +0 -5
  72. data/sub/avm-eac_redmine_base0/template/avm/eac_redmine_base0/instances/docker_image/start.sh.template +0 -52
  73. /data/sub/avm/spec/spec_helper/{eac_launcher → launcher_context}/settings.yml +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f5c10bbe66cf1c052bbe052905fea472ec035ebd128fb31510f12d69473455e2
4
- data.tar.gz: 58558921f126489a6a50e4fe5d79849c85c4232d7151323ed94da810296c54a3
3
+ metadata.gz: 8cb76604a2a0b5232d376cefac3d315c957d4e87b8b6b2580f2c7972f4a88aeb
4
+ data.tar.gz: 17ca5dc90d086d88446991053485c45c9e5a720ab74b1301ee2ff2019aa6cba5
5
5
  SHA512:
6
- metadata.gz: 452a17b87781d7b4321de48220f788b6c884142c9ab10ea37c3f647cd13e5bc4170e8fdeb41a109d54903bea395e07f3d0ae74751525bcc42658161adda66ffe
7
- data.tar.gz: 57a2516fe2033b50be88c0bd6a60197680c276eec534531676c9625e1c0ed6d992df7e19cba8573a930cbf2c677f1fc532d3d4d02222b6dfbdc197ae3c8f31e9
6
+ metadata.gz: 5c9ba6396b64568f48744e4cf59e7d6bcb16c8b1004ad8d079958d44b59828a9333a0add9f36d066ae9aef52f6133ce406bd2efc666105366d2cb102d0b78576
7
+ data.tar.gz: 60f4f4677b47dda6630a9006b1c5467a097cbc7afa7940cba95d5f81311fe60656f9475f6e9d8f9b290c37fdc9790ecbcfb1163c3fe8805d281a3c6501733337
data/Gemfile.lock CHANGED
@@ -1,9 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- eac_tools (0.87.1)
5
- avm (~> 0.90, >= 0.90.1)
6
- avm-eac_asciidoctor_base0 (~> 0.22, >= 0.22.1)
4
+ eac_tools (0.89.0)
5
+ avm (~> 0.91)
6
+ avm-eac_asciidoctor_base0 (~> 0.23)
7
7
  avm-eac_generic_base0 (~> 0.13)
8
8
  avm-eac_github_base0 (~> 0.3)
9
9
  avm-eac_gitlab_base0 (~> 0.4)
@@ -22,23 +22,10 @@ PATH
22
22
  avm-tools (~> 0.161)
23
23
  eac_ruby_utils (~> 0.121)
24
24
 
25
- PATH
26
- remote: sub/avm-eac_redmine_base0
27
- specs:
28
- avm-eac_redmine_base0 (0.22.2)
29
- avm (~> 0.90, >= 0.90.1)
30
- avm-eac_generic_base0 (~> 0.13)
31
- avm-eac_rails_base1 (~> 0.10)
32
- avm-eac_ubuntu_base0 (~> 0.5, >= 0.5.1)
33
- curb (~> 0.9, >= 0.9.11)
34
- eac_fs (~> 0.17)
35
- eac_rest (~> 0.12)
36
- eac_ruby_utils (~> 0.121)
37
-
38
25
  PATH
39
26
  remote: sub/avm
40
27
  specs:
41
- avm (0.90.1)
28
+ avm (0.91.0)
42
29
  eac_cli (~> 0.40, >= 0.40.1)
43
30
  eac_config (~> 0.14, >= 0.14.2)
44
31
  eac_docker (~> 0.7)
@@ -68,9 +55,9 @@ GEM
68
55
  ofx-parser (~> 1.1)
69
56
  asciidoctor (2.0.22)
70
57
  ast (2.4.2)
71
- avm-eac_asciidoctor_base0 (0.22.1)
58
+ avm-eac_asciidoctor_base0 (0.23.0)
72
59
  asciidoctor (~> 2.0, >= 2.0.22)
73
- avm-eac_webapp_base0 (~> 0.18, >= 0.18.4)
60
+ avm-eac_webapp_base0 (~> 0.19)
74
61
  eac_ruby_utils (~> 0.121)
75
62
  os (~> 1.1, >= 1.1.4)
76
63
  rouge (~> 3.30)
@@ -107,6 +94,15 @@ GEM
107
94
  avm-eac_ruby_base1 (~> 0.33)
108
95
  avm-eac_webapp_base0 (~> 0.18, >= 0.18.2)
109
96
  eac_ruby_utils (~> 0.119, >= 0.119.2)
97
+ avm-eac_redmine_base0 (0.22.2)
98
+ avm (~> 0.90, >= 0.90.1)
99
+ avm-eac_generic_base0 (~> 0.13)
100
+ avm-eac_rails_base1 (~> 0.10)
101
+ avm-eac_ubuntu_base0 (~> 0.5, >= 0.5.1)
102
+ curb (~> 0.9, >= 0.9.11)
103
+ eac_fs (~> 0.17)
104
+ eac_rest (~> 0.12)
105
+ eac_ruby_utils (~> 0.121)
110
106
  avm-eac_redmine_plugin_base0 (0.4.1)
111
107
  avm-eac_ruby_base1 (~> 0.33, >= 0.33.1)
112
108
  eac_ruby_utils (~> 0.121)
@@ -218,7 +214,7 @@ GEM
218
214
  faraday-multipart (1.0.4)
219
215
  multipart-post (~> 2)
220
216
  faraday-net_http (3.0.2)
221
- faraday-retry (2.2.0)
217
+ faraday-retry (2.2.1)
222
218
  faraday (~> 2.0)
223
219
  filesize (0.2.0)
224
220
  git (1.19.1)
@@ -226,13 +222,13 @@ GEM
226
222
  rchardet (~> 1.8)
227
223
  hpricot (0.8.6)
228
224
  htmlbeautifier (1.4.3)
229
- i18n (1.14.4)
225
+ i18n (1.14.5)
230
226
  concurrent-ruby (~> 1.0)
231
227
  json (2.7.2)
232
228
  language_server-protocol (3.17.0.3)
233
229
  minitar (0.9)
234
230
  minitest (5.22.3)
235
- multipart-post (2.4.0)
231
+ multipart-post (2.4.1)
236
232
  net-ssh (4.2.0)
237
233
  nokogiri (1.15.6-x86_64-linux)
238
234
  racc (~> 1.4)
@@ -241,7 +237,7 @@ GEM
241
237
  os (1.1.4)
242
238
  parallel (1.24.0)
243
239
  parseconfig (1.1.2)
244
- parser (3.3.0.5)
240
+ parser (3.3.1.0)
245
241
  ast (~> 2.4.1)
246
242
  racc
247
243
  parslet (2.0.0)
@@ -249,10 +245,10 @@ GEM
249
245
  tty-color (~> 0.5)
250
246
  public_suffix (5.0.5)
251
247
  racc (1.7.3)
252
- rack (3.0.10)
248
+ rack (3.0.11)
253
249
  rainbow (3.1.1)
254
250
  rchardet (1.8.0)
255
- regexp_parser (2.9.0)
251
+ regexp_parser (2.9.1)
256
252
  rexml (3.2.6)
257
253
  rouge (3.30.0)
258
254
  rspec (3.13.0)
@@ -264,11 +260,11 @@ GEM
264
260
  rspec-expectations (3.13.0)
265
261
  diff-lcs (>= 1.2.0, < 2.0)
266
262
  rspec-support (~> 3.13.0)
267
- rspec-mocks (3.13.0)
263
+ rspec-mocks (3.13.1)
268
264
  diff-lcs (>= 1.2.0, < 2.0)
269
265
  rspec-support (~> 3.13.0)
270
266
  rspec-support (3.13.1)
271
- rubocop (1.63.0)
267
+ rubocop (1.63.5)
272
268
  json (~> 2.3)
273
269
  language_server-protocol (>= 3.17.0)
274
270
  parallel (~> 1.10)
@@ -279,8 +275,8 @@ GEM
279
275
  rubocop-ast (>= 1.31.1, < 2.0)
280
276
  ruby-progressbar (~> 1.7)
281
277
  unicode-display_width (>= 2.4.0, < 3.0)
282
- rubocop-ast (1.31.2)
283
- parser (>= 3.3.0.4)
278
+ rubocop-ast (1.31.3)
279
+ parser (>= 3.3.1.0)
284
280
  rubocop-capybara (2.20.0)
285
281
  rubocop (~> 1.41)
286
282
  rubocop-factory_bot (2.25.1)
@@ -290,12 +286,12 @@ GEM
290
286
  rack (>= 1.1)
291
287
  rubocop (>= 1.33.0, < 2.0)
292
288
  rubocop-ast (>= 1.31.1, < 2.0)
293
- rubocop-rspec (2.29.1)
289
+ rubocop-rspec (2.29.2)
294
290
  rubocop (~> 1.40)
295
291
  rubocop-capybara (~> 2.17)
296
292
  rubocop-factory_bot (~> 2.22)
297
293
  rubocop-rspec_rails (~> 2.28)
298
- rubocop-rspec_rails (2.28.2)
294
+ rubocop-rspec_rails (2.28.3)
299
295
  rubocop (~> 1.40)
300
296
  ruby-filemagic (0.7.3)
301
297
  ruby-progressbar (1.13.0)
@@ -323,7 +319,6 @@ PLATFORMS
323
319
 
324
320
  DEPENDENCIES
325
321
  avm!
326
- avm-eac_redmine_base0!
327
322
  eac_ruby_gem_support (~> 0.10)
328
323
  eac_tools!
329
324
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacTools
4
- VERSION = '0.87.1'
4
+ VERSION = '0.89.0'
5
5
  end
@@ -10,7 +10,7 @@ module Avm
10
10
  module LocalSource
11
11
  # @return [Pathname]
12
12
  def local_source_path
13
- (local_source_path_entry.value || auto_local_source_path).to_pathname
13
+ user_local_source_path || auto_local_source_path
14
14
  end
15
15
 
16
16
  # @return [EacConfig::Entry]
@@ -18,6 +18,11 @@ module Avm
18
18
  ::EacConfig::Node.context.current.entry([local_instance_id, 'install', 'path'])
19
19
  end
20
20
 
21
+ # @return [Path, nil]
22
+ def user_local_source_path
23
+ local_source_path_entry.value.if_present(&:to_pathname)
24
+ end
25
+
21
26
  private
22
27
 
23
28
  # @return [Avm::Sources::Base]
@@ -0,0 +1,53 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'ruby-progressbar'
4
+ require 'avm/launcher/instances/base'
5
+ require 'eac_ruby_utils/core_ext'
6
+
7
+ module Avm
8
+ module Launcher
9
+ class Context
10
+ class InstanceDiscovery
11
+ class RootInstancePaths
12
+ acts_as_instance_method
13
+ enable_speaker
14
+
15
+ common_constructor :owner
16
+
17
+ # @return [Array<Avm::Launcher::Paths::Logical>]
18
+ def result
19
+ application_user_local_source_paths.map do |path|
20
+ ::Avm::Launcher::Paths::Logical.new(owner.context, nil, path.to_path,
21
+ "/#{path.basename}")
22
+ end
23
+ end
24
+
25
+ private
26
+
27
+ # @param application [Avm::Applications::Base]
28
+ # @return [Pathname, nil]
29
+ def application_user_local_source_path(application) # rubocop:disable Metrics/MethodLength
30
+ if application.user_local_source_path.blank?
31
+ warn "Application \"#{application}\" does not have a user local source set"
32
+ nil
33
+ elsif application.user_local_source_path.directory?
34
+ infov application,
35
+ "user local source found in \"#{application.user_local_source_path}"
36
+ application.user_local_source_path
37
+ else
38
+ warn "Application \"#{application}\"'s local source path is not a directory"
39
+ nil
40
+ end
41
+ end
42
+
43
+ # @return [Array<Pathname>]
44
+ def application_user_local_source_paths
45
+ ::Avm::Registry.applications.available.sort_by { |a| [a.id] }.map do |application|
46
+ application_user_local_source_path(application)
47
+ end.compact_blank.uniq.sort
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
@@ -2,23 +2,34 @@
2
2
 
3
3
  require 'ruby-progressbar'
4
4
  require 'avm/launcher/instances/base'
5
+ require 'eac_ruby_utils/core_ext'
5
6
 
6
7
  module Avm
7
8
  module Launcher
8
9
  class Context
9
10
  class InstanceDiscovery
10
- attr_reader :instances
11
+ enable_simple_cache
11
12
 
12
- def initialize(context)
13
- @context = context
13
+ # @!method instances
14
+ # @return [Array<Avm::Launcher::Instances::Base>]
15
+
16
+ # @!method initialize(context)
17
+ # @param context [Avm::Launcher::Context]
18
+ common_constructor :context
19
+
20
+ private
21
+
22
+ # @return [Array<Avm::Launcher::Instances::Base>]
23
+ def instances_uncached
14
24
  @progress = ::ProgressBar.create(title: 'Instance discovery', total: 1)
15
- @instances = path_instances(@context.root, nil)
25
+ root_instance_paths.flat_map { |path| path_instances(path, nil) }
16
26
  ensure
17
27
  @progress&.finish
18
28
  end
19
29
 
20
- private
21
-
30
+ # @param path [Avm::Launcher::Paths::Logical]
31
+ # @param parent_instance [Avm::Launcher::Instances::Base]
32
+ # @return [Array<Avm::Launcher::Instances::Base>]
22
33
  def path_instances(path, parent_instance)
23
34
  update_progress_format(path)
24
35
  on_rescued_path_instances(path) do |r|
@@ -32,6 +43,8 @@ module Avm
32
43
  end
33
44
  end
34
45
 
46
+ # @param path [Avm::Launcher::Paths::Logical]
47
+ # @return [Array<Avm::Launcher::Instances::Base>]
35
48
  def on_rescued_path_instances(path)
36
49
  r = []
37
50
  begin
@@ -42,14 +55,20 @@ module Avm
42
55
  r
43
56
  end
44
57
 
58
+ # @param path [Avm::Launcher::Paths::Logical]
59
+ # @return [void]
45
60
  def update_progress_format(path)
46
61
  @progress.format = "%t (Paths: %c/%C, Current: #{path.logical}) |%B| %a"
47
62
  end
48
63
 
64
+ # @param path [Array<Avm::Launcher::Paths::Logical>]
65
+ # @return [void]
49
66
  def update_progress_count(children)
50
67
  @progress.total += children.count
51
68
  @progress.increment
52
69
  end
70
+
71
+ require_sub __FILE__, require_mode: :kernel
53
72
  end
54
73
  end
55
74
  end
@@ -29,14 +29,14 @@ module Avm
29
29
  end
30
30
  end
31
31
 
32
- attr_reader :root, :settings, :cache_root
32
+ attr_reader :settings, :cache_root
33
33
  attr_accessor :publish_options, :recache, :instance_manager
34
34
 
35
35
  CONFIG_PATH_PREFIX = 'launcher'
36
+ FS_OBJECT_ID = 'unique'
36
37
 
37
38
  def initialize(options = {})
38
39
  @options = options.with_indifferent_access
39
- @root = ::Avm::Launcher::Paths::Logical.new(self, nil, build_option(:projects_root), '/')
40
40
  @settings = ::Avm::Launcher::Context::Settings.new(build_option(:settings_file))
41
41
  @cache_root = build_option(:cache_root)
42
42
  @publish_options = { new: false, confirm: false, stereotype: nil }
@@ -45,7 +45,7 @@ module Avm
45
45
  end
46
46
 
47
47
  def fs_object_id
48
- root.real.variableize
48
+ FS_OBJECT_ID
49
49
  end
50
50
 
51
51
  def instance(name)
@@ -8,7 +8,8 @@ module Avm
8
8
  module Setup
9
9
  require_sub __FILE__
10
10
  EXAMPLES = %w[avm_file_formats_with_fixtures avm_file_format_file_resource_name
11
- avm_source_generated entries_values in_avm_registry not_in_avm_registry].freeze
11
+ avm_source_generated entries_values in_avm_registry not_in_avm_registry
12
+ with_config].freeze
12
13
 
13
14
  def self.extended(obj)
14
15
  obj.setup_examples
@@ -4,9 +4,7 @@ require 'eac_ruby_utils/core_ext'
4
4
 
5
5
  RSpec.shared_examples 'entries_values' do |spec_file, expected_values|
6
6
  describe '#read_entry' do
7
- config_path = spec_file.to_pathname
8
- config_path = config_path.dirname.join("#{config_path.basename_noext}_files", 'config.yml')
9
- EacRubyUtils::Rspec.default_setup.stub_eac_config_node(self, config_path)
7
+ include_examples 'with_config', spec_file
10
8
 
11
9
  expected_values.each do |instance_id, values|
12
10
  values.each do |input, expected|
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ RSpec.shared_examples 'with_config' do |spec_file|
6
+ config_path = spec_file.to_pathname
7
+ config_path = config_path.dirname.join("#{config_path.basename_noext}_files", 'config.yml')
8
+ temp_config_path = EacRubyUtils::Fs::Temp.file
9
+ FileUtils.cp(config_path, temp_config_path)
10
+ EacRubyUtils::Rspec.default_setup.stub_eac_config_node(self, temp_config_path)
11
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Avm
4
- VERSION = '0.90.1'
4
+ VERSION = '0.91.0'
5
5
  end
@@ -4,7 +4,16 @@ require 'avm/launcher/context'
4
4
  require 'avm/launcher/stereotype'
5
5
 
6
6
  RSpec.describe Avm::Launcher::Context do
7
+ include_context 'with launcher'
8
+ include_examples 'with_config', __FILE__
9
+
7
10
  describe '#instances' do
11
+ before do
12
+ %w[avm-tools_stub ruby_gem_stub].each do |id|
13
+ application_source_path(id, DUMMY_DIR.to_pathname.join(id))
14
+ end
15
+ end
16
+
8
17
  it 'returns all stub instances' do
9
18
  is = described_class.current.instances.map(&:name)
10
19
  expect(is).to contain_exactly('/avm-tools_stub', '/ruby_gem_stub')
@@ -30,6 +39,7 @@ RSpec.describe Avm::Launcher::Context do
30
39
  before do
31
40
  temp_context(File.join(__dir__, 'context_spec.yml'))
32
41
  mylib_repos
42
+ application_source_path('app', File.join(projects_root, 'app'))
33
43
  end
34
44
 
35
45
  context 'when sub is a GitSubrepo' do
@@ -81,6 +91,7 @@ RSpec.describe Avm::Launcher::Context do
81
91
  touch_commit(app, 'file1')
82
92
  app.execute!('subtree', 'add', '-P', 'mylib', mylib_repos, 'master')
83
93
  app.execute!('remote', 'add', 'mylib', mylib_repos)
94
+ application_source_path('subtree_main_app', app.root_path)
84
95
  end
85
96
 
86
97
  it 'recognizes subtree instance' do # rubocop:disable RSpec/MultipleExpectations
@@ -0,0 +1,9 @@
1
+ ---
2
+ app:
3
+ avm_type: Application
4
+ avm-tools_stub:
5
+ avm_type: Application
6
+ ruby_gem_stub:
7
+ avm_type: Application
8
+ subtree_main_app:
9
+ avm_type: Application
@@ -4,20 +4,19 @@ require 'avm/launcher/context'
4
4
  require 'avm/launcher/instances/base'
5
5
 
6
6
  RSpec.describe Avm::Launcher::Instances::Base do
7
+ include_context 'with launcher'
7
8
  let(:fixtures_dir) { __dir__.to_pathname.join('base_spec_files') }
8
- let(:launcher_context) do
9
- Avm::Launcher::Context.current = Avm::Launcher::Context.new(
10
- projects_root: fixtures_dir.join('projects').to_path,
11
- settings_file: fixtures_dir.join('settings.yaml').to_path,
12
- cache_root: Dir.mktmpdir
13
- )
14
- end
15
9
 
16
10
  before do
17
11
  allow(ProgressBar).to receive(:create).and_return(double.as_null_object)
18
- Avm::Launcher::Context.current = launcher_context
12
+ context_set(fixtures_dir.join('settings.yaml').to_path, DUMMY_DIR)
13
+ %w[avm-tools_stub ruby_gem_stub].each do |id|
14
+ application_source_path(id, File.join(projects_root, id))
15
+ end
19
16
  end
20
17
 
18
+ include_examples 'with_config', __FILE__
19
+
21
20
  describe '#options' do
22
21
  context 'when instance is "avm-tools_stub"' do
23
22
  let(:instance) { Avm::Launcher::Context.current.instance('/avm-tools_stub') }
@@ -0,0 +1,5 @@
1
+ ---
2
+ avm-tools_stub:
3
+ avm_type: Application
4
+ ruby_gem_stub:
5
+ avm_type: Application
@@ -1,47 +1,70 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  DUMMY_DIR = File.expand_path('../dummy', __dir__)
4
- ROOT_DIR = File.expand_path('../..', __dir__)
5
4
 
6
- require 'avm/launcher/context'
7
-
8
- RSpec.configure do |config|
9
- config.before do
5
+ RSpec.shared_context 'with launcher' do
6
+ before do
10
7
  require 'avm/launcher/context'
11
8
  Avm::Launcher::Context.current = Avm::Launcher::Context.new(
12
9
  projects_root: DUMMY_DIR,
13
- settings_file: File.join(__dir__, 'eac_launcher', 'settings.yml'),
10
+ settings_file: File.join(__dir__, 'launcher_context', 'settings.yml'),
14
11
  cache_root: Dir.mktmpdir
15
12
  )
16
13
  @remotes_dir = Dir.mktmpdir
17
14
  allow(ProgressBar).to receive(:create).and_return(double.as_null_object)
18
15
  end
19
16
 
20
- def temp_context(settings_path)
17
+ # @param application_id [String]
18
+ # @param path [Pathname]
19
+ # @return void
20
+ def application_source_path(application_id, path)
21
+ EacConfig::Node.context.current.entry("#{application_id}_dev.install.path").value =
22
+ path.to_pathname.to_path
23
+ end
24
+
25
+ # @param settings_path [Pathname]
26
+ # @param projects_root [Pathname]
27
+ def context_set(settings_path, projects_root)
21
28
  require 'avm/launcher/context'
22
29
  require 'tmpdir'
23
30
  Avm::Launcher::Context.current = Avm::Launcher::Context.new(
24
- projects_root: Dir.mktmpdir, settings_file: settings_path, cache_root: Dir.mktmpdir
31
+ settings_file: settings_path.to_pathname.to_path,
32
+ cache_root: Dir.mktmpdir
25
33
  )
34
+ self.projects_root = projects_root
35
+ end
36
+
37
+ # @param settings_path [Pathname]
38
+ def temp_context(settings_path)
39
+ context_set(settings_path, Dir.mktmpdir)
26
40
  end
27
41
 
28
42
  def init_remote(name)
29
43
  require 'avm/git/launcher/base'
30
- r = Avm::Git::Launcher::Base.new(File.join(@remotes_dir, name))
44
+ r = Avm::Git::Launcher::Base.new(File.join(@remotes_dir, name)) # rubocop:disable RSpec/InstanceVariable
31
45
  r.init_bare
32
46
  r
33
47
  end
34
48
 
35
49
  def init_git(subdir)
36
50
  require 'avm/git/launcher/base'
37
- r = Avm::Git::Launcher::Base.new(File.join(Avm::Launcher::Context.current.root.real,
38
- subdir))
51
+ r = Avm::Git::Launcher::Base.new(File.join(projects_root, subdir))
39
52
  r.git
40
53
  r.execute!('config', 'user.email', 'theuser@example.net')
41
54
  r.execute!('config', 'user.name', 'The User')
42
55
  r
43
56
  end
44
57
 
58
+ # @param path [String]
59
+ def projects_root
60
+ @projects_root ||= Dir.mktmpdir
61
+ end
62
+
63
+ # @param path [Pathname]
64
+ def projects_root=(path)
65
+ @projects_root = path.to_pathname.to_path
66
+ end
67
+
45
68
  def touch_commit(repos, subpath)
46
69
  require 'fileutils'
47
70
  FileUtils.mkdir_p(File.dirname(repos.subpath(subpath)))