dapp 0.6.16 → 0.6.17

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: 876026d4b44e0e133226070491379a862830e00e
4
- data.tar.gz: e2b22a947be59dcef0b43f76f1d603172b51d95a
3
+ metadata.gz: 9e78ed224c52a413cdceeaacf7877326f47dc1dd
4
+ data.tar.gz: ec07c5e997ed182b9ccfcf1c8097823ef3294d2e
5
5
  SHA512:
6
- metadata.gz: 53ddd82966ead8876733adcef218708576845ee385d80e0f4aae84ee6a80822bc72317a1193b2260bdeb94133118164ee8e22d0c2f5bf83029e5598750512872
7
- data.tar.gz: 297cf30895ee5f6e9cfaf542cc3b583f07e8f92490763b7962e2fc796f4aba2ebcf3b3257971d72c17dea797058e84cd22c251d03793850ab30bd747d3eb7aef
6
+ metadata.gz: 7e3e56663b2ee9c215a284a7e59ba2ce71bf1a888c695002f123862d2c8e59676dc5a91ac74fe81082bc1ac4d14498eaab9e7d3e264501912e7f144535a0e0ed
7
+ data.tar.gz: b105a61fec8f6b30bb9d9d65ed8621bfaba027e299136fd2f739a1f650453c6af6bca4656d63adc64811ccd65a5c3c7205f578da0dbfdc6a56fa17b7c7481e32
@@ -19,7 +19,7 @@ module Dapp
19
19
 
20
20
  def from(image, cache_version: nil)
21
21
  image = image.to_s
22
- raise(Error::Config, code: :docker_from_incorrect, data: { name: image }) unless image =~ Image::Docker.image_regex
22
+ raise(Error::Config, code: :docker_from_incorrect, data: { name: image }) unless Image::Docker.image_name?(image)
23
23
  raise(Error::Config, code: :docker_from_without_tag, data: { name: image }) unless image.include?(':')
24
24
  @_from = image
25
25
  @_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:)
@@ -64,7 +64,7 @@ module Dapp
64
64
  end
65
65
 
66
66
  def validate_repo_name(repo)
67
- raise(Error::Project, code: :repo_name_incorrect, data: { name: repo }) unless repo =~ DockerRegistry.repo_regex
67
+ raise(Error::Project, code: :repo_name_incorrect, data: { name: repo }) unless DockerRegistry.repo_name?(repo)
68
68
  end
69
69
 
70
70
  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_apps_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
@@ -1,5 +1,5 @@
1
1
  # Version
2
2
  module Dapp
3
- VERSION = '0.6.16'.freeze
3
+ VERSION = '0.6.17'.freeze
4
4
  BUILD_CACHE_VERSION = 5
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.6.16
4
+ version: 0.6.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitry Stolyarov