dapp 0.21.12 → 0.21.13

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: 514cf21ba5c4ce073da2a0ae7ee5309532f9dae7
4
- data.tar.gz: 07c4ac7f01df67f6ce984b8f063ae5b41c10a536
3
+ metadata.gz: ce5005fb6e0eb05a281c35ea110b15cf00fd663e
4
+ data.tar.gz: fceb0e4c395aef5bf854a76bb7f041bde0b1f65d
5
5
  SHA512:
6
- metadata.gz: 090c8b04e6e0bfa532c690a9b18b86b831cdcb8cee711884ad9e56dc190ed9b32ac07440238446ccbc240a79f57633cc044b9611d74161e9b33e0f4814952b84
7
- data.tar.gz: d9f4ac9fd7e7adb3fc6fff0f889fddd48ef1ecf2d9230b339888c5c55f61e41fa0bf987ca157685d368e63346cb6735d9b758dcf7854750a2b0c222a3154ae76
6
+ metadata.gz: 64714ff2147d0b123e3b2bdbdfb84a47db6fe140e47a272ae3fbcd5c7ecd408ae348a0b322b83e4bbcc0b2de082ba9be6f1ea9a41d352c2f4fc28f543653df57
7
+ data.tar.gz: 3485853cc5256deb0e044c29ba8ce931bd460db0c47776125bf95a8805cbfb0cd35fd5dca51e5df1916abf2d09d14bdb4bf4580729de441c2d1be85df68b1f9e
@@ -80,7 +80,7 @@ en:
80
80
  stage_artifact_double_associate: "Can't use `%{stage}` stage for artifact; already used in `%{conflict_stage}` stage!"
81
81
  stage_artifact_not_supported_associated_stage: "Bad artifact stage `%{stage}`!"
82
82
  git_artifact_remote_branch_with_commit: "Remote git repo: use `commit` or `branch` directive!"
83
- artifact_conflict: "Conflict between artifacts paths!"
83
+ artifact_conflict: "Conflict between artifacts!\n\n%{dappfile_context}"
84
84
  scratch_unsupported_directive: "Scratch dimg has unsupported directive `%{directive}`!"
85
85
  scratch_artifact_required: "Scratch dimg without artifacts!"
86
86
  scratch_artifact_associated: "Scratch artifact can't be associated: not expected `before`/`after` attribute!"
@@ -5,13 +5,6 @@ module Dapp
5
5
  class ArtifactDimg < Dimg
6
6
  def validate_scratch!
7
7
  end
8
-
9
- def validate_artifacts_artifacts!
10
- end
11
-
12
- def validated_artifacts
13
- _git_artifact._local + _git_artifact._remote
14
- end
15
8
  end
16
9
  end
17
10
  end
@@ -132,6 +132,7 @@ module Dapp
132
132
 
133
133
  def artifacts_after_parsing!
134
134
  _artifacts_auto_excluding!
135
+ _artifact.map(&:_config).each(&:artifacts_after_parsing!)
135
136
  end
136
137
 
137
138
  protected
@@ -73,12 +73,39 @@ module Dapp
73
73
  verifiable_artifact = artifacts.shift
74
74
  artifacts.select { |a| a[:to] == verifiable_artifact[:to] }.each do |artifact|
75
75
  next if verifiable_artifact[:index] == artifact[:index]
76
- validate_artifact!(verifiable_artifact, artifact)
77
- validate_artifact!(artifact, verifiable_artifact)
76
+ begin
77
+ validate_artifact!(verifiable_artifact, artifact)
78
+ validate_artifact!(artifact, verifiable_artifact)
79
+ rescue Error::Config => e
80
+ conflict_between_artifacts!(artifact, verifiable_artifact) if e.net_status[:code] == :artifact_conflict
81
+ raise
82
+ end
78
83
  end
79
84
  end
80
85
  end
81
86
 
87
+ def conflict_between_artifacts!(*formatted_artifacts)
88
+ artifacts = formatted_artifacts.flatten.map { |formatted_artifact| formatted_artifact[:related_artifact] }
89
+ dappfile_context = artifacts.map do |artifact|
90
+ artifact_directive = []
91
+ artifact_directive << begin
92
+ if artifact.is_a? Artifact::Export
93
+ "artifact.export('#{artifact._cwd}') do"
94
+ else
95
+ "git#{"('#{artifact._url}')" if artifact.respond_to?(:_url)}.add('#{artifact._cwd}') do"
96
+ end
97
+ end
98
+ [:include_paths, :exclude_paths].each do |directive|
99
+ next if (paths = artifact.send("_#{directive}")).empty?
100
+ artifact_directive << " #{directive} '#{paths.join("', '")}'"
101
+ end
102
+ artifact_directive << " to '#{artifact._to}'"
103
+ artifact_directive << 'end'
104
+ artifact_directive.join("\n")
105
+ end.join("\n\n")
106
+ raise Error::Config, code: :artifact_conflict, data: { dappfile_context: dappfile_context }
107
+ end
108
+
82
109
  def validate_artifact_format(artifacts)
83
110
  artifacts.map do |a|
84
111
  path_format = proc { |path| File.expand_path(File.join('/', path, '/'))[1..-1] }
@@ -106,7 +133,8 @@ module Dapp
106
133
  index: artifacts.index(a),
107
134
  to: to,
108
135
  include_paths: include_paths,
109
- exclude_paths: exclude_paths
136
+ exclude_paths: exclude_paths,
137
+ related_artifact: a
110
138
  }
111
139
  end
112
140
  end
@@ -115,17 +143,26 @@ module Dapp
115
143
  verifiable_artifact[:include_paths].each do |verifiable_path|
116
144
  potential_conflicts = artifact[:include_paths].select { |path| path.start_with?(verifiable_path) }
117
145
  validate_artifact_path!(verifiable_artifact, potential_conflicts)
118
- end.empty? && verifiable_artifact[:exclude_paths].empty? && raise(Error::Config, code: :artifact_conflict)
119
- validate_artifact_path!(verifiable_artifact, artifact[:include_paths]) if verifiable_artifact[:include_paths].empty?
146
+ end
147
+
148
+ if verifiable_artifact[:include_paths].empty?
149
+ if artifact[:include_paths].empty? || verifiable_artifact[:exclude_paths].empty?
150
+ raise Error::Config, code: :artifact_conflict
151
+ else
152
+ validate_artifact_path!(verifiable_artifact, artifact[:include_paths])
153
+ end
154
+ end
120
155
  end
121
156
 
122
157
  def validate_artifact_path!(verifiable_artifact, potential_conflicts)
123
- potential_conflicts.all? do |path|
124
- loop do
125
- break if verifiable_artifact[:exclude_paths].include?(path) || ((path = File.dirname(path)) == '.')
158
+ raise Error::Config, code: :artifact_conflict unless begin
159
+ potential_conflicts.all? do |path|
160
+ loop do
161
+ break if verifiable_artifact[:exclude_paths].include?(path) || ((path = File.dirname(path)) == '.')
162
+ end
163
+ verifiable_artifact[:exclude_paths].include?(path)
126
164
  end
127
- verifiable_artifact[:exclude_paths].include?(path)
128
- end.tap { |res| res || raise(Error::Config, code: :artifact_conflict) }
165
+ end
129
166
  end
130
167
 
131
168
  def _associated_artifacts
@@ -20,7 +20,7 @@ module Dapp
20
20
  end
21
21
 
22
22
  def commit(value)
23
- sub_directive_eval { @_commit = value }
23
+ sub_directive_eval { @_commit = value.to_s }
24
24
  end
25
25
 
26
26
  def _export
@@ -40,11 +40,11 @@ module Dapp
40
40
  end
41
41
 
42
42
  def branch(value)
43
- sub_directive_eval { @_branch = value }
43
+ sub_directive_eval { @_branch = value.to_s }
44
44
  end
45
45
 
46
46
  def commit(value)
47
- sub_directive_eval { @_commit = value }
47
+ sub_directive_eval { @_commit = value.to_s }
48
48
  end
49
49
 
50
50
  def validate!
@@ -1,4 +1,4 @@
1
1
  module Dapp
2
- VERSION = '0.21.12'.freeze
2
+ VERSION = '0.21.13'.freeze
3
3
  BUILD_CACHE_VERSION = 24.1
4
4
  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.21.12
4
+ version: 0.21.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitry Stolyarov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-01-12 00:00:00.000000000 Z
11
+ date: 2018-01-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mixlib-shellout
@@ -711,7 +711,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
711
711
  version: 2.5.0
712
712
  requirements: []
713
713
  rubyforge_project:
714
- rubygems_version: 2.5.1
714
+ rubygems_version: 2.6.11
715
715
  signing_key:
716
716
  specification_version: 4
717
717
  summary: Build docker packaged apps using chef or shell