manifest-builder 0.3.0 → 0.4.0

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: 3a037fcd4009d953d8bc0102eaad598a36ae025d
4
- data.tar.gz: ff1a9a5e19c3a3b5a98a513abfcfc2a99ef7d40f
3
+ metadata.gz: 25d294dbd696497265d4cbd29c06158d121ae09e
4
+ data.tar.gz: 6a3b1ec3431326915f54bc3d50adab16872512b4
5
5
  SHA512:
6
- metadata.gz: c614b63ea69740b5c82f46b1d540ef8f1920f700d5579336fbd3de33a9a7e7c75811515b8d6da02a9d12a23d22d0813c281c3269b38628936a12ab4fb4243458
7
- data.tar.gz: f9a36607524d6d7ec9958d5bf89c2c6a587f5bb037a4fffb276f634001638538e8de7ce3efeb62899147293277301a2e86616898e8e200bb85a3cd60ac843836
6
+ metadata.gz: 5a7425bea022457dd3c2788c4dc83b3b663fc4d37e565945a9d50e41d08adafa681987a0e97f3a0bf7e2a5d32c80b9f2775d2febb2d65ea8622030be4740537d
7
+ data.tar.gz: e71d7292a1da2612bbad013543de6b79d06381802d4744b306ab7d9b552820d5e2c84583bf798a2686effe5eb6068e19e1dff5f0f57002324e5ee42498147aa8
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- manifest-builder (0.3.0)
4
+ manifest-builder (0.4.0)
5
5
  archive-tar-minitar (= 0.5.2)
6
6
  chefrepo-builder (>= 0.9.27, < 1.1)
7
7
  cicd-builder (>= 0.9.33, < 1.1)
@@ -77,40 +77,103 @@ module CiCd
77
77
  # super
78
78
  # end
79
79
 
80
+ VER_RGX = %r'^\d+\.\d+(\.?\d)*$'
81
+ MMP_RGX = %r'^(\d+\.?){2,3}$'
82
+ # ---------------------------------------------------------------------------------------------------------------
83
+ def getVersionBuildFromName(artifact)
84
+ version = artifact.dup
85
+ version.gsub!(%r'\.*(tar\.gz|tgz|bzip2|bz2|jar|war|[a-z]+)$', '')
86
+ # if artifact =~ %r'^#{comp[0]}'
87
+ # version.gsub!(%r'^#{comp[0]}\.*-*','')
88
+ # else
89
+ # version.gsub!(%r'^[a-zA-Z\-._]+','')
90
+ # end
91
+ version.gsub!(%r'^[a-zA-Z\-._]+', '')
92
+
93
+ # build = if version.match(VER_RGX)
94
+ # if version.match(%r'^(\d+\.?){2,3}$')
95
+ # 0
96
+ # elsif version.match(%r'\-')
97
+ # version,build = version.split(/-/)
98
+ # build
99
+ # else
100
+ # 0
101
+ # end
102
+ # else
103
+ # 0
104
+ # end
105
+ build = ''
106
+ if version.match(VER_RGX)
107
+ if version.match(%r'\-')
108
+ version,build = version.split(/-/)
109
+ end
110
+ # else
111
+ # match = version.match(%r'^(\d+)-(\d{4}-\d{2}-\d{2}[_]\d{2}-\d{2}-\d{2})\.(release|snapshot)$')
112
+ # if match
113
+ # build = match[1]
114
+ # # version.gsub!(/^#{build}-/, '')
115
+ # version = match[2]
116
+ # end
117
+ end
118
+ [version,build]
119
+ end
120
+
121
+ # ---------------------------------------------------------------------------------------------------------------
80
122
  def getVersionBuild(path,artifact,comp)
81
123
  version,build = File.split(path)
82
- if build.match(%r'^\d+$') and version.match(%r'/?\d+\.\d+\.?\d*$')
124
+ if build.match(%r'^\d+$') and version.match(%r'/?\d+\.\d+\.?\d*$') # Hole in one!
83
125
  version = File.basename(version)
84
- build = build.to_i
85
126
  else
86
- build = comp[1][:build] || 0
87
- version = comp[1][:build].nil? ? '' : ( comp[1][:build] > 0 ? build.to_s : '' )
88
- build = comp[1][:build] || 0
89
- unless version.match(%r'^[.0-9]+$')
127
+ if build.match(VER_RGX)
128
+ version = build
129
+ build = ''
130
+ else
131
+ version = comp[1][:build].nil? ? '' : ( comp[1][:build] > 0 ? build.to_s : '' )
132
+ end
133
+ unless version.match(VER_RGX)
90
134
  version = comp[1][:version] || ''
91
135
  end
136
+ ver,bld = getVersionBuildFromName(artifact)
92
137
  if version.empty?
93
- version = artifact.dup
94
- version.gsub!(%r'\.*(tar\.gz|tgz|bzip2|bz2|jar|war|[a-z]+)$','')
95
- if artifact =~ %r'^#{comp[0]}'
96
- version.gsub!(%r'^#{comp[0]}\.*-*','')
97
- else
98
- version.gsub!(%r'^[a-zA-Z\-.]+','')
99
- end
138
+ version,build = [ver,bld]
100
139
  if version.empty?
101
140
  version = @vars[:build_ver]
102
141
  else
103
142
  uri,ver = File.split(path)
104
- if version =~ %r'^#{ver}' and version =~ %r'^(\d+\.){3}'
143
+ if version =~ %r'^#{ver}'
144
+ if version =~ VER_RGX
145
+ if version =~ %r'^#{build}' # prob the major part of version
146
+ build = ''
147
+ end
148
+ else
149
+ unless version.eql?(ver)
150
+ build = version.dup
151
+ version = ver
152
+ build = build.gsub(%r'^#{version}(\.|-)*','')
153
+ end
154
+ end
155
+ else
105
156
  build = version.dup
106
157
  version = ver
107
158
  build = build.gsub(%r'^#{version}(\.|-)*','')
108
159
  end
109
160
  end
110
- if build == 0 or build.empty?
111
- build = @vars[:build_num]
112
- end
113
161
  else
162
+ if ver.match(VER_RGX)
163
+ if ver.match(MMP_RGX)
164
+ if version.length < ver.length
165
+ version = ver # Guessing it is the better version
166
+ end
167
+ else
168
+ build = ver.dup
169
+ # version.gsub!(/\.d+$/, '')
170
+ build.gsub!(/^#{version}\.?/, '')
171
+ end
172
+ end
173
+ end
174
+ unless build.match(%r'^[1-9]\d*$')
175
+ build = comp[1][:build]
176
+ build = @vars[:build_num] if (build.nil? or build.empty? or build.to_i == 0)
114
177
  end
115
178
  end
116
179
  [version,build]
@@ -2,7 +2,7 @@ module CiCd
2
2
  module Builder
3
3
  module Manifest
4
4
  # manifest-builder version
5
- VERSION = '0.3.0'
5
+ VERSION = '0.4.0'
6
6
  MAJOR, MINOR, TINY = VERSION.split('.')
7
7
  PATCH = TINY
8
8
  end
@@ -3,7 +3,7 @@
3
3
  require File.expand_path('../lib/cicd/builder/manifest/version', __FILE__)
4
4
 
5
5
  Gem::Specification.new do |gem|
6
- gem.name = "manifest-builder"
6
+ gem.name = 'manifest-builder'
7
7
  gem.version = CiCd::Builder::Manifest::VERSION
8
8
  gem.summary = %q{Repo builder for a software manifest}
9
9
  gem.description = %q{Repo builder of the software manifest.yml for Continuous Integration/Continuous Delivery artifact promotion style deployments}
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: manifest-builder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christo De Lange
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-13 00:00:00.000000000 Z
11
+ date: 2015-03-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cicd-builder