dapp 0.7.21 → 0.7.22

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: 1f9e155a712a0ed1bf5eee4f2eb9eb3ee058e38d
4
- data.tar.gz: f490000499dcdb9654ed0afb7d92b2bd6d8d5073
3
+ metadata.gz: e1d331bc07f3e624682ffd414440632af1539623
4
+ data.tar.gz: fb78b3ad52f34339480699c0732f3257e591c679
5
5
  SHA512:
6
- metadata.gz: 0ecc323bb36092b93fb788ee1ac3fb152b42891f64b7e4d904c905f55fdc6d4393252763789f03c1484fd4df06d35c3c1d6e3a0efafe930ae8508289cd195b3f
7
- data.tar.gz: 0e3bac35a542c600f1cd39d561ddcef7c41899faecdbefc94aeca8b53e25b251f6c3324238529583889c2d386843d53b81ce84153561d11c891395e7bcca543c
6
+ metadata.gz: 2645b1233f00e1cdf09f22f42da53659df25b187e89e93541eb9a35f281bda3e1fa860396e36404671ddd5953c23e11677a41bf07a6a400abfc7c067304c7e6c
7
+ data.tar.gz: d9360bf403e44a3c5dd96bd3d65c4c036b9e74c6f6f256f78c0aa4c34527e5274fee9b5d9bf343d2211785061b38f241d605ebb0e9f7d812c295586341290bea
@@ -4,8 +4,8 @@ en:
4
4
  signature: "signature: %{signature}"
5
5
  info:
6
6
  created_at: "date: %{value}"
7
- size: "size: %{value} MB"
8
- difference: "difference: %{value} MB"
7
+ mb_size: "size: %{mb} MB"
8
+ difference: "difference: %{mb} MB"
9
9
  commands: "commands:"
10
10
  instructions: "instructions:"
11
11
  container:
@@ -64,6 +64,7 @@ en:
64
64
  page_not_found: "Registry `%{registry}`: page `%{url}` not found!"
65
65
  user_not_authorized: 'Registry `%{registry}`: user not authorized!'
66
66
  rugged:
67
- rugged_network_error: "Remote git repo `%{url}`: `%{message}`!"
67
+ rugged_remote_error: "Remote git repo `%{url}`: `%{message}`!"
68
+ local_git_repository_does_not_exist: "Local git repo: doesn't exist!"
68
69
  lock:
69
70
  timeout: "Could not obtain lock for `%{name}` within %{timeout} seconds"
@@ -39,9 +39,9 @@ module Dapp
39
39
  copy_files = proc do |from_, path_ = ''|
40
40
  "if [[ -d #{File.join(from_, path_)} ]] || [[ -f #{File.join(from_, path_)} ]]; then " \
41
41
  "#{dimg.project.find_bin} #{File.join(from_, path_)} #{excludes} -type f -exec " \
42
- "#{dimg.project.bash_bin} -ec '#{dimg.project.install_bin} -D #{credentials} {} " \
43
- "#{File.join(to, '$(echo {} | ' \
44
- "#{dimg.project.sed_bin} -e \"s/#{from_.gsub('/', '\\/')}//g\")")}' \\; ;" \
42
+ "#{dimg.project.bash_bin} -ec '#{dimg.project.install_bin} -D #{credentials} \"{}\" " \
43
+ "\"#{File.join(to, "$(echo \"{}\" | " \
44
+ "#{dimg.project.sed_bin} -e \"s/^#{from_.gsub('/', '\\/')}\\///g\")")}\"' \\; ;" \
45
45
  'fi'
46
46
  end
47
47
 
@@ -45,13 +45,13 @@ module Dapp
45
45
 
46
46
  def log_image_size
47
47
  if !prev_stage.nil? && from_image.tagged?
48
- size = image.size.to_f - from_image.size.to_f
48
+ bytes = image.size - from_image.size
49
49
  code = 'image.info.difference'
50
50
  else
51
- size = image.size
52
- code = 'image.info.size'
51
+ bytes = image.size
52
+ code = 'image.info.mb_size'
53
53
  end
54
- dimg.project.log_info dimg.project.t(code: code, data: { value: size.to_f.round(2) })
54
+ dimg.project.log_info dimg.project.t(code: code, data: { mb: (bytes / 1000 / 1000).round(3) })
55
55
  end
56
56
 
57
57
  def log_image_commands
@@ -26,7 +26,7 @@ module Dapp
26
26
 
27
27
  def initialize(cwd = '/', **kwargs, &blk)
28
28
  raise Error::Config, code: :export_cwd_absolute_path_required unless Pathname(cwd).absolute?
29
- @_cwd = cwd
29
+ @_cwd = path_format(cwd)
30
30
  @_include_paths ||= []
31
31
  @_exclude_paths ||= []
32
32
 
@@ -48,17 +48,17 @@ module Dapp
48
48
 
49
49
  def to(absolute_path)
50
50
  raise Error::Config, code: :export_to_absolute_path_required unless Pathname(absolute_path).absolute?
51
- @_to = absolute_path
51
+ @_to = path_format(absolute_path)
52
52
  end
53
53
 
54
54
  def include_paths(*relative_paths)
55
55
  raise Error::Config, code: :export_include_paths_relative_path_required unless relative_paths.all? { |path| Pathname(path).relative? }
56
- _include_paths.concat(relative_paths)
56
+ _include_paths.concat(relative_paths.map(&method(:path_format)))
57
57
  end
58
58
 
59
59
  def exclude_paths(*relative_paths)
60
60
  raise Error::Config, code: :export_exclude_paths_relative_path_required unless relative_paths.all? { |path| Pathname(path).relative? }
61
- _exclude_paths.concat(relative_paths)
61
+ _exclude_paths.concat(relative_paths.map(&method(:path_format)))
62
62
  end
63
63
 
64
64
  def owner(owner)
@@ -72,6 +72,10 @@ module Dapp
72
72
  def validate!
73
73
  raise Error::Config, code: :export_to_required if _to.nil?
74
74
  end
75
+
76
+ def path_format(path)
77
+ path.chomp('/')
78
+ end
75
79
  end
76
80
 
77
81
  protected
@@ -12,6 +12,8 @@ module Dapp
12
12
 
13
13
  def path
14
14
  @path ||= Rugged::Repository.discover(dimg.home_path.to_s).path
15
+ rescue Rugged::RepositoryError => _e
16
+ raise Error::Rugged, code: :local_git_repository_does_not_exist
15
17
  end
16
18
 
17
19
  def latest_commit(branch = nil)
@@ -11,7 +11,9 @@ module Dapp
11
11
  begin
12
12
  Rugged::Repository.clone_at(url, path, bare: true)
13
13
  rescue Rugged::NetworkError => e
14
- raise Error::Rugged, code: :rugged_network_error, data: { message: e.message, url: url }
14
+ raise Error::Rugged, code: :rugged_remote_error, data: { message: e.message, url: url }
15
+ rescue Rugged::SslError => e
16
+ raise Error::Rugged, code: :rugged_remote_error, data: { message: e.message, url: url }
15
17
  end
16
18
  end unless File.directory?(path)
17
19
  end
@@ -90,7 +90,18 @@ module Dapp
90
90
  def cache_reset(name = '')
91
91
  cache.delete(name)
92
92
  Project.shellout!("docker images --format='{{.Repository}}:{{.Tag}};{{.ID}};{{.CreatedAt}};{{.Size}}' --no-trunc #{name}").stdout.lines.each do |l|
93
- name, id, created_at, size = l.split(';')
93
+ name, id, created_at, size_field = l.split(';')
94
+ size = begin
95
+ number, unit = size_field.split
96
+ coef = case unit.to_s.downcase
97
+ when 'b' then return number.to_f
98
+ when 'kb' then 1
99
+ when 'mb' then 2
100
+ when 'gb' then 3
101
+ when 'tb' then 4
102
+ end
103
+ number.to_f * (1000 ** coef)
104
+ end
94
105
  cache[name] = { id: id, created_at: created_at, size: size }
95
106
  end
96
107
  end
@@ -1,5 +1,5 @@
1
1
  # Version
2
2
  module Dapp
3
- VERSION = '0.7.21'.freeze
3
+ VERSION = '0.7.22'.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.21
4
+ version: 0.7.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitry Stolyarov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-15 00:00:00.000000000 Z
11
+ date: 2016-12-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mixlib-shellout