dapp 0.6.1 → 0.6.2

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.
Files changed (127) hide show
  1. checksums.yaml +4 -4
  2. data/bin/dapp +3 -3
  3. data/config/en/common.yml +19 -4
  4. data/config/en/net_status.yml +13 -4
  5. data/lib/dapp.rb +48 -16
  6. data/lib/dapp/application.rb +75 -40
  7. data/lib/dapp/application/path.rb +3 -2
  8. data/lib/dapp/application/stages.rb +59 -0
  9. data/lib/dapp/artifact.rb +22 -0
  10. data/lib/dapp/build/stage/after_install_artifact.rb +13 -0
  11. data/lib/dapp/build/stage/after_setup_artifact.rb +17 -0
  12. data/lib/dapp/build/stage/artifact_base.rb +80 -0
  13. data/lib/dapp/build/stage/artifact_default.rb +62 -0
  14. data/lib/dapp/build/stage/base.rb +47 -12
  15. data/lib/dapp/build/stage/before_install.rb +6 -5
  16. data/lib/dapp/build/stage/before_install_artifact.rb +13 -0
  17. data/lib/dapp/build/stage/before_setup.rb +7 -8
  18. data/lib/dapp/build/stage/before_setup_artifact.rb +13 -0
  19. data/lib/dapp/build/stage/build_artifact.rb +32 -0
  20. data/lib/dapp/build/stage/docker_instructions.rb +4 -22
  21. data/lib/dapp/build/stage/from.rb +7 -8
  22. data/lib/dapp/build/stage/ga_archive.rb +1 -1
  23. data/lib/dapp/build/stage/ga_archive_dependencies.rb +1 -1
  24. data/lib/dapp/build/stage/ga_artifact_patch.rb +21 -0
  25. data/lib/dapp/build/stage/ga_base.rb +6 -29
  26. data/lib/dapp/build/stage/ga_dependencies_base.rb +4 -13
  27. data/lib/dapp/build/stage/ga_latest_patch.rb +2 -2
  28. data/lib/dapp/build/stage/import_artifact.rb +69 -0
  29. data/lib/dapp/build/stage/install/ga_post_install_patch.rb +1 -1
  30. data/lib/dapp/build/stage/install/ga_post_install_patch_dependencies.rb +1 -1
  31. data/lib/dapp/build/stage/install/ga_pre_install_patch_dependencies.rb +1 -7
  32. data/lib/dapp/build/stage/install/install.rb +12 -7
  33. data/lib/dapp/build/stage/mod/logging.rb +10 -7
  34. data/lib/dapp/build/stage/setup/chef_cookbooks.rb +3 -4
  35. data/lib/dapp/build/stage/setup/ga_post_setup_patch.rb +1 -1
  36. data/lib/dapp/build/stage/setup/ga_pre_setup_patch.rb +2 -2
  37. data/lib/dapp/build/stage/setup/ga_pre_setup_patch_dependencies.rb +2 -8
  38. data/lib/dapp/build/stage/setup/setup.rb +12 -7
  39. data/lib/dapp/builder/base.rb +13 -1
  40. data/lib/dapp/builder/chef.rb +125 -79
  41. data/lib/dapp/builder/chef/cookbook_metadata.rb +1 -1
  42. data/lib/dapp/builder/shell.rb +2 -3
  43. data/lib/dapp/cli.rb +3 -3
  44. data/lib/dapp/cli/base.rb +0 -2
  45. data/lib/dapp/cli/bp.rb +0 -4
  46. data/lib/dapp/cli/build.rb +3 -7
  47. data/lib/dapp/cli/cleanup.rb +0 -2
  48. data/lib/dapp/cli/list.rb +0 -2
  49. data/lib/dapp/cli/mrproper.rb +22 -0
  50. data/lib/dapp/cli/push.rb +4 -3
  51. data/lib/dapp/cli/run.rb +0 -2
  52. data/lib/dapp/cli/spush.rb +0 -2
  53. data/lib/dapp/cli/stage_image.rb +24 -0
  54. data/lib/dapp/cli/stages.rb +7 -5
  55. data/lib/dapp/cli/stages/cleanup_local.rb +28 -0
  56. data/lib/dapp/cli/stages/cleanup_repo.rb +24 -0
  57. data/lib/dapp/cli/stages/{flush.rb → flush_local.rb} +4 -6
  58. data/lib/dapp/cli/stages/{cleanup.rb → flush_repo.rb} +4 -6
  59. data/lib/dapp/cli/stages/pull.rb +28 -0
  60. data/lib/dapp/cli/stages/push.rb +24 -0
  61. data/lib/dapp/config/application.rb +185 -44
  62. data/lib/dapp/config/artifact.rb +10 -50
  63. data/lib/dapp/config/directive/artifact.rb +77 -0
  64. data/lib/dapp/config/directive/build_dir.rb +9 -0
  65. data/lib/dapp/config/directive/chef.rb +95 -0
  66. data/lib/dapp/config/directive/docker/artifact.rb +26 -0
  67. data/lib/dapp/config/directive/docker/base.rb +91 -0
  68. data/lib/dapp/config/directive/git_artifact.rb +59 -0
  69. data/lib/dapp/config/directive/shell/artifact.rb +38 -0
  70. data/lib/dapp/config/directive/shell/base.rb +85 -0
  71. data/lib/dapp/config/directive/tmp_dir.rb +36 -0
  72. data/lib/dapp/config/main.rb +1 -7
  73. data/lib/dapp/core_ext/hash.rb +21 -0
  74. data/lib/dapp/docker_registry/base.rb +60 -5
  75. data/lib/dapp/docker_registry/mod/request.rb +2 -14
  76. data/lib/dapp/git_artifact.rb +32 -23
  77. data/lib/dapp/git_repo/base.rb +1 -1
  78. data/lib/dapp/image/argument.rb +3 -3
  79. data/lib/dapp/image/docker.rb +13 -16
  80. data/lib/dapp/image/scratch.rb +29 -0
  81. data/lib/dapp/image/stage.rb +33 -23
  82. data/lib/dapp/lock/base.rb +18 -11
  83. data/lib/dapp/lock/file.rb +18 -16
  84. data/lib/dapp/prctl.rb +1 -0
  85. data/lib/dapp/project.rb +22 -9
  86. data/lib/dapp/project/command/bp.rb +2 -5
  87. data/lib/dapp/project/command/build.rb +1 -2
  88. data/lib/dapp/project/command/cleanup.rb +9 -7
  89. data/lib/dapp/project/command/common.rb +37 -12
  90. data/lib/dapp/project/command/mrproper.rb +57 -0
  91. data/lib/dapp/project/command/push.rb +8 -2
  92. data/lib/dapp/project/command/run.rb +1 -1
  93. data/lib/dapp/project/command/stage_image.rb +15 -0
  94. data/lib/dapp/project/command/stages/cleanup_local.rb +100 -0
  95. data/lib/dapp/project/command/stages/cleanup_repo.rb +65 -0
  96. data/lib/dapp/project/command/stages/common.rb +48 -0
  97. data/lib/dapp/project/command/stages/flush_local.rb +24 -0
  98. data/lib/dapp/project/command/stages/flush_repo.rb +22 -0
  99. data/lib/dapp/project/command/stages/pull.rb +26 -0
  100. data/lib/dapp/project/command/stages/push.rb +22 -0
  101. data/lib/dapp/project/dappfile.rb +3 -1
  102. data/lib/dapp/project/deps/base.rb +52 -0
  103. data/lib/dapp/project/deps/gitartifact.rb +36 -0
  104. data/lib/dapp/project/lock.rb +20 -13
  105. data/lib/dapp/project/logging/base.rb +20 -3
  106. data/lib/dapp/project/logging/i18n.rb +25 -0
  107. data/lib/dapp/project/logging/paint.rb +47 -0
  108. data/lib/dapp/project/logging/process.rb +17 -10
  109. data/lib/dapp/project/shellout/base.rb +74 -0
  110. data/lib/dapp/project/shellout/streaming.rb +49 -0
  111. data/lib/dapp/project/shellout/system.rb +72 -0
  112. data/lib/dapp/project/ssh_agent.rb +8 -9
  113. data/lib/dapp/version.rb +1 -1
  114. metadata +48 -17
  115. data/lib/dapp/build/stage/artifact.rb +0 -40
  116. data/lib/dapp/build/stage/mod/artifact.rb +0 -79
  117. data/lib/dapp/config/chef.rb +0 -51
  118. data/lib/dapp/config/docker.rb +0 -82
  119. data/lib/dapp/config/git_artifact.rb +0 -51
  120. data/lib/dapp/config/shell.rb +0 -64
  121. data/lib/dapp/helper/i18n.rb +0 -20
  122. data/lib/dapp/helper/paint.rb +0 -27
  123. data/lib/dapp/helper/shellout.rb +0 -63
  124. data/lib/dapp/helper/streaming.rb +0 -47
  125. data/lib/dapp/project/command/stages_cleanup.rb +0 -72
  126. data/lib/dapp/project/command/stages_flush.rb +0 -20
  127. data/lib/dapp/project/paint.rb +0 -16
@@ -1,5 +1,5 @@
1
1
  # Version
2
2
  module Dapp
3
- VERSION = '0.6.1'.freeze
3
+ VERSION = '0.6.2'.freeze
4
4
  BUILD_CACHE_VERSION = 3
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dapp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitry Stolyarov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-30 00:00:00.000000000 Z
11
+ date: 2016-10-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mixlib-shellout
@@ -349,24 +349,33 @@ files:
349
349
  - lib/dapp/application.rb
350
350
  - lib/dapp/application/git_artifact.rb
351
351
  - lib/dapp/application/path.rb
352
+ - lib/dapp/application/stages.rb
352
353
  - lib/dapp/application/tags.rb
353
- - lib/dapp/build/stage/artifact.rb
354
+ - lib/dapp/artifact.rb
355
+ - lib/dapp/build/stage/after_install_artifact.rb
356
+ - lib/dapp/build/stage/after_setup_artifact.rb
357
+ - lib/dapp/build/stage/artifact_base.rb
358
+ - lib/dapp/build/stage/artifact_default.rb
354
359
  - lib/dapp/build/stage/base.rb
355
360
  - lib/dapp/build/stage/before_install.rb
361
+ - lib/dapp/build/stage/before_install_artifact.rb
356
362
  - lib/dapp/build/stage/before_setup.rb
363
+ - lib/dapp/build/stage/before_setup_artifact.rb
364
+ - lib/dapp/build/stage/build_artifact.rb
357
365
  - lib/dapp/build/stage/docker_instructions.rb
358
366
  - lib/dapp/build/stage/from.rb
359
367
  - lib/dapp/build/stage/ga_archive.rb
360
368
  - lib/dapp/build/stage/ga_archive_dependencies.rb
369
+ - lib/dapp/build/stage/ga_artifact_patch.rb
361
370
  - lib/dapp/build/stage/ga_base.rb
362
371
  - lib/dapp/build/stage/ga_dependencies_base.rb
363
372
  - lib/dapp/build/stage/ga_latest_patch.rb
373
+ - lib/dapp/build/stage/import_artifact.rb
364
374
  - lib/dapp/build/stage/install/ga_post_install_patch.rb
365
375
  - lib/dapp/build/stage/install/ga_post_install_patch_dependencies.rb
366
376
  - lib/dapp/build/stage/install/ga_pre_install_patch.rb
367
377
  - lib/dapp/build/stage/install/ga_pre_install_patch_dependencies.rb
368
378
  - lib/dapp/build/stage/install/install.rb
369
- - lib/dapp/build/stage/mod/artifact.rb
370
379
  - lib/dapp/build/stage/mod/group.rb
371
380
  - lib/dapp/build/stage/mod/logging.rb
372
381
  - lib/dapp/build/stage/setup/chef_cookbooks.rb
@@ -387,19 +396,31 @@ files:
387
396
  - lib/dapp/cli/build.rb
388
397
  - lib/dapp/cli/cleanup.rb
389
398
  - lib/dapp/cli/list.rb
399
+ - lib/dapp/cli/mrproper.rb
390
400
  - lib/dapp/cli/push.rb
391
401
  - lib/dapp/cli/run.rb
392
402
  - lib/dapp/cli/spush.rb
403
+ - lib/dapp/cli/stage_image.rb
393
404
  - lib/dapp/cli/stages.rb
394
- - lib/dapp/cli/stages/cleanup.rb
395
- - lib/dapp/cli/stages/flush.rb
405
+ - lib/dapp/cli/stages/cleanup_local.rb
406
+ - lib/dapp/cli/stages/cleanup_repo.rb
407
+ - lib/dapp/cli/stages/flush_local.rb
408
+ - lib/dapp/cli/stages/flush_repo.rb
409
+ - lib/dapp/cli/stages/pull.rb
410
+ - lib/dapp/cli/stages/push.rb
396
411
  - lib/dapp/config/application.rb
397
412
  - lib/dapp/config/artifact.rb
398
- - lib/dapp/config/chef.rb
399
- - lib/dapp/config/docker.rb
400
- - lib/dapp/config/git_artifact.rb
413
+ - lib/dapp/config/directive/artifact.rb
414
+ - lib/dapp/config/directive/build_dir.rb
415
+ - lib/dapp/config/directive/chef.rb
416
+ - lib/dapp/config/directive/docker/artifact.rb
417
+ - lib/dapp/config/directive/docker/base.rb
418
+ - lib/dapp/config/directive/git_artifact.rb
419
+ - lib/dapp/config/directive/shell/artifact.rb
420
+ - lib/dapp/config/directive/shell/base.rb
421
+ - lib/dapp/config/directive/tmp_dir.rb
401
422
  - lib/dapp/config/main.rb
402
- - lib/dapp/config/shell.rb
423
+ - lib/dapp/core_ext/hash.rb
403
424
  - lib/dapp/docker_registry.rb
404
425
  - lib/dapp/docker_registry/base.rb
405
426
  - lib/dapp/docker_registry/default.rb
@@ -423,15 +444,12 @@ files:
423
444
  - lib/dapp/git_repo/own.rb
424
445
  - lib/dapp/git_repo/remote.rb
425
446
  - lib/dapp/helper/cli.rb
426
- - lib/dapp/helper/i18n.rb
427
447
  - lib/dapp/helper/net_status.rb
428
- - lib/dapp/helper/paint.rb
429
448
  - lib/dapp/helper/sha256.rb
430
- - lib/dapp/helper/shellout.rb
431
- - lib/dapp/helper/streaming.rb
432
449
  - lib/dapp/helper/trivia.rb
433
450
  - lib/dapp/image/argument.rb
434
451
  - lib/dapp/image/docker.rb
452
+ - lib/dapp/image/scratch.rb
435
453
  - lib/dapp/image/stage.rb
436
454
  - lib/dapp/lock/base.rb
437
455
  - lib/dapp/lock/error.rb
@@ -443,16 +461,29 @@ files:
443
461
  - lib/dapp/project/command/cleanup.rb
444
462
  - lib/dapp/project/command/common.rb
445
463
  - lib/dapp/project/command/list.rb
464
+ - lib/dapp/project/command/mrproper.rb
446
465
  - lib/dapp/project/command/push.rb
447
466
  - lib/dapp/project/command/run.rb
448
467
  - lib/dapp/project/command/spush.rb
449
- - lib/dapp/project/command/stages_cleanup.rb
450
- - lib/dapp/project/command/stages_flush.rb
468
+ - lib/dapp/project/command/stage_image.rb
469
+ - lib/dapp/project/command/stages/cleanup_local.rb
470
+ - lib/dapp/project/command/stages/cleanup_repo.rb
471
+ - lib/dapp/project/command/stages/common.rb
472
+ - lib/dapp/project/command/stages/flush_local.rb
473
+ - lib/dapp/project/command/stages/flush_repo.rb
474
+ - lib/dapp/project/command/stages/pull.rb
475
+ - lib/dapp/project/command/stages/push.rb
451
476
  - lib/dapp/project/dappfile.rb
477
+ - lib/dapp/project/deps/base.rb
478
+ - lib/dapp/project/deps/gitartifact.rb
452
479
  - lib/dapp/project/lock.rb
453
480
  - lib/dapp/project/logging/base.rb
481
+ - lib/dapp/project/logging/i18n.rb
482
+ - lib/dapp/project/logging/paint.rb
454
483
  - lib/dapp/project/logging/process.rb
455
- - lib/dapp/project/paint.rb
484
+ - lib/dapp/project/shellout/base.rb
485
+ - lib/dapp/project/shellout/streaming.rb
486
+ - lib/dapp/project/shellout/system.rb
456
487
  - lib/dapp/project/ssh_agent.rb
457
488
  - lib/dapp/version.rb
458
489
  homepage: https://github.com/flant/dapp
@@ -1,40 +0,0 @@
1
- module Dapp
2
- module Build
3
- module Stage
4
- # Artifact
5
- class Artifact < Base
6
- include Mod::Artifact
7
-
8
- def initialize(application, next_stage)
9
- @prev_stage = InstallGroup::GAPostInstallPatch.new(application, self)
10
- super
11
- end
12
-
13
- def dependencies
14
- artifacts_signatures
15
- end
16
-
17
- def image
18
- super do |image|
19
- artifacts_labels = {}
20
- artifacts.each do |artifact|
21
- apply_artifact(artifact, image)
22
- artifacts_labels["dapp-artifact-#{artifact[:name]}".to_sym] = artifact[:app].send(:last_stage).image.built_id
23
- end
24
- image.add_service_change_label artifacts_labels
25
- end
26
- end
27
-
28
- protected
29
-
30
- def should_not_be_detailed?
31
- true
32
- end
33
-
34
- def ignore_log_commands?
35
- true
36
- end
37
- end # Artifact
38
- end # Stage
39
- end # Build
40
- end # Dapp
@@ -1,79 +0,0 @@
1
- module Dapp
2
- module Build
3
- module Stage
4
- # Mod
5
- module Mod
6
- # Artifact
7
- module Artifact
8
- def artifacts
9
- @artifacts ||= begin
10
- application.config._artifact.map do |artifact|
11
- process = application.project.t(code: 'process.artifact_building', data: { name: artifact._config._name })
12
- application.project.log_secondary_process(process, short: !application.project.log_verbose?) do
13
- application.project.with_log_indent do
14
- {
15
- name: artifact._config._name,
16
- options: artifact._artifact_options,
17
- app: application.artifact(artifact._config).tap(&:build!)
18
- }
19
- end
20
- end
21
- end
22
- end
23
- end
24
-
25
- def artifacts_signatures
26
- artifacts.map { |artifact| hashsum [artifact[:app].signature, artifact[:options]] }
27
- end
28
-
29
- # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
30
- def apply_artifact(artifact, image)
31
- return if application.project.dry_run?
32
-
33
- artifact_name = artifact[:name]
34
- app = artifact[:app]
35
- cwd = artifact[:options][:cwd]
36
- paths = artifact[:options][:paths]
37
- owner = artifact[:options][:owner]
38
- group = artifact[:options][:group]
39
- where_to_add = artifact[:options][:where_to_add]
40
-
41
- docker_options = ['--rm',
42
- "--volume #{application.tmp_path('artifact', artifact_name)}:#{app.container_tmp_path(artifact_name)}",
43
- '--entrypoint /bin/bash']
44
- commands = safe_cp(where_to_add, app.container_tmp_path(artifact_name), Process.uid, Process.gid)
45
- application.project.log_secondary_process(application.project.t(code: 'process.artifact_copy',
46
- data: { name: artifact_name }), short: true) do
47
- app.run(docker_options, [%(-ec '#{application.project.shellout_pack(commands)}')])
48
- end
49
-
50
- commands = safe_cp(application.container_tmp_path('artifact', artifact_name), where_to_add, owner, group, cwd, paths)
51
- image.add_command commands
52
- image.add_volume "#{application.tmp_path('artifact', artifact_name)}:#{application.container_tmp_path('artifact', artifact_name)}:ro"
53
- end
54
- # rubocop:enable Metrics/AbcSize, Metrics/MethodLength
55
-
56
- # rubocop:disable Metrics/ParameterLists
57
- def safe_cp(from, to, owner, group, cwd = '', paths = [])
58
- credentials = ''
59
- credentials += "-o #{owner} " if owner
60
- credentials += "-g #{group} " if group
61
-
62
- copy_files = lambda do |from_, cwd_, path_ = ''|
63
- cwd_ = File.expand_path(File.join('/', cwd_))
64
- "find #{File.join(from_, cwd_, path_)} -type f -exec bash -ec 'install -D #{credentials} {} " \
65
- "#{File.join(to, "$(echo {} | sed -e \"s/#{File.join(from_, cwd_).gsub('/', '\\/')}//g\")")}' \\;"
66
- end
67
-
68
- commands = []
69
- commands << ['install', credentials, '-d', to].join(' ')
70
- commands.concat(paths.empty? ? Array(copy_files.call(from, cwd)) : paths.map { |path| copy_files.call(from, cwd, path) })
71
- commands << "find #{to} -type d -exec bash -ec 'install -d #{credentials} {}' \\;"
72
- commands.join(' && ')
73
- end
74
- # rubocop:enable Metrics/ParameterLists
75
- end
76
- end # Mod
77
- end # Stage
78
- end # Build
79
- end # Dapp
@@ -1,51 +0,0 @@
1
- module Dapp
2
- module Config
3
- # Chef
4
- class Chef
5
- attr_reader :_modules
6
- attr_reader :_recipes
7
-
8
- def initialize
9
- @_modules = []
10
- @_recipes = []
11
- end
12
-
13
- def module(*args)
14
- @_modules.concat(args)
15
- end
16
-
17
- def reset_modules
18
- @_modules.clear
19
- end
20
-
21
- def skip_module(*args)
22
- @_modules.reject! { |mod| args.include? mod }
23
- end
24
-
25
- def recipe(*args)
26
- @_recipes.concat(args)
27
- end
28
-
29
- def remove_recipe(*args)
30
- @_recipes.reject! { |recipe| args.include? recipe }
31
- end
32
-
33
- def reset_recipes
34
- @_recipes.clear
35
- end
36
-
37
- def reset_all
38
- reset_modules
39
- reset_recipes
40
- end
41
-
42
- def empty?
43
- @_modules.empty? && @_recipes.empty?
44
- end
45
-
46
- def clone
47
- Marshal.load(Marshal.dump(self))
48
- end
49
- end
50
- end
51
- end
@@ -1,82 +0,0 @@
1
- module Dapp
2
- module Config
3
- # Docker
4
- class Docker
5
- attr_reader :_volume, :_expose, :_env, :_label, :_cmd, :_onbuild, :_workdir, :_user, :_entrypoint
6
- attr_reader :_from_cache_version
7
-
8
- def initialize
9
- @_volume = []
10
- @_expose = []
11
- @_env = {}
12
- @_label = {}
13
- @_cmd = []
14
- @_onbuild = []
15
- end
16
-
17
- def from(image, cache_version: nil)
18
- raise(Error::Config, code: :docker_from_incorrect, data: { name: image }) unless image =~ /^[[^ ].]+:[[^ ].]+$/
19
- @_from = image
20
- @_from_cache_version = cache_version
21
- end
22
-
23
- def volume(*args)
24
- @_volume.concat(args)
25
- end
26
-
27
- def expose(*args)
28
- @_expose.concat(args)
29
- end
30
-
31
- def env(**options)
32
- @_env.merge!(options)
33
- end
34
-
35
- def label(**options)
36
- @_label.merge!(options)
37
- end
38
-
39
- def cmd(*args)
40
- @_cmd.concat(args)
41
- end
42
-
43
- def onbuild(*args)
44
- @_onbuild.concat(args)
45
- end
46
-
47
- def workdir(val)
48
- @_workdir = val
49
- end
50
-
51
- def user(val)
52
- @_user = val
53
- end
54
-
55
- def entrypoint(*cmd_with_args)
56
- @_entrypoint = cmd_with_args.flatten
57
- end
58
-
59
- def _from
60
- @_from || raise(Error::Config, code: :docker_from_not_defined)
61
- end
62
-
63
- def _change_options
64
- {
65
- volume: _volume,
66
- expose: _expose,
67
- env: _env,
68
- label: _label,
69
- cmd: _cmd,
70
- onbuild: _onbuild,
71
- workdir: _workdir,
72
- user: _user,
73
- entrypoint: _entrypoint
74
- }
75
- end
76
-
77
- def clone
78
- Marshal.load(Marshal.dump(self))
79
- end
80
- end
81
- end
82
- end
@@ -1,51 +0,0 @@
1
- module Dapp
2
- module Config
3
- # GitArtifact
4
- class GitArtifact
5
- attr_reader :_local
6
- attr_reader :_remote
7
-
8
- def initialize
9
- @_local = []
10
- @_remote = []
11
- end
12
-
13
- def local(*args)
14
- @_local.tap { |local| local << Local.new(*args) unless args.empty? }
15
- end
16
-
17
- def remote(*args)
18
- @_remote.tap { |remote| remote << Remote.new(*args) unless args.empty? }
19
- end
20
-
21
- def clone
22
- Marshal.load(Marshal.dump(self))
23
- end
24
-
25
- # Local
26
- class Local < Artifact::Base
27
- protected
28
-
29
- def code
30
- :git_artifact_unexpected_attribute
31
- end
32
- end
33
-
34
- # Remote
35
- class Remote < Local
36
- attr_accessor :_url, :_name, :_branch
37
-
38
- def initialize(url, where_to_add, **options)
39
- @_url = url
40
- @_name = url.gsub(%r{.*?([^\/ ]+)\.git}, '\\1')
41
- @_branch = options.delete(:branch)
42
- super(where_to_add, **options)
43
- end
44
-
45
- def _artifact_options
46
- super.merge(name: _name, branch: _branch)
47
- end
48
- end
49
- end
50
- end
51
- end