dapp 0.7.27 → 0.7.28

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: b692752064c3eee53ea7af966c4fcfcd9c5e25bb
4
- data.tar.gz: db2a6743a82d5d7c8dd1ccaa09912fcdb9a9603f
3
+ metadata.gz: 591dfeda702d8e91d15e1e3da4152556324a7d1a
4
+ data.tar.gz: e9d75837a10c303a8af9de51de347c098a33a66a
5
5
  SHA512:
6
- metadata.gz: a524bbf2e90d4bc4d7a560cb201a9909ef323fbbdb7ef8efa08f8b24e55fc0886a993956defea5f48c0f46d79a9c299f15413a688dcb80142de956f88a7bfd6d
7
- data.tar.gz: 1b8dbd3ba19736e5a1edd16d16f2a5331964a909fd3cb3b728fb0750257a6d1b7f287d05ad20aa5d497bfb819dfdd5a61526869d43850a5814a13a47bdf9d7d8
6
+ metadata.gz: 857a9902f01ef9f65def9481cd538aa71902b9908f569faeeaf1256409bb567228689bf53782bc1c3c20669356abb2be92a8cd42de2091d149d2b05a58f2f512
7
+ data.tar.gz: af3996880805bff85b6bf26d0e42464c710e6d2729c06cdbf6e4e8683e760e042fa7e7a117a4a81ff8594bca96d7e61b81713a4831984483b829c3f86de72d84
@@ -45,6 +45,7 @@ en:
45
45
  stage_artifact_double_associate: "Cannot use `%{stage}` stage for artifact, already used in `%{conflict_stage}` stage!"
46
46
  stage_artifact_not_supported_associated_stage: "Bad artifact stage `%{stage}`!"
47
47
  git_artifact_remote_unsupported_protocol: "Remote git repo `%{url}`: unsupported protocol!"
48
+ git_artifact_remote_branch_with_commit: "Remote git repo: use `commit` or `branch` directive!"
48
49
  artifact_conflict: "Conflict between artifacts paths!"
49
50
  scratch_unsupported_directive: "Scratch dimg has unsupported directive `%{directive}`!"
50
51
  scratch_artifact_required: "Scratch dimg without artifacts!"
@@ -66,7 +67,8 @@ en:
66
67
  rugged:
67
68
  rugged_remote_error: "Remote git repo `%{url}`: `%{message}`!"
68
69
  local_git_repository_does_not_exist: "Local git repo: doesn't exist!"
69
- commit_not_found_in_local_git_repository: "Local git repo: commit `%{commit}` not found (run command `dapp stages cleanup local --improper-git-commit`)!"
70
- commit_not_found_in_remote_git_repository: "Remote git repo `%{url}`: commit `%{commit}` not found (run command `dapp stages cleanup local --improper-git-commit`)!"
70
+ commit_not_found_in_local_git_repository: "Local git repo: commit `%{commit}` not found!\nIf commit has been rebased: 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!\nIf commit has been rebased: run command `dapp stages cleanup local --improper-git-commit`!"
72
+ branch_not_exist_in_remote_git_repository: "Remote git repo `%{url}`: branch `%{branch}` not exist!"
71
73
  lock:
72
74
  timeout: "Could not obtain lock for `%{name}` within %{timeout} seconds"
@@ -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
@@ -85,7 +85,7 @@ module Dapp
85
85
  end
86
86
 
87
87
  def paramshash
88
- Digest::SHA256.hexdigest [full_name, to, cwd, *include_paths, *exclude_paths, owner, group].map(&:to_s).join(':::')
88
+ Digest::SHA256.hexdigest [full_name, to, cwd, commit, branch, *include_paths, *exclude_paths, owner, group].map(&:to_s).join(':::')
89
89
  end
90
90
 
91
91
  def exclude_paths(with_cwd = false)
@@ -22,7 +22,7 @@ module Dapp
22
22
 
23
23
  def lookup_commit(commit)
24
24
  super
25
- rescue Rugged::OdbError => _e
25
+ rescue Rugged::OdbError, TypeError => _e
26
26
  raise Error::Rugged, code: :commit_not_found_in_local_git_repository, data: { commit: commit }
27
27
  end
28
28
  end
@@ -10,9 +10,7 @@ module Dapp
10
10
  dimg.project.log_secondary_process(dimg.project.t(code: 'process.git_artifact_clone', data: { name: name }), short: true) do
11
11
  begin
12
12
  Rugged::Repository.clone_at(url, path, bare: true)
13
- rescue Rugged::NetworkError => e
14
- raise Error::Rugged, code: :rugged_remote_error, data: { message: e.message, url: url }
15
- rescue Rugged::SslError => e
13
+ rescue Rugged::NetworkError, Rugged::SslError => e
16
14
  raise Error::Rugged, code: :rugged_remote_error, data: { message: e.message, url: url }
17
15
  end
18
16
  end unless File.directory?(path)
@@ -22,9 +20,18 @@ module Dapp
22
20
  branch ||= self.branch
23
21
  dimg.project.log_secondary_process(dimg.project.t(code: 'process.git_artifact_fetch', data: { name: name }), short: true) do
24
22
  git_bare.fetch('origin', [branch])
23
+ raise Error::Rugged, code: :branch_not_exist_in_remote_git_repository, data: { branch: branch, url: url } unless branch_exist?(branch)
25
24
  end unless dimg.ignore_git_fetch || dimg.project.dry_run?
26
25
  end
27
26
 
27
+ def branch_exist?(name)
28
+ git_bare.branches.exist?(branch_format(name))
29
+ end
30
+
31
+ def latest_commit(name)
32
+ git_bare.ref("refs/remotes/#{branch_format(name)}").target_id
33
+ end
34
+
28
35
  def cleanup!
29
36
  super
30
37
  FileUtils.rm_rf path
@@ -32,13 +39,19 @@ module Dapp
32
39
 
33
40
  def lookup_commit(commit)
34
41
  super
35
- rescue Rugged::OdbError => _e
42
+ rescue Rugged::OdbError, TypeError => _e
36
43
  raise Error::Rugged, code: :commit_not_found_in_remote_git_repository, data: { commit: commit, url: url }
37
44
  end
38
45
 
39
46
  protected
40
47
 
41
48
  attr_reader :url
49
+
50
+ private
51
+
52
+ def branch_format(name)
53
+ "origin/#{name.reverse.chomp('origin/'.reverse).reverse}"
54
+ end
42
55
  end
43
56
  end
44
57
  end
@@ -1,5 +1,5 @@
1
1
  # Version
2
2
  module Dapp
3
- VERSION = '0.7.27'.freeze
3
+ VERSION = '0.7.28'.freeze
4
4
  BUILD_CACHE_VERSION = 6
5
5
  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.7.27
4
+ version: 0.7.28
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitry Stolyarov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-09 00:00:00.000000000 Z
11
+ date: 2017-03-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mixlib-shellout