puppet-blacksmith 3.1.1 → 3.2.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
MGQ5ZjA4ODM1M2ZkY2ZhY2M4ZTIyOTc5NGU4MDllYjA3ODU0YzczMA==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a8de434a181f1a14aa9077c263e96d7d03981f47
|
4
|
+
data.tar.gz: 2a6ce31ae7e5bc58c2b48f0eefc5a89aeeb16bcb
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
ZjZhODBmZjQ4ZGRkZTYzZGRjYjI3Y2I5MzU5NDNkZWU3OGE0M2QwMjMyNTNl
|
11
|
-
ZGFiMzNjZTk0OGY2NjM0OTcyNmRiYTU3MWNhMTg3MTk2MTJjMGM=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
YjUxMWZkNjgzOWI5ZDVhNTk0YjFjNzk4N2I2MzJhYjU1OGI3NjQ3YTlmZTZi
|
14
|
-
Y2FmOWNlMWUyNjU2YWM1NGExNmNiOTFlMGM2MThiNDMzNjQzNzkzZDYwYzkw
|
15
|
-
ZWU0Y2FkY2YzZTk1ODc5YzU1OTJkZjA0OWUzYTY3NTgyMWEzNjA=
|
6
|
+
metadata.gz: 39e36ebfbb8a9579b2618bfa08185b547b0612aa392b42e776b4171d4ce0e4826ed396e59ea8737581c465e95b95e72949c3edc9a21690390e8ba244580d9cd0
|
7
|
+
data.tar.gz: 8e4d2d9837ff3154cb0e16e137c50f7082a30692ec542a4da9edf02d011509e9cef2c90527f14ef463547f837c68c7386096c05cf67207eee3e6259f607414fd
|
@@ -11,6 +11,7 @@
|
|
11
11
|
# require 'puppet/module_tool'
|
12
12
|
require 'puppet'
|
13
13
|
require 'puppet/module_tool'
|
14
|
+
require 'puppet_blacksmith/version_helper'
|
14
15
|
|
15
16
|
Puppet[:confdir] = "."
|
16
17
|
|
@@ -51,14 +52,18 @@ module Blacksmith
|
|
51
52
|
metadata['version']
|
52
53
|
end
|
53
54
|
|
54
|
-
def bump!
|
55
|
-
new_version = increase_version(version)
|
55
|
+
def bump!(level = :patch)
|
56
|
+
new_version = increase_version(version, level)
|
56
57
|
text = File.read(path)
|
57
58
|
text = replace_version(text, new_version)
|
58
59
|
File.open(path, "w") {|file| file.puts text}
|
59
60
|
new_version
|
60
61
|
end
|
61
62
|
|
63
|
+
[:major, :minor, :patch].each do |level|
|
64
|
+
define_method("bump_#{level}!") { bump!(level) }
|
65
|
+
end
|
66
|
+
|
62
67
|
def bump_dep!(module_name, version)
|
63
68
|
text = File.read(path)
|
64
69
|
text = replace_dependency_version(text, module_name, version)
|
@@ -75,10 +80,9 @@ module Blacksmith
|
|
75
80
|
end
|
76
81
|
end
|
77
82
|
|
78
|
-
def increase_version(version)
|
79
|
-
v =
|
80
|
-
|
81
|
-
v.bump.to_s
|
83
|
+
def increase_version(version, level = :patch)
|
84
|
+
v = VersionHelper::Version.new(version)
|
85
|
+
v.send("#{level}!").to_s
|
82
86
|
end
|
83
87
|
|
84
88
|
def replace_dependency_version(text, module_name, version)
|
@@ -18,16 +18,38 @@ module Blacksmith
|
|
18
18
|
task_block.call(*[self, args].slice(0, task_block.arity)) if task_block
|
19
19
|
|
20
20
|
# clear any (auto-)pre-existing task
|
21
|
-
[
|
21
|
+
[
|
22
|
+
:bump,
|
23
|
+
:bump_major,
|
24
|
+
:bump_minor,
|
25
|
+
:bump_patch,
|
26
|
+
:tag,
|
27
|
+
:bump_commit,
|
28
|
+
:push,
|
29
|
+
:clean,
|
30
|
+
:release,
|
31
|
+
:dependency
|
32
|
+
].each do |t|
|
22
33
|
Rake::Task.task_defined?("module:#{t}") && Rake::Task["module:#{t}"].clear
|
23
34
|
end
|
24
35
|
|
25
36
|
namespace :module do
|
26
37
|
|
27
|
-
|
38
|
+
namespace :bump do
|
39
|
+
[:major, :minor, :patch].each do |level|
|
40
|
+
desc "Bump module version to the next #{level.upcase} version"
|
41
|
+
task level do
|
42
|
+
m = Blacksmith::Modulefile.new
|
43
|
+
v = m.send("bump_#{level}!")
|
44
|
+
puts "Bumping version from #{m.version} to #{v}"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
desc "Bump module version to the next patch"
|
28
50
|
task :bump do
|
29
51
|
m = Blacksmith::Modulefile.new
|
30
|
-
v = m.
|
52
|
+
v = m.bump_patch!
|
31
53
|
puts "Bumping version from #{m.version} to #{v}"
|
32
54
|
end
|
33
55
|
|
@@ -0,0 +1,170 @@
|
|
1
|
+
# Need to vendor the 'semantic' gem because Puppet hasn't appropriately
|
2
|
+
# encapsulated their vendored implementation.
|
3
|
+
#
|
4
|
+
# For the original implementation see https://github.com/jlindsey/semantic
|
5
|
+
#
|
6
|
+
module Blacksmith
|
7
|
+
module VersionHelper
|
8
|
+
# See: http://semver.org
|
9
|
+
class Version
|
10
|
+
SemVerRegexp = /\A(\d+\.\d+\.\d+)(-([0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*))?(\+([0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*))?\Z/
|
11
|
+
attr_accessor :major, :minor, :patch, :pre, :build
|
12
|
+
|
13
|
+
def initialize version_str
|
14
|
+
raise ArgumentError.new("#{version_str} is not a valid SemVer Version (http://semver.org)") unless version_str =~ SemVerRegexp
|
15
|
+
|
16
|
+
version, parts = version_str.split '-'
|
17
|
+
if not parts.nil? and parts.include? '+'
|
18
|
+
@pre, @build = parts.split '+'
|
19
|
+
elsif version.include? '+'
|
20
|
+
version, @build = version.split '+'
|
21
|
+
else
|
22
|
+
@pre = parts
|
23
|
+
end
|
24
|
+
|
25
|
+
|
26
|
+
@major, @minor, @patch = version.split('.').map(&:to_i)
|
27
|
+
end
|
28
|
+
|
29
|
+
def to_a
|
30
|
+
[@major, @minor, @patch, @pre, @build]
|
31
|
+
end
|
32
|
+
|
33
|
+
def to_s
|
34
|
+
str = [@major, @minor, @patch].join '.'
|
35
|
+
str << '-' << @pre unless @pre.nil?
|
36
|
+
str << '+' << @build unless @build.nil?
|
37
|
+
|
38
|
+
str
|
39
|
+
end
|
40
|
+
|
41
|
+
def to_h
|
42
|
+
keys = [:major, :minor, :patch, :pre, :build]
|
43
|
+
Hash[keys.zip(self.to_a)]
|
44
|
+
end
|
45
|
+
|
46
|
+
alias to_hash to_h
|
47
|
+
alias to_array to_a
|
48
|
+
alias to_string to_s
|
49
|
+
|
50
|
+
def <=> other_version
|
51
|
+
other_version = Version.new(other_version) if other_version.is_a? String
|
52
|
+
|
53
|
+
v1 = self.dup
|
54
|
+
v2 = other_version.dup
|
55
|
+
|
56
|
+
# The build must be excluded from the comparison, so that e.g. 1.2.3+foo and 1.2.3+bar are semantically equal.
|
57
|
+
# "Build metadata SHOULD be ignored when determining version precedence".
|
58
|
+
# (SemVer 2.0.0-rc.2, paragraph 10 - http://www.semver.org)
|
59
|
+
v1.build = nil
|
60
|
+
v2.build = nil
|
61
|
+
|
62
|
+
compare_recursively(v1.to_a, v2.to_a)
|
63
|
+
end
|
64
|
+
|
65
|
+
def > other_version
|
66
|
+
(self <=> other_version) == 1
|
67
|
+
end
|
68
|
+
|
69
|
+
def < other_version
|
70
|
+
(self <=> other_version) == -1
|
71
|
+
end
|
72
|
+
|
73
|
+
def >= other_version
|
74
|
+
(self <=> other_version) >= 0
|
75
|
+
end
|
76
|
+
|
77
|
+
def <= other_version
|
78
|
+
(self <=> other_version) <= 0
|
79
|
+
end
|
80
|
+
|
81
|
+
def == other_version
|
82
|
+
(self <=> other_version) == 0
|
83
|
+
end
|
84
|
+
|
85
|
+
def satisfies other_version
|
86
|
+
return true if other_version.strip == '*'
|
87
|
+
parts = other_version.split(/(\d(.+)?)/, 2)
|
88
|
+
comparator, other_version_string = parts[0].strip, parts[1].strip
|
89
|
+
|
90
|
+
begin
|
91
|
+
Version.new other_version_string
|
92
|
+
comparator.empty? && comparator = '=='
|
93
|
+
satisfies_comparator? comparator, other_version_string
|
94
|
+
rescue ArgumentError
|
95
|
+
if ['<', '>', '<=', '>='].include?(comparator)
|
96
|
+
satisfies_comparator? comparator, pad_version_string(other_version_string)
|
97
|
+
else
|
98
|
+
tilde_matches? other_version_string
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
[:major, :minor, :patch].each do |term|
|
104
|
+
define_method("#{term}!") { increment!(term) }
|
105
|
+
end
|
106
|
+
|
107
|
+
def increment!(term)
|
108
|
+
new_version = clone
|
109
|
+
new_value = send(term) + 1
|
110
|
+
|
111
|
+
new_version.send("#{term}=", new_value)
|
112
|
+
new_version.minor = 0 if term == :major
|
113
|
+
new_version.patch = 0 if term == :major || term == :minor
|
114
|
+
new_version.build = new_version.pre = nil
|
115
|
+
|
116
|
+
new_version
|
117
|
+
end
|
118
|
+
|
119
|
+
private
|
120
|
+
|
121
|
+
def pad_version_string version_string
|
122
|
+
parts = version_string.split('.').reject {|x| x == '*'}
|
123
|
+
while parts.length < 3
|
124
|
+
parts << '0'
|
125
|
+
end
|
126
|
+
parts.join '.'
|
127
|
+
end
|
128
|
+
|
129
|
+
def tilde_matches? other_version_string
|
130
|
+
this_parts = to_a.collect(&:to_s)
|
131
|
+
other_parts = other_version_string.split('.').reject {|x| x == '*'}
|
132
|
+
other_parts == this_parts[0..other_parts.length-1]
|
133
|
+
end
|
134
|
+
|
135
|
+
def satisfies_comparator? comparator, other_version_string
|
136
|
+
if comparator == '~'
|
137
|
+
tilde_matches? other_version_string
|
138
|
+
else
|
139
|
+
self.send comparator, other_version_string
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
def compare_recursively ary1, ary2
|
144
|
+
# Short-circuit the recursion entirely if they're just equal
|
145
|
+
return 0 if ary1 == ary2
|
146
|
+
|
147
|
+
a = ary1.shift; b = ary2.shift
|
148
|
+
|
149
|
+
# Reached the end of the arrays, equal all the way down
|
150
|
+
return 0 if a.nil? and b.nil?
|
151
|
+
|
152
|
+
# Mismatched types (ie. one has a pre and the other doesn't)
|
153
|
+
if a.nil? and not b.nil?
|
154
|
+
return 1
|
155
|
+
elsif not a.nil? and b.nil?
|
156
|
+
return -1
|
157
|
+
end
|
158
|
+
|
159
|
+
if a < b
|
160
|
+
return -1
|
161
|
+
elsif a > b
|
162
|
+
return 1
|
163
|
+
end
|
164
|
+
|
165
|
+
# Versions are equal thus far, so recurse down to the next part.
|
166
|
+
compare_recursively ary1, ary2
|
167
|
+
end
|
168
|
+
end
|
169
|
+
end
|
170
|
+
end
|
@@ -153,9 +153,27 @@ eos
|
|
153
153
|
end
|
154
154
|
|
155
155
|
describe 'increase_version' do
|
156
|
-
it { expect(subject.increase_version("1.0")).to eql("1.1") }
|
157
156
|
it { expect(subject.increase_version("1.0.0")).to eql("1.0.1") }
|
158
157
|
it { expect(subject.increase_version("1.0.1")).to eql("1.0.2") }
|
158
|
+
it { expect { subject.increase_version("1.0") }.to raise_error }
|
159
159
|
it { expect { subject.increase_version("1.0.12qwe") }.to raise_error }
|
160
160
|
end
|
161
|
+
|
162
|
+
describe 'bump patch version' do
|
163
|
+
it { expect(subject.increase_version("1.0.0", :patch)).to eql("1.0.1") }
|
164
|
+
it { expect(subject.increase_version("1.1.0", :patch)).to eql("1.1.1") }
|
165
|
+
it { expect(subject.increase_version("1.1.1", :patch)).to eql("1.1.2") }
|
166
|
+
end
|
167
|
+
|
168
|
+
describe 'bump minor version' do
|
169
|
+
it { expect(subject.increase_version("1.0.0", :minor)).to eql("1.1.0") }
|
170
|
+
it { expect(subject.increase_version("1.1.0", :minor)).to eql("1.2.0") }
|
171
|
+
it { expect(subject.increase_version("1.1.1", :minor)).to eql("1.2.0") }
|
172
|
+
end
|
173
|
+
|
174
|
+
describe 'bump major version' do
|
175
|
+
it { expect(subject.increase_version("1.0.0", :major)).to eql("2.0.0") }
|
176
|
+
it { expect(subject.increase_version("1.1.0", :major)).to eql("2.0.0") }
|
177
|
+
it { expect(subject.increase_version("1.1.1", :major)).to eql("2.0.0") }
|
178
|
+
end
|
161
179
|
end
|
metadata
CHANGED
@@ -1,125 +1,125 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: puppet-blacksmith
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- MaestroDev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-02-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: puppet
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 2.7.16
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 2.7.16
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: puppetlabs_spec_helper
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: cucumber
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: aruba
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: rspec
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: 3.0.0
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: 3.0.0
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: webmock
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- -
|
115
|
+
- - ">="
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '0'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- -
|
122
|
+
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
125
|
description: Puppet module tools for development and Puppet Forge management
|
@@ -138,6 +138,7 @@ files:
|
|
138
138
|
- lib/puppet_blacksmith/modulefile.rb
|
139
139
|
- lib/puppet_blacksmith/rake_tasks.rb
|
140
140
|
- lib/puppet_blacksmith/version.rb
|
141
|
+
- lib/puppet_blacksmith/version_helper.rb
|
141
142
|
- spec/data/Modulefile
|
142
143
|
- spec/data/maestrodev-test/metadata.json
|
143
144
|
- spec/data/metadata.json
|
@@ -157,28 +158,28 @@ require_paths:
|
|
157
158
|
- lib
|
158
159
|
required_ruby_version: !ruby/object:Gem::Requirement
|
159
160
|
requirements:
|
160
|
-
- -
|
161
|
+
- - ">="
|
161
162
|
- !ruby/object:Gem::Version
|
162
163
|
version: '0'
|
163
164
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
164
165
|
requirements:
|
165
|
-
- -
|
166
|
+
- - ">="
|
166
167
|
- !ruby/object:Gem::Version
|
167
168
|
version: '0'
|
168
169
|
requirements: []
|
169
170
|
rubyforge_project:
|
170
|
-
rubygems_version: 2.
|
171
|
+
rubygems_version: 2.4.3
|
171
172
|
signing_key:
|
172
173
|
specification_version: 4
|
173
174
|
summary: Tasks to manage Puppet module builds
|
174
175
|
test_files:
|
176
|
+
- spec/data/maestrodev-test/metadata.json
|
175
177
|
- spec/data/metadata.json
|
176
|
-
- spec/data/response.json
|
177
178
|
- spec/data/Modulefile
|
178
|
-
- spec/data/
|
179
|
-
- spec/puppet_blacksmith/
|
180
|
-
- spec/puppet_blacksmith/git_spec.rb
|
179
|
+
- spec/data/response.json
|
180
|
+
- spec/puppet_blacksmith/forge_live_spec.rb
|
181
181
|
- spec/puppet_blacksmith/forge_shared.rb
|
182
182
|
- spec/puppet_blacksmith/forge_spec.rb
|
183
|
-
- spec/puppet_blacksmith/
|
183
|
+
- spec/puppet_blacksmith/git_spec.rb
|
184
|
+
- spec/puppet_blacksmith/modulefile_spec.rb
|
184
185
|
- spec/spec_helper.rb
|