dapp 0.7.4 → 0.7.5

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: 5293969d87b7fa3109c27d66ff12ef98b148c096
4
- data.tar.gz: 62c6faae424495c50c993eefe5bfd612e58076ed
3
+ metadata.gz: 8cd65c99fc4cd2ebc304c8de2c5680919199ced5
4
+ data.tar.gz: 9279deb5fa383a4b907be5888da7db5ee98ff31b
5
5
  SHA512:
6
- metadata.gz: e0426ec31dc190d4e37a6caec2e1c318bf57bd22a5b60c6e52ea553473c3118467aff455946b9d169534b9dfa2c1992cf6b17ab77809d2bcd79cfe5b95a0efa0
7
- data.tar.gz: fe57e06e0a37da02074899f51cade85281431e64736818baa02c90a9bd11534f4efdf9d1026fc19071f5e258270938bf74611dcd0a14e75f4f9847c370b1ebce
6
+ metadata.gz: a77f2d367d84b1a6ab9bc4aaec24b4a12292f45a39363476e6d8d94305c14c034c5cb029dbd61b97623826e420a638240046094b53cd368ad875305b776aa69c
7
+ data.tar.gz: 085af446ec514d03769945e77f1888840fdabf370f9e576b995e10ef18b1a0dd052a9875d7fab88dec9d889d363860900e27f05e063b1a75a37d8e484fde8436
@@ -8,7 +8,7 @@ module Dapp
8
8
 
9
9
  def from(image, cache_version: nil)
10
10
  image = image.to_s
11
- raise(Error::Config, code: :docker_from_incorrect, data: { name: image }) unless image =~ Image::Docker.image_regex
11
+ raise(Error::Config, code: :docker_from_incorrect, data: { name: image }) unless Image::Docker.image_name?(image)
12
12
  raise(Error::Config, code: :docker_from_without_tag, data: { name: image }) unless image.include?(':')
13
13
  @_from = image
14
14
  @_from_cache_version = cache_version
@@ -2,7 +2,7 @@ module Dapp
2
2
  # DockerRegistry
3
3
  module DockerRegistry
4
4
  def self.new(repo)
5
- repo_regex =~ repo
5
+ /^#{repo_name_format}$/ =~ repo
6
6
  expected_hostname = Regexp.last_match(:hostname)
7
7
  expected_repo_suffix = Regexp.last_match(:repo_suffix)
8
8
  expected_hostname_url = expected_hostname ? "http://#{expected_hostname}" : nil
@@ -14,14 +14,18 @@ module Dapp
14
14
  end
15
15
  end
16
16
 
17
- def self.repo_regex
17
+ def self.repo_name_format
18
18
  separator = '[_.]|__|[-]*'
19
19
  alpha_numeric = '[[:alnum:]]*'
20
20
  component = "#{alpha_numeric}[#{separator}#{alpha_numeric}]*"
21
21
  port_number = '[[:digit:]]+'
22
- hostcomponent = '[[:alnum:]-]*[[:alnum:]]'
23
- hostname = "#{hostcomponent}[\.#{hostcomponent}]*(?<port>:#{port_number})?"
24
- %r{^(?<hostname>#{hostname}/)?(?<repo_suffix>#{component}[/#{component}]*)$}
22
+ hostcomponent = '[[:alnum:]_-]*[[:alnum:]]'
23
+ hostname = "#{hostcomponent}[\\.#{hostcomponent}]*(?<port>:#{port_number})?"
24
+ "(?<hostname>#{hostname}/)?(?<repo_suffix>#{component}[/#{component}]*)"
25
+ end
26
+
27
+ def self.repo_name?(name)
28
+ !(/^#{repo_name_format}$/ =~ name).nil?
25
29
  end
26
30
 
27
31
  def self.hostname_exist?(url)
@@ -68,8 +68,14 @@ module Dapp
68
68
  end
69
69
 
70
70
  class << self
71
- def image_regex
72
- /^[a-z0-9]+(?:[._-][a-z0-9]+)*(:[\w][\w.-]{0,127})?$/
71
+ def image_name_format
72
+ separator = '[_.]|__|[-]*'
73
+ tag = "[[:alnum:]][[[:alnum:]]#{separator}]{0,127}"
74
+ "#{DockerRegistry.repo_name_format}(:(?<tag>#{tag}))?"
75
+ end
76
+
77
+ def image_name?(name)
78
+ !(/^#{image_name_format}$/ =~ name).nil?
73
79
  end
74
80
 
75
81
  def tag!(id:, tag:)
@@ -56,7 +56,7 @@ module Dapp
56
56
  end
57
57
 
58
58
  def validate_repo_name(repo)
59
- raise(Error::Project, code: :repo_name_incorrect, data: { name: repo }) unless repo =~ DockerRegistry.repo_regex
59
+ raise(Error::Project, code: :repo_name_incorrect, data: { name: repo }) unless Dapp::DockerRegistry.repo_name?(repo)
60
60
  end
61
61
 
62
62
  def proper_cache_version?
@@ -7,7 +7,7 @@ module Dapp
7
7
  module Tag
8
8
  def tag(tag)
9
9
  raise Error::Project, code: :tag_command_unexpected_dimgs_number unless build_configs.one?
10
- raise Error::Project, code: :tag_command_incorrect_tag, data: { name: tag } unless tag =~ Image::Docker.image_regex
10
+ raise Error::Project, code: :tag_command_incorrect_tag, data: { name: tag } unless Image::Docker.image_name?(tag)
11
11
  Application.new(config: build_configs.first, project: self, ignore_git_fetch: true, should_be_built: true).tap do |app|
12
12
  app.tag!(tag)
13
13
  end
data/lib/dapp/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # Version
2
2
  module Dapp
3
- VERSION = '0.7.4'.freeze
3
+ VERSION = '0.7.5'.freeze
4
4
  BUILD_CACHE_VERSION = 6
5
5
  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.7.4
4
+ version: 0.7.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitry Stolyarov