dapp 0.22.12 → 0.22.13

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9a58092038bf62ac6fa962e05416cfccc54e9824
4
- data.tar.gz: 0ce6299538e16dd4c228a6d4e0851cf9af53c606
3
+ metadata.gz: e36c3fb64502f0633441843f5c691c9c865532d6
4
+ data.tar.gz: 3844c3e44040b7faf4a79dd9e67316da9f62f0be
5
5
  SHA512:
6
- metadata.gz: e8261d17e445b75598da981e71d5f750a9ed41e060c3b0d7fa3a55129acee2d5359ea50d5f66948f39dd2642950123f82f00ff07e2b474e66f4027b82ff00b5d
7
- data.tar.gz: eed6248d4a9c00b131dda6abcecd1fd4a4000bbafe1d437583e3e564e76cfd055154fff65258cdde4bacba82e3ea7ee26bbd802a2245636dc68c4873751e950e
6
+ metadata.gz: b84b16c368ca5c727004a516d6fb3d499eb7da3f4499748bea228b1d018b225e6417bee653f8d8fdf6f3267790276b05020e55818f5be7ba3e16f6f44d61a98d
7
+ data.tar.gz: ce8ba096db826404d1056b4e0c3ffc30f87e695015a95d8803a7c5eb536e0b69737fe892cbb126a25c0a6dea0eab7828134a4ca1a8fa6540e593a4930526c494
@@ -81,7 +81,7 @@ en:
81
81
  stage_artifact_double_associate: "Can't use `%{stage}` stage for artifact; already used in `%{conflict_stage}` stage!"
82
82
  stage_artifact_not_supported_associated_stage: "Bad artifact stage `%{stage}`!"
83
83
  git_artifact_remote_branch_with_commit: "Remote git repo: use `commit` or `branch` directive!"
84
- artifact_conflict: "Conflict between artifacts paths!"
84
+ artifact_conflict: "Conflict between artifacts!\n\n%{dappfile_context}"
85
85
  scratch_unsupported_directive: "Scratch dimg has unsupported directive `%{directive}`!"
86
86
  scratch_artifact_required: "Scratch dimg without artifacts!"
87
87
  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
@@ -136,6 +136,7 @@ module Dapp
136
136
 
137
137
  def artifacts_after_parsing!
138
138
  _artifacts_auto_excluding!
139
+ _artifact.map(&:_config).each(&:artifacts_after_parsing!)
139
140
  end
140
141
 
141
142
  protected
@@ -71,12 +71,39 @@ module Dapp
71
71
  verifiable_artifact = artifacts.shift
72
72
  artifacts.select { |a| a[:to] == verifiable_artifact[:to] }.each do |artifact|
73
73
  next if verifiable_artifact[:index] == artifact[:index]
74
- validate_artifact!(verifiable_artifact, artifact)
75
- validate_artifact!(artifact, verifiable_artifact)
74
+ begin
75
+ validate_artifact!(verifiable_artifact, artifact)
76
+ validate_artifact!(artifact, verifiable_artifact)
77
+ rescue ::Dapp::Error::Config => e
78
+ conflict_between_artifacts!(artifact, verifiable_artifact) if e.net_status[:code] == :artifact_conflict
79
+ raise
80
+ end
76
81
  end
77
82
  end
78
83
  end
79
84
 
85
+ def conflict_between_artifacts!(*formatted_artifacts)
86
+ artifacts = formatted_artifacts.flatten.map { |formatted_artifact| formatted_artifact[:related_artifact] }
87
+ dappfile_context = artifacts.map do |artifact|
88
+ artifact_directive = []
89
+ artifact_directive << begin
90
+ if artifact.is_a? Artifact::Export
91
+ "artifact.export('#{artifact._cwd}') do"
92
+ else
93
+ "git#{"('#{artifact._url}')" if artifact.respond_to?(:_url)}.add('#{artifact._cwd}') do"
94
+ end
95
+ end
96
+ [:include_paths, :exclude_paths].each do |directive|
97
+ next if (paths = artifact.send("_#{directive}")).empty?
98
+ artifact_directive << " #{directive} '#{paths.join("', '")}'"
99
+ end
100
+ artifact_directive << " to '#{artifact._to}'"
101
+ artifact_directive << 'end'
102
+ artifact_directive.join("\n")
103
+ end.join("\n\n")
104
+ raise ::Dapp::Error::Config, code: :artifact_conflict, data: { dappfile_context: dappfile_context }
105
+ end
106
+
80
107
  def validate_artifact_format(artifacts)
81
108
  artifacts.map do |a|
82
109
  path_format = proc { |path| File.expand_path(File.join('/', path, '/'))[1..-1] }
@@ -104,7 +131,8 @@ module Dapp
104
131
  index: artifacts.index(a),
105
132
  to: to,
106
133
  include_paths: include_paths,
107
- exclude_paths: exclude_paths
134
+ exclude_paths: exclude_paths,
135
+ related_artifact: a
108
136
  }
109
137
  end
110
138
  end
@@ -113,17 +141,26 @@ module Dapp
113
141
  verifiable_artifact[:include_paths].each do |verifiable_path|
114
142
  potential_conflicts = artifact[:include_paths].select { |path| path.start_with?(verifiable_path) }
115
143
  validate_artifact_path!(verifiable_artifact, potential_conflicts)
116
- end.empty? && verifiable_artifact[:exclude_paths].empty? && raise(::Dapp::Error::Config, code: :artifact_conflict)
117
- validate_artifact_path!(verifiable_artifact, artifact[:include_paths]) if verifiable_artifact[:include_paths].empty?
144
+ end
145
+
146
+ if verifiable_artifact[:include_paths].empty?
147
+ if artifact[:include_paths].empty? || verifiable_artifact[:exclude_paths].empty?
148
+ raise ::Dapp::Error::Config, code: :artifact_conflict
149
+ else
150
+ validate_artifact_path!(verifiable_artifact, artifact[:include_paths])
151
+ end
152
+ end
118
153
  end
119
154
 
120
155
  def validate_artifact_path!(verifiable_artifact, potential_conflicts)
121
- potential_conflicts.all? do |path|
122
- loop do
123
- break if verifiable_artifact[:exclude_paths].include?(path) || ((path = File.dirname(path)) == '.')
156
+ raise ::Dapp::Error::Config, code: :artifact_conflict unless begin
157
+ potential_conflicts.all? do |path|
158
+ loop do
159
+ break if verifiable_artifact[:exclude_paths].include?(path) || ((path = File.dirname(path)) == '.')
160
+ end
161
+ verifiable_artifact[:exclude_paths].include?(path)
124
162
  end
125
- verifiable_artifact[:exclude_paths].include?(path)
126
- end.tap { |res| res || raise(::Dapp::Error::Config, code: :artifact_conflict) }
163
+ end
127
164
  end
128
165
 
129
166
  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
@@ -42,11 +42,11 @@ module Dapp
42
42
  end
43
43
 
44
44
  def branch(value)
45
- sub_directive_eval { @_branch = value }
45
+ sub_directive_eval { @_branch = value.to_s }
46
46
  end
47
47
 
48
48
  def commit(value)
49
- sub_directive_eval { @_commit = value }
49
+ sub_directive_eval { @_commit = value.to_s }
50
50
  end
51
51
 
52
52
  def validate!
@@ -1,4 +1,4 @@
1
1
  module Dapp
2
- VERSION = '0.22.12'.freeze
2
+ VERSION = '0.22.13'.freeze
3
3
  BUILD_CACHE_VERSION = 26
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.22.12
4
+ version: 0.22.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-15 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
@@ -719,7 +719,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
719
719
  version: 2.5.0
720
720
  requirements: []
721
721
  rubyforge_project:
722
- rubygems_version: 2.5.1
722
+ rubygems_version: 2.6.11
723
723
  signing_key:
724
724
  specification_version: 4
725
725
  summary: Build docker packaged apps using chef or shell