dapp 0.9.2 → 0.9.3

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: 84ec210f8b9be2cedca8656153394c71bd290af9
4
- data.tar.gz: c99afb59f2fc0e60adaf880025dd1a14007b33b3
3
+ metadata.gz: b9a2256c433ec1a0ba5025f5bb51d6c1d32f9dbc
4
+ data.tar.gz: 54183e3a8a445fa1500e632f54dc8d7073c733bd
5
5
  SHA512:
6
- metadata.gz: 5e5b9adb74849cf1fe3e6f55ff94d20f3931f38fe666275a045cef4fd6aff8c1023b005d719878f65a590d6d9915a9e8a1a363f6f208c86efd069d35fbcd853b
7
- data.tar.gz: fd3e4c87500426e469ca878120e2ac4867c598baec0fd48438c8fe1e2ec8f6bbd086b983bd516708a790afd4c26848ee9ec885938bf9d4a9387ca04278b6dc55
6
+ metadata.gz: 0c2769fec1709ae73c2c483b70e38e1ac7816f809fab9455a1f19208bdb0a63d6541c98962906b0a22f8ca1880d4d65ad7657f9872d16bb7978927ec3c969662
7
+ data.tar.gz: 46464a15195b713fa5ddf7ae85d6c98db53390f6e7c3608bdab6da7f72a29515da2ffc806cd9f909cb390c23cee45b39f6bd9ea81bdf7c882c1812a9a41e682e
@@ -50,6 +50,7 @@ en:
50
50
  stage_artifact_double_associate: "Cannot use `%{stage}` stage for artifact, already used in `%{conflict_stage}` stage!"
51
51
  stage_artifact_not_supported_associated_stage: "Bad artifact stage `%{stage}`!"
52
52
  git_artifact_remote_unsupported_protocol: "Remote git repo `%{url}`: unsupported protocol!"
53
+ git_artifact_remote_branch_with_commit: "Remote git repo: use `commit` or `branch` directive!"
53
54
  artifact_conflict: "Conflict between artifacts paths!"
54
55
  scratch_unsupported_directive: "Scratch dimg has unsupported directive `%{directive}`!"
55
56
  scratch_artifact_required: "Scratch dimg without artifacts!"
@@ -67,7 +68,8 @@ en:
67
68
  rugged:
68
69
  rugged_remote_error: "Remote git repo `%{url}`: `%{message}`!"
69
70
  local_git_repository_does_not_exist: "Local git repo: doesn't exist!"
70
- commit_not_found_in_local_git_repository: "Local git repo: commit `%{commit}` not found (run command `dapp stages cleanup local --improper-git-commit`)!"
71
- commit_not_found_in_remote_git_repository: "Remote git repo `%{url}`: commit `%{commit}` not found (run command `dapp stages cleanup local --improper-git-commit`)!"
71
+ commit_not_found_in_local_git_repository: "Local git repo: commit `%{commit}` not found!\nIf commit has been rebased: run command `dapp dimg stages cleanup local --improper-git-commit`!"
72
+ commit_not_found_in_remote_git_repository: "Remote git repo `%{url}`: commit `%{commit}` not found!\nIf commit has been rebased: run command `dapp dimg stages cleanup local --improper-git-commit`!"
73
+ branch_not_exist_in_remote_git_repository: "Remote git repo `%{url}`: branch `%{branch}` not exist!"
72
74
  lock:
73
75
  timeout: "Could not obtain lock for `%{name}` within %{timeout} seconds"
@@ -39,11 +39,29 @@ module Dapp
39
39
  end
40
40
 
41
41
  def empty?
42
- dependencies_empty? || dimg.git_artifacts.all? { |git_artifact| !git_artifact.any_changes?(prev_g_a_stage.layer_commit(git_artifact)) }
42
+ dependencies_empty? || git_artifacts_without_changes?
43
43
  end
44
44
 
45
45
  private
46
46
 
47
+ def git_artifacts_without_changes?
48
+ local_git_artifacts_without_changes? && remote_git_artifacts_without_changes?
49
+ end
50
+
51
+ def local_git_artifacts_without_changes?
52
+ dimg.local_git_artifacts.all? do |git_artifact|
53
+ from_commit = prev_g_a_stage.layer_commit(git_artifact)
54
+ to_commit = dimg.dev_mode? ? nil : layer_commit(git_artifact)
55
+ !git_artifact.any_changes?(from_commit, to_commit)
56
+ end
57
+ end
58
+
59
+ def remote_git_artifacts_without_changes?
60
+ dimg.remote_git_artifacts.all? do |git_artifact|
61
+ !git_artifact.any_changes?(prev_g_a_stage.layer_commit(git_artifact), layer_commit(git_artifact))
62
+ end
63
+ end
64
+
47
65
  def commit_list
48
66
  dimg.git_artifacts.map { |git_artifact| layer_commit(git_artifact) }
49
67
  end
@@ -28,7 +28,7 @@ module Dapp
28
28
  attr_accessor :_url, :_name, :_branch, :_commit
29
29
 
30
30
  def _artifact_options
31
- super.merge(name: _name, branch: _branch)
31
+ super.merge(name: _name, branch: _branch, commit: _commit)
32
32
  end
33
33
 
34
34
  protected
@@ -40,6 +40,11 @@ module Dapp
40
40
  def commit(value)
41
41
  @_commit = value
42
42
  end
43
+
44
+ def validate!
45
+ super
46
+ raise Error::Config, code: :git_artifact_remote_branch_with_commit if !_branch.nil? && !_commit.nil?
47
+ end
43
48
  end
44
49
 
45
50
  protected
@@ -30,7 +30,7 @@ module Dapp
30
30
 
31
31
  def lookup_commit(commit)
32
32
  super
33
- rescue Rugged::OdbError => _e
33
+ rescue Rugged::OdbError, TypeError => _e
34
34
  raise Error::Rugged, code: :commit_not_found_in_local_git_repository, data: { commit: commit }
35
35
  end
36
36
  end
@@ -24,16 +24,21 @@ module Dapp
24
24
  branch ||= self.branch
25
25
  dimg.dapp.log_secondary_process(dimg.dapp.t(code: 'process.git_artifact_fetch', data: { name: name }), short: true) do
26
26
  git.fetch('origin', [branch])
27
+ raise Error::Rugged, code: :branch_not_exist_in_remote_git_repository, data: { branch: branch, url: url } unless branch_exist?(branch)
27
28
  end unless dimg.ignore_git_fetch || dimg.dapp.dry_run?
28
29
  end
29
30
 
30
- def latest_commit(branch)
31
- git.ref("refs/remotes/origin/#{branch}").target_id
31
+ def branch_exist?(name)
32
+ git.branches.exist?(branch_format(name))
33
+ end
34
+
35
+ def latest_commit(name)
36
+ git.ref("refs/remotes/#{branch_format(name)}").target_id
32
37
  end
33
38
 
34
39
  def lookup_commit(commit)
35
40
  super
36
- rescue Rugged::OdbError => _e
41
+ rescue Rugged::OdbError, TypeError => _e
37
42
  raise Error::Rugged, code: :commit_not_found_in_remote_git_repository, data: { commit: commit, url: url }
38
43
  end
39
44
 
@@ -44,6 +49,12 @@ module Dapp
44
49
  def git
45
50
  super(bare: true)
46
51
  end
52
+
53
+ private
54
+
55
+ def branch_format(name)
56
+ "origin/#{name.reverse.chomp('origin/'.reverse).reverse}"
57
+ end
47
58
  end
48
59
  end
49
60
  end
data/lib/dapp/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Dapp
2
- VERSION = '0.9.2'.freeze
2
+ VERSION = '0.9.3'.freeze
3
3
  BUILD_CACHE_VERSION = 7
4
4
  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.9.2
4
+ version: 0.9.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitry Stolyarov