dapp 0.23.5 → 0.23.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: d1672f9ce8c2f27ed332a84192f58e5f7bcd0ac4
4
- data.tar.gz: 1fca50e98ca0e2ce4b7a92e6d3e550294f2760fe
3
+ metadata.gz: 4b7414b86082d6d690431f65221118dd25133296
4
+ data.tar.gz: cb0a237e5551ae18f7b95fceee867a233afb35e9
5
5
  SHA512:
6
- metadata.gz: 723888bf022b14c57707e0a11f4129a43bb4abe2016eb5a013c296ac2f95d09e068cc8fade9ea221ded9d14b4f1f6d768db2a6d32d6aefbea9cb1288aa761ddd
7
- data.tar.gz: e817219bea8f79e6ea181e44e7a38a4940f4d7e28889be4de2bf98be6601b6a7573867360c1005cad4e5f86b146d1da93f70caf8328eaadb61e28a9b6599df3f
6
+ metadata.gz: 02f5765c3636cfcdd0d81c75f181ff1285ea21f5af17865256918f08d780ea2064155dcc0df1eb1e96456689f6d783b6478fa99c6820468a4fd59b4849d107d4
7
+ data.tar.gz: 25d51ee250add4172c3b5c458cbfc9f20fd91d3b416ebb7d5ff450a10dcc6492ef069b0968ab85d3bb6c15846d8158aeaa0ecc508df4674aab02afa935a9869d
@@ -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
@@ -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.23.5"
2
+ VERSION = "0.23.6"
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.23.5
4
+ version: 0.23.6
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
@@ -721,7 +721,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
721
721
  version: 2.5.0
722
722
  requirements: []
723
723
  rubyforge_project:
724
- rubygems_version: 2.5.1
724
+ rubygems_version: 2.6.11
725
725
  signing_key:
726
726
  specification_version: 4
727
727
  summary: Build docker packaged apps using chef or shell