dapp 0.4.5 → 0.4.6

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4061e00229c336d61bc166f2c8e0e60ce267d2f0
4
- data.tar.gz: 556a9a1a278f3cbc3814c21d1ee7ab6f5a5bafe4
3
+ metadata.gz: 7bc6a29dd7b243dc8d6f5432442b085926c05ce7
4
+ data.tar.gz: 771c938cc250204bc86e50ee796952bbe14d02b4
5
5
  SHA512:
6
- metadata.gz: 61dff1c46677e388e53805d2e1f294a818f8270150404971bfb85f07b3d77b79aa074eea8ceb373e0640b33f09325f94064e49eadf8b79c84b436535acdfbf09
7
- data.tar.gz: bfa01aa5f9297f82e266105c23148daa36f4fda40b066ed0433dfb4e4fc1fd193a792503342b9706daa47efe978ace31df6fa15b0a62168123ebf60db71ad3b1
6
+ metadata.gz: 5ce285874f213efc4f28908cf22d9f7a32c71aa0d0f5554ff89740c6308418a74ccd5c4f050f999077aaf40f7d68022712ebb00458c3d176c4595ae0c4bee35d
7
+ data.tar.gz: b8f9bc10ec5e3cd36d6e80dc6fc0aceac8bc3fc0c4afaf884da4941f641f2e099e608d0aab82b40163c9c990de22ea6a9a3dc22d4592c45fef1a833cc25e05dd
@@ -27,3 +27,5 @@ en:
27
27
  stage_artifact_not_associated: "Artifact not associated with any stage!"
28
28
  stage_artifact_incorrect_associated_value: "Artifact option '%{option}' has incorrect value '%{value}'!"
29
29
  git_artifact_unexpected_attribute: "'%{type}' git artifact doesn't has attribute '%{attr}'!"
30
+ chef:
31
+ stage_path_overlap: "Cannot install '%{cookbook}' cookbook's path %{from} into %{to}: already exists"
data/lib/dapp.rb CHANGED
@@ -25,6 +25,12 @@ require 'dapp/helper/paint'
25
25
  require 'dapp/helper/streaming'
26
26
  require 'dapp/helper/shellout'
27
27
  require 'dapp/helper/net_status'
28
+ require 'dapp/error/base'
29
+ require 'dapp/error/application'
30
+ require 'dapp/error/build'
31
+ require 'dapp/error/config'
32
+ require 'dapp/error/controller'
33
+ require 'dapp/error/shellout'
28
34
  require 'dapp/cli'
29
35
  require 'dapp/cli/base'
30
36
  require 'dapp/cli/build'
@@ -47,6 +53,7 @@ require 'dapp/config/git_artifact'
47
53
  require 'dapp/config/docker'
48
54
  require 'dapp/builder/base'
49
55
  require 'dapp/builder/chef'
56
+ require 'dapp/builder/chef/error'
50
57
  require 'dapp/builder/chef/cookbook_metadata'
51
58
  require 'dapp/builder/chef/berksfile'
52
59
  require 'dapp/builder/shell'
@@ -79,12 +86,6 @@ require 'dapp/git_repo/base'
79
86
  require 'dapp/git_repo/own'
80
87
  require 'dapp/git_repo/remote'
81
88
  require 'dapp/git_artifact'
82
- require 'dapp/error/base'
83
- require 'dapp/error/application'
84
- require 'dapp/error/build'
85
- require 'dapp/error/config'
86
- require 'dapp/error/controller'
87
- require 'dapp/error/shellout'
88
89
  require 'dapp/exception/base'
89
90
  require 'dapp/exception/introspect_image'
90
91
 
@@ -214,6 +214,7 @@ module Dapp
214
214
  @install_stage_cookbooks[stage] ||= true.tap do
215
215
  common_paths = proc do |cookbook_path|
216
216
  [['metadata.json', 'metadata.json'],
217
+ ["attributes/common", 'attributes'],
217
218
  ["attributes/#{stage}", 'attributes'],
218
219
  ["files/#{stage}", 'files/default'],
219
220
  ["templates/#{stage}", 'templates/default']
@@ -257,16 +258,35 @@ module Dapp
257
258
 
258
259
  stage_cookbooks_path(stage).mkpath
259
260
  install_paths.each do |cookbook_path, paths|
261
+ cookbook = cookbook_path.basename
262
+
260
263
  paths.each do |from, to|
261
264
  if from.nil?
262
- to_path = stage_cookbooks_path(stage, cookbook_path.basename, 'recipes/void.rb')
265
+ to_path = stage_cookbooks_path(stage, cookbook, 'recipes/void.rb')
263
266
  to_path.parent.mkpath
264
267
  FileUtils.touch to_path
265
268
  else
266
269
  from_path = cookbook_path.join(from)
267
- to_path = stage_cookbooks_path(stage, cookbook_path.basename, to)
268
- to_path.parent.mkpath
269
- FileUtils.cp_r from_path, to_path
270
+ to_path = stage_cookbooks_path(stage, cookbook, to)
271
+ if from_path.directory? && to_path.exist?
272
+ Dir[from_path.join('**/*')]
273
+ .map(&Pathname.method(:new))
274
+ .each do |from_subpath|
275
+ to_subpath = to_path.join(from_subpath.relative_path_from(from_path))
276
+ raise Error, code: :stage_path_overlap,
277
+ data: { stage: stage,
278
+ cookbook: cookbook,
279
+ from: from_subpath.relative_path_from(cookbook_path),
280
+ to: to_subpath.relative_path_from(stage_cookbooks_path(stage, cookbook)),
281
+ } if to_subpath.exist?
282
+
283
+ to_subpath.parent.mkpath
284
+ FileUtils.cp_r from_subpath, to_subpath
285
+ end
286
+ else
287
+ to_path.parent.mkpath
288
+ FileUtils.cp_r from_path, to_path
289
+ end
270
290
  end
271
291
  end
272
292
  end
@@ -0,0 +1,11 @@
1
+ module Dapp
2
+ module Builder
3
+ class Chef < Base
4
+ class Error < ::Dapp::Error::Base
5
+ def initialize(**net_status)
6
+ super(context: :chef, **net_status)
7
+ end
8
+ end
9
+ end # Chef
10
+ end # Builder
11
+ end # Dapp
@@ -3,7 +3,7 @@ module Dapp
3
3
  # Base
4
4
  class Base < NetStatus::Exception
5
5
  def initialize(net_status = {})
6
- super(net_status.merge(context: self.class.to_s.split('::').last.downcase))
6
+ super({context: self.class.to_s.split('::').last.downcase}.merge(net_status))
7
7
  end
8
8
  end
9
9
  end
data/lib/dapp/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # Version
2
2
  module Dapp
3
- VERSION = '0.4.5'.freeze
3
+ VERSION = '0.4.6'.freeze
4
4
  BUILD_CACHE_VERSION = 1
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dapp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.5
4
+ version: 0.4.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitry Stolyarov
@@ -351,6 +351,7 @@ files:
351
351
  - lib/dapp/builder/chef.rb
352
352
  - lib/dapp/builder/chef/berksfile.rb
353
353
  - lib/dapp/builder/chef/cookbook_metadata.rb
354
+ - lib/dapp/builder/chef/error.rb
354
355
  - lib/dapp/builder/shell.rb
355
356
  - lib/dapp/cli.rb
356
357
  - lib/dapp/cli/base.rb