dapp 0.13.3 → 0.13.4

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 (88) hide show
  1. checksums.yaml +4 -4
  2. data/bin/dapp +0 -13
  3. data/config/en/common.yml +4 -2
  4. data/config/en/net_status.yml +15 -3
  5. data/lib/dapp.rb +11 -6
  6. data/lib/dapp/cli.rb +1 -1
  7. data/lib/dapp/cli/command/base.rb +4 -4
  8. data/lib/dapp/config/directive/base.rb +4 -2
  9. data/lib/dapp/core_ext/hash.rb +14 -0
  10. data/lib/dapp/dapp.rb +32 -6
  11. data/lib/dapp/dapp/dapp_config.rb +85 -0
  12. data/lib/dapp/dapp/dappfile.rb +4 -0
  13. data/lib/dapp/dapp/deps/base.rb +2 -2
  14. data/lib/dapp/dapp/deps/gitartifact.rb +2 -2
  15. data/lib/dapp/dapp/logging/base.rb +5 -5
  16. data/lib/dapp/dapp/logging/process.rb +5 -7
  17. data/lib/dapp/dapp/shellout/base.rb +16 -17
  18. data/lib/dapp/deployment/cli/command/deployment.rb +2 -3
  19. data/lib/dapp/deployment/dapp/command/apply.rb +6 -6
  20. data/lib/dapp/deployment/dapp/dapp.rb +0 -1
  21. data/lib/dapp/deployment/kube_app.rb +1 -1
  22. data/lib/dapp/deployment/kube_base.rb +1 -1
  23. data/lib/dapp/dimg/build/stage/artifact_base.rb +3 -8
  24. data/lib/dapp/dimg/build/stage/base.rb +57 -38
  25. data/lib/dapp/dimg/build/stage/docker_instructions.rb +1 -1
  26. data/lib/dapp/dimg/build/stage/from.rb +6 -2
  27. data/lib/dapp/dimg/build/stage/ga_archive_dependencies.rb +2 -2
  28. data/lib/dapp/dimg/build/stage/ga_artifact_patch.rb +1 -5
  29. data/lib/dapp/dimg/build/stage/ga_base.rb +1 -14
  30. data/lib/dapp/dimg/build/stage/ga_latest_patch.rb +7 -31
  31. data/lib/dapp/dimg/build/stage/ga_related_dependencies_base.rb +21 -0
  32. data/lib/dapp/dimg/build/stage/import_artifact.rb +10 -3
  33. data/lib/dapp/dimg/build/stage/install/ga_post_install_patch_dependencies.rb +3 -3
  34. data/lib/dapp/dimg/build/stage/install/ga_pre_install_patch_dependencies.rb +3 -3
  35. data/lib/dapp/dimg/build/stage/mod/group.rb +19 -7
  36. data/lib/dapp/dimg/build/stage/mod/logging.rb +7 -20
  37. data/lib/dapp/dimg/build/stage/setup/ga_post_setup_patch_dependencies.rb +1 -1
  38. data/lib/dapp/dimg/build/stage/setup/ga_pre_setup_patch_dependencies.rb +3 -3
  39. data/lib/dapp/dimg/builder/chef.rb +2 -2
  40. data/lib/dapp/dimg/builder/chef/cookbook.rb +2 -2
  41. data/lib/dapp/dimg/cli/command/dimg.rb +1 -1
  42. data/lib/dapp/dimg/cli/command/dimg/build.rb +15 -8
  43. data/lib/dapp/dimg/config/directive/artifact_base.rb +13 -4
  44. data/lib/dapp/dimg/config/directive/dimg/instance_methods.rb +1 -1
  45. data/lib/dapp/dimg/config/directive/dimg/validation.rb +6 -1
  46. data/lib/dapp/dimg/config/directive/docker/base.rb +1 -2
  47. data/lib/dapp/dimg/config/directive/git_artifact_local.rb +3 -0
  48. data/lib/dapp/dimg/config/directive/git_artifact_remote.rb +1 -1
  49. data/lib/dapp/dimg/config/directive/mount.rb +9 -1
  50. data/lib/dapp/dimg/dapp/command/build_context/export.rb +13 -15
  51. data/lib/dapp/dimg/dapp/command/build_context/import.rb +3 -3
  52. data/lib/dapp/dimg/dapp/command/cleanup.rb +1 -1
  53. data/lib/dapp/dimg/dapp/command/common.rb +17 -6
  54. data/lib/dapp/dimg/dapp/command/mrproper.rb +9 -4
  55. data/lib/dapp/dimg/dapp/command/stages/cleanup_local.rb +19 -17
  56. data/lib/dapp/dimg/dapp/command/stages/cleanup_repo.rb +1 -1
  57. data/lib/dapp/dimg/dimg.rb +5 -5
  58. data/lib/dapp/dimg/dimg/git_artifact.rb +11 -6
  59. data/lib/dapp/dimg/dimg/path.rb +2 -6
  60. data/lib/dapp/dimg/git_artifact.rb +118 -66
  61. data/lib/dapp/dimg/git_repo/base.rb +1 -1
  62. data/lib/dapp/dimg/git_repo/own.rb +1 -1
  63. data/lib/dapp/dimg/git_repo/remote.rb +23 -14
  64. data/lib/dapp/dimg/image/docker.rb +11 -11
  65. data/lib/dapp/dimg/image/scratch.rb +33 -9
  66. data/lib/dapp/dimg/image/stage.rb +3 -3
  67. data/lib/dapp/helper/cli.rb +8 -0
  68. data/lib/dapp/helper/tar.rb +31 -0
  69. data/lib/dapp/kube/cli/command/kube.rb +5 -4
  70. data/lib/dapp/kube/cli/command/kube/deploy.rb +5 -0
  71. data/lib/dapp/kube/cli/command/kube/minikube_setup.rb +13 -0
  72. data/lib/dapp/kube/cli/command/kube/{secret_file_encrypt.rb → secret_extract.rb} +3 -3
  73. data/lib/dapp/kube/cli/command/kube/secret_generate.rb +11 -1
  74. data/lib/dapp/kube/client.rb +1 -1
  75. data/lib/dapp/kube/client/error.rb +1 -1
  76. data/lib/dapp/kube/dapp/command/common.rb +29 -4
  77. data/lib/dapp/kube/dapp/command/deploy.rb +43 -21
  78. data/lib/dapp/kube/dapp/command/dismiss.rb +1 -1
  79. data/lib/dapp/{deployment → kube}/dapp/command/minikube_setup.rb +12 -12
  80. data/lib/dapp/kube/dapp/command/secret_extract.rb +46 -0
  81. data/lib/dapp/kube/dapp/command/secret_generate.rb +33 -4
  82. data/lib/dapp/kube/dapp/dapp.rb +3 -2
  83. data/lib/dapp/kube/error/kubernetes.rb +7 -0
  84. data/lib/dapp/kube/secret.rb +1 -1
  85. data/lib/dapp/version.rb +2 -2
  86. metadata +11 -7
  87. data/lib/dapp/deployment/cli/command/deployment/minikube_setup.rb +0 -13
  88. data/lib/dapp/kube/dapp/command/secret_file_encrypt.rb +0 -22
@@ -11,14 +11,14 @@ module Dapp
11
11
  end
12
12
 
13
13
  def dependencies
14
- [dimg.git_artifacts.map(&:paramshash).join, reset_commits.sort.uniq.compact]
14
+ @dependencies ||= [dimg.git_artifacts.map(&:paramshash).join, reset_commits]
15
15
  end
16
16
 
17
17
  protected
18
18
 
19
19
  def reset_commits
20
20
  regex = Regexp.union(RESET_COMMIT_MESSAGES)
21
- dimg.git_artifacts.map { |git_artifact| git_artifact.repo.find_commit_id_by_message(regex) }
21
+ dimg.git_artifacts.map { |git_artifact| git_artifact.repo.find_commit_id_by_message(regex) }.sort.uniq.compact
22
22
  end
23
23
  end # GAArchiveDependencies
24
24
  end # Stage
@@ -8,12 +8,8 @@ module Dapp
8
8
  super
9
9
  end
10
10
 
11
- def empty?
12
- dimg.git_artifacts.empty? || dependencies_empty?
13
- end
14
-
15
11
  def dependencies
16
- dimg.stage_by_name(:build_artifact).context
12
+ @dependencies ||= dimg.stage_by_name(:build_artifact).context
17
13
  end
18
14
  end # GAArtifactPatch
19
15
  end # Stage
@@ -13,23 +13,10 @@ module Dapp
13
13
  image.add_volume "#{dimg.tmp_path('archives')}:#{dimg.container_tmp_path('archives')}:ro"
14
14
  image.add_volume "#{dimg.tmp_path('patches')}:#{dimg.container_tmp_path('patches')}:ro"
15
15
 
16
- prepare_local_git_artifacts_command
17
- prepare_remote_git_artifacts_command
16
+ dimg.git_artifacts.each { |git_artifact| image.add_command git_artifact.send(apply_command_method, self) }
18
17
  end
19
18
  end
20
19
 
21
- def prepare_local_git_artifacts_command
22
- prepare_base_git_artifacts_command(dimg.local_git_artifacts)
23
- end
24
-
25
- def prepare_remote_git_artifacts_command
26
- prepare_base_git_artifacts_command(dimg.remote_git_artifacts)
27
- end
28
-
29
- def prepare_base_git_artifacts_command(git_artifacts)
30
- git_artifacts.each { |git_artifact| image.add_command git_artifact.send(apply_command_method, self) }
31
- end
32
-
33
20
  def empty?
34
21
  dependencies_stage.empty?
35
22
  end
@@ -13,50 +13,26 @@ module Dapp
13
13
  end
14
14
 
15
15
  def dependencies
16
- [].tap do |dependencies|
17
- dependencies << commit_list
18
- dependencies << dimg.local_git_artifacts.map { |git_artifact| git_artifact.dev_patch_hash(self) } if dimg.dev_mode?
19
- end
20
- end
21
-
22
- def prepare_local_git_artifacts_command
23
- return super unless dimg.dev_mode?
24
- dimg.local_git_artifacts.each { |git_artifact| image.add_command git_artifact.apply_dev_patch_command(self) }
16
+ @dependencies ||= [commit_list, git_artifacts_dev_patch_hashes]
25
17
  end
26
18
 
27
19
  def layer_commit(git_artifact)
28
- commits[git_artifact] ||= begin
29
- git_artifact.latest_commit
30
- end
20
+ commits[git_artifact] ||= git_artifact.latest_commit
31
21
  end
32
22
 
33
23
  def empty?
34
- dependencies_empty? || git_artifacts_without_changes?
24
+ dimg.git_artifacts.empty? || dependencies_empty?
35
25
  end
36
26
 
37
27
  private
38
28
 
39
- def git_artifacts_without_changes?
40
- local_git_artifacts_without_changes? && remote_git_artifacts_without_changes?
41
- end
42
-
43
- def local_git_artifacts_without_changes?
44
- dimg.local_git_artifacts.all? do |git_artifact|
45
- from_commit = prev_g_a_stage.layer_commit(git_artifact)
46
- to_commit = dimg.dev_mode? ? nil : layer_commit(git_artifact)
47
- !git_artifact.any_changes?(from_commit, to_commit)
48
- end
49
- end
50
-
51
- def remote_git_artifacts_without_changes?
52
- dimg.remote_git_artifacts.all? do |git_artifact|
53
- !git_artifact.any_changes?(prev_g_a_stage.layer_commit(git_artifact), layer_commit(git_artifact))
54
- end
55
- end
56
-
57
29
  def commit_list
58
30
  dimg.git_artifacts.map { |git_artifact| layer_commit(git_artifact) }
59
31
  end
32
+
33
+ def git_artifacts_dev_patch_hashes
34
+ dimg.git_artifacts.map(&:dev_patch_hash)
35
+ end
60
36
  end # GALatestPatch
61
37
  end # Stage
62
38
  end # Build
@@ -0,0 +1,21 @@
1
+ module Dapp
2
+ module Dimg
3
+ module Build
4
+ module Stage
5
+ class GARelatedDependenciesBase < GADependenciesBase
6
+ def dependencies
7
+ @dependencies ||= dimg.stage_by_name(related_stage_name).context
8
+ end
9
+
10
+ def empty?
11
+ dimg.stage_by_name(related_stage_name).empty? || super
12
+ end
13
+
14
+ def related_stage_name
15
+ raise
16
+ end
17
+ end # GARelatedDependenciesBase
18
+ end # Stage
19
+ end # Build
20
+ end # Dimg
21
+ end # Dapp
@@ -15,7 +15,7 @@ module Dapp
15
15
  @image ||= Image::Scratch.new(name: image_name, dapp: dimg.dapp)
16
16
  end
17
17
 
18
- def image_add_volumes
18
+ def image_add_mounts
19
19
  end
20
20
 
21
21
  def prepare_image
@@ -33,6 +33,7 @@ module Dapp
33
33
  artifact_name = artifact[:name]
34
34
  artifact_dimg = artifact[:dimg]
35
35
  cwd = artifact[:options][:cwd]
36
+ to = artifact[:options][:to]
36
37
  include_paths = artifact[:options][:include_paths]
37
38
  owner = artifact[:options][:owner]
38
39
  group = artifact[:options][:group]
@@ -51,12 +52,18 @@ module Dapp
51
52
  include_paths = include_paths.empty? ? [File.join(cwd, '*')] : include_paths.map { |path| File.join(cwd, path, '*') }
52
53
  include_paths.map! { |path| path[1..-1] } # relative path
53
54
 
54
- command = "#{sudo} #{dimg.dapp.tar_bin} -czf #{container_archive_path} #{exclude_paths} #{include_paths.join(' ')} #{credentials}"
55
+ command = "#{sudo} #{dimg.dapp.tar_bin} #{tar_option_transform(cwd, to)} -czf #{container_archive_path} #{exclude_paths} #{include_paths.join(' ')} #{credentials}"
55
56
  run_artifact_dimg(artifact_dimg, artifact_name, command)
56
57
 
57
58
  image.add_archive archive_path
58
59
  end
59
- # rubocop:enable Metrics/AbcSize, Metrics/MethodLength
60
+
61
+ private
62
+
63
+ def tar_option_transform(cwd, to)
64
+ format = proc { |path| path.chomp('/').reverse.chomp('/').reverse }
65
+ "--transform \"s/^#{format.call(cwd)}/#{format.call(to)}/\""
66
+ end
60
67
  end # ImportArtifact
61
68
  end # Stage
62
69
  end # Build
@@ -3,7 +3,7 @@ module Dapp
3
3
  module Build
4
4
  module Stage
5
5
  module Install
6
- class GAPostInstallPatchDependencies < GADependenciesBase
6
+ class GAPostInstallPatchDependencies < GARelatedDependenciesBase
7
7
  include Mod::Group
8
8
 
9
9
  def initialize(dimg, next_stage)
@@ -11,8 +11,8 @@ module Dapp
11
11
  super
12
12
  end
13
13
 
14
- def dependencies
15
- dimg.stage_by_name(:before_setup).context
14
+ def related_stage_name
15
+ :before_setup
16
16
  end
17
17
  end # GAPostInstallPatchDependencies
18
18
  end
@@ -3,7 +3,7 @@ module Dapp
3
3
  module Build
4
4
  module Stage
5
5
  module Install
6
- class GAPreInstallPatchDependencies < GADependenciesBase
6
+ class GAPreInstallPatchDependencies < GARelatedDependenciesBase
7
7
  include Mod::Group
8
8
 
9
9
  def initialize(dimg, next_stage)
@@ -11,8 +11,8 @@ module Dapp
11
11
  super
12
12
  end
13
13
 
14
- def dependencies
15
- dimg.stage_by_name(:install).context
14
+ def related_stage_name
15
+ :install
16
16
  end
17
17
  end # GAPreInstallPatchDependencies
18
18
  end
@@ -5,7 +5,6 @@ module Dapp
5
5
  module Mod
6
6
  module Group
7
7
  def log_image_build
8
- return super if should_be_quiet?
9
8
  log_group_name if group_should_be_opened?
10
9
  dimg.dapp.with_log_indent { super }
11
10
  end
@@ -19,18 +18,31 @@ module Dapp
19
18
  end
20
19
 
21
20
  def group_should_be_opened?
22
- !group_opened? && image_should_be_build?
23
- end
24
-
25
- def group_opened?
26
- return false if prev_group_stage.nil?
27
- prev_group_stage.group_opened? || prev_group_stage.image_should_be_build?
21
+ @group_should_be_opened ||= begin
22
+ if empty?
23
+ false
24
+ elsif prev_group_stage.nil?
25
+ true
26
+ else
27
+ prev_group_stages.all? { |s| !s.group_should_be_opened? }
28
+ end
29
+ end
28
30
  end
29
31
 
30
32
  def prev_group_stage
31
33
  prev_stage if prev_stage.respond_to?(:group_name) && prev_stage.group_name == group_name
32
34
  end
33
35
 
36
+ def prev_group_stages
37
+ @prev_group_stages ||= begin
38
+ if prev_group_stage.nil?
39
+ []
40
+ else
41
+ prev_group_stage.prev_group_stages + [prev_group_stage]
42
+ end
43
+ end
44
+ end
45
+
34
46
  def log_name_context
35
47
  [super, group_name].join('.')
36
48
  end
@@ -4,19 +4,18 @@ module Dapp
4
4
  module Stage
5
5
  module Mod
6
6
  module Logging
7
- def log_image_build(&image_build)
8
- if empty? then log_state(:empty)
9
- elsif image.built? then log_state(:using_cache)
10
- elsif should_be_not_present? then log_state(:not_present)
11
- elsif dimg.dapp.dry_run? then log_state(:build, styles: { status: :success })
12
- else log_image_build_process(&image_build)
7
+ def log_image_build
8
+ case
9
+ when image.built? then log_state(:using_cache)
10
+ when should_be_not_present? then log_state(:not_present)
11
+ when dimg.dapp.dry_run? then log_state(:build, styles: { status: :success })
12
+ else yield
13
13
  end
14
14
  ensure
15
15
  log_build
16
16
  end
17
17
 
18
18
  def log_build
19
- return unless dimg.dapp.log_verbose? && !should_be_quiet?
20
19
  dimg.dapp.with_log_indent do
21
20
  dimg.dapp.log_info dimg.dapp.t(code: 'image.signature', data: { signature: image_name })
22
21
  log_image_details unless empty?
@@ -69,17 +68,9 @@ module Dapp
69
68
  end
70
69
 
71
70
  def log_state(state_code, styles: {})
72
- return if should_be_quiet?
73
71
  dimg.dapp.log_state(log_name, state: dimg.dapp.t(code: state_code, context: 'state'), styles: styles)
74
72
  end
75
73
 
76
- def log_image_build_process
77
- dimg.dapp.log_process(log_name,
78
- process: dimg.dapp.t(code: 'status.process.building'),
79
- short: should_not_be_detailed?,
80
- quiet: should_be_quiet?) { yield }
81
- end
82
-
83
74
  def ignore_log_commands?
84
75
  false
85
76
  end
@@ -88,13 +79,9 @@ module Dapp
88
79
  image.send(:bash_commands).empty?
89
80
  end
90
81
 
91
- def should_be_introspected?
82
+ def image_should_be_introspected?
92
83
  dimg.stage_should_be_introspected?(name) && !dimg.dapp.dry_run?
93
84
  end
94
-
95
- def should_be_quiet?
96
- dimg.artifact? && !dimg.dapp.log_verbose?
97
- end
98
85
  end
99
86
  end # Mod
100
87
  end # Stage
@@ -14,7 +14,7 @@ module Dapp
14
14
  end
15
15
 
16
16
  def dependencies
17
- [(changes_size_since_g_a_pre_setup_patch / MAX_PATCH_SIZE).to_i]
17
+ @dependencies ||= [(changes_size_since_g_a_pre_setup_patch / MAX_PATCH_SIZE).to_i]
18
18
  end
19
19
 
20
20
  private
@@ -3,7 +3,7 @@ module Dapp
3
3
  module Build
4
4
  module Stage
5
5
  module Setup
6
- class GAPreSetupPatchDependencies < GADependenciesBase
6
+ class GAPreSetupPatchDependencies < GARelatedDependenciesBase
7
7
  include Mod::Group
8
8
 
9
9
  def initialize(dimg, next_stage)
@@ -11,8 +11,8 @@ module Dapp
11
11
  super
12
12
  end
13
13
 
14
- def dependencies
15
- dimg.stage_by_name(:setup).context
14
+ def related_stage_name
15
+ :setup
16
16
  end
17
17
  end # GAPreSetupPatchDependencies
18
18
  end
@@ -54,10 +54,10 @@ module Dapp
54
54
 
55
55
  def chefdk_container
56
56
  @chefdk_container ||= begin
57
- if dimg.dapp.shellout("docker inspect #{chefdk_container_name}").exitstatus.nonzero?
57
+ if dimg.dapp.shellout("#{dimg.dapp.host_docker_bin} inspect #{chefdk_container_name}").exitstatus.nonzero?
58
58
  dimg.dapp.log_secondary_process(dimg.dapp.t(code: 'process.chefdk_container_creating'), short: true) do
59
59
  dimg.dapp.shellout!(
60
- ['docker create',
60
+ ["#{dimg.dapp.host_docker_bin} create",
61
61
  "--name #{chefdk_container_name}",
62
62
  "--volume /.dapp/deps/chefdk #{chefdk_image}"].join(' ')
63
63
  )
@@ -107,7 +107,7 @@ module Dapp
107
107
  ]
108
108
 
109
109
  builder.dimg.dapp.shellout!(
110
- [ 'docker run --rm',
110
+ [ "#{builder.dimg.dapp.host_docker_bin} run --rm",
111
111
  volumes_from.map {|container| "--volumes-from #{container}"}.join(' '),
112
112
  *local_paths.map {|path| "--volume #{path}:#{path}"},
113
113
  "--volume #{builder.dimg.tmp_path}:#{builder.dimg.tmp_path}",
@@ -118,7 +118,7 @@ module Dapp
118
118
  cmd << "dappdeps/berksdeps:0.1.0 #{builder.dimg.dapp.bash_bin}"
119
119
  cmd << " -ec '#{builder.dimg.dapp.shellout_pack(vendor_commands.join(' && '))}'"
120
120
  end ].compact.join(' '),
121
- log_verbose: builder.dimg.dapp.log_verbose?
121
+ verbose: true
122
122
  )
123
123
  end
124
124
  end
@@ -4,7 +4,7 @@ module Dapp::Dimg::CLI
4
4
  SUBCOMMANDS = ['build', 'push', 'spush', 'list', 'run', 'stages', 'cleanup', 'bp', 'mrproper', 'stage image', 'tag', 'build-context'].freeze
5
5
 
6
6
  banner <<BANNER.freeze
7
- Usage: dapp dimg [options] sub-command [sub-command options]
7
+ Usage: dapp dimg [options] subcommand [subcommand options]
8
8
 
9
9
  Available subcommands: (for details, dapp dimg SUB-COMMAND --help)
10
10
 
@@ -11,6 +11,17 @@ Usage:
11
11
 
12
12
  Options:
13
13
  BANNER
14
+ introspected_stages = [
15
+ :from, :before_install, :before_install_artifact, :g_a_archive, :g_a_pre_install_patch, :install,
16
+ :g_a_post_install_patch, :after_install_artifact, :before_setup, :before_setup_artifact,
17
+ :g_a_pre_setup_patch, :setup, :g_a_post_setup_patch, :after_setup_artifact, :g_a_latest_patch, :docker_instructions
18
+ ]
19
+ artifact_introspected_stages = [
20
+ :from, :before_install, :before_install_artifact, :g_a_archive, :g_a_pre_install_patch, :install,
21
+ :g_a_post_install_patch, :after_install_artifact, :before_setup, :before_setup_artifact,
22
+ :g_a_pre_setup_patch, :setup, :after_setup_artifact, :g_a_artifact_patch, :build_artifact
23
+ ]
24
+
14
25
  option :tmp_dir_prefix,
15
26
  long: '--tmp-dir-prefix PREFIX',
16
27
  description: 'Tmp directory prefix (/tmp by default). Used for build process service directories.'
@@ -36,17 +47,13 @@ BANNER
36
47
 
37
48
  option :introspect_stage,
38
49
  long: '--introspect-stage STAGE',
39
- proc: proc { |v| v.to_sym },
40
- in: [nil, :from, :before_install, :before_install_artifact, :g_a_archive, :g_a_pre_install_patch, :install,
41
- :g_a_post_install_patch, :after_install_artifact, :before_setup, :before_setup_artifact, :g_a_pre_setup_patch,
42
- :setup, :g_a_post_setup_patch, :after_setup_artifact, :g_a_latest_patch, :docker_instructions]
50
+ description: "Introspect one of the following stages (#{list_msg_format(introspected_stages)})",
51
+ proc: proc { |val| val.to_sym.tap { |v| in_validate!(v, introspected_stages) } }
43
52
 
44
53
  option :introspect_artifact_stage,
45
54
  long: '--introspect-artifact-stage STAGE',
46
- proc: proc { |v| v.to_sym },
47
- in: [nil, :from, :before_install, :before_install_artifact, :g_a_archive, :g_a_pre_install_patch, :install,
48
- :g_a_post_install_patch, :after_install_artifact, :before_setup, :before_setup_artifact, :g_a_pre_setup_patch,
49
- :setup, :after_setup_artifact, :g_a_artifact_patch, :build_artifact]
55
+ description: "Introspect one of the following stages (#{list_msg_format(artifact_introspected_stages)})",
56
+ proc: proc { |val| val.to_sym.tap { |v| in_validate!(v, artifact_introspected_stages) } }
50
57
 
51
58
  option :ssh_key,
52
59
  long: '--ssh-key SSH_KEY',
@@ -18,7 +18,7 @@ module Dapp
18
18
  sub_directive_eval { @_group = group }
19
19
  end
20
20
 
21
- def export(absolute_dir_path = '/', &blk)
21
+ def export(absolute_dir_path = nil, &blk)
22
22
  self.class.const_get('Export').new(absolute_dir_path, dapp: dapp, &blk).tap do |export|
23
23
  @_export << export
24
24
  end
@@ -36,9 +36,8 @@ module Dapp
36
36
  class Export < Directive::Base
37
37
  attr_accessor :_cwd, :_to, :_include_paths, :_exclude_paths, :_owner, :_group
38
38
 
39
- def initialize(cwd = '/', **kwargs, &blk)
40
- raise Error::Config, code: :export_cwd_absolute_path_required unless Pathname(cwd).absolute?
41
- @_cwd = path_format(cwd)
39
+ def initialize(cwd, **kwargs, &blk)
40
+ self._cwd = cwd
42
41
  @_include_paths ||= []
43
42
  @_exclude_paths ||= []
44
43
 
@@ -56,6 +55,16 @@ module Dapp
56
55
  }
57
56
  end
58
57
 
58
+ def _cwd
59
+ @_cwd ||= _to
60
+ end
61
+
62
+ def _cwd=(value)
63
+ return if value.nil?
64
+ raise Error::Config, code: :export_cwd_absolute_path_required unless Pathname(value).absolute?
65
+ @_cwd = path_format(value)
66
+ end
67
+
59
68
  def to(absolute_path)
60
69
  sub_directive_eval do
61
70
  raise Error::Config, code: :export_to_absolute_path_required unless Pathname(absolute_path).absolute?