puppet-blacksmith 4.1.1 → 6.0.1
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 +4 -4
- data/lib/puppet_blacksmith/forge.rb +78 -20
- data/lib/puppet_blacksmith/modulefile.rb +4 -1
- data/lib/puppet_blacksmith/rake_tasks.rb +15 -6
- data/lib/puppet_blacksmith/version.rb +1 -1
- data/lib/puppet_blacksmith/version_helper.rb +4 -2
- data/spec/data/metadata-different-author.json +36 -0
- data/spec/data/metadata-no-author.json +35 -0
- data/spec/data/metadata.json +5 -5
- data/spec/puppet_blacksmith/forge_shared.rb +3 -3
- data/spec/puppet_blacksmith/forge_spec.rb +1 -1
- data/spec/puppet_blacksmith/git_spec.rb +4 -4
- data/spec/puppet_blacksmith/modulefile_spec.rb +33 -4
- metadata +36 -20
- data/spec/data/Modulefile +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 68eaa41801d5768e1205b5c3042b02c067dcc94359327fb0bed02ab8bcb1d52f
|
4
|
+
data.tar.gz: d705be7631ceaed8ec81cf6f81942bc629d8d1200ff0cf986c6e186e5f56dc17
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 189b01578212e80231f83705d18757bbb600d08765545b43011fb1057b055fc5142cfed5733469eb4f449c14f42a3a2fa1e1c5978a2d8184d4e63215a0f1c2e9
|
7
|
+
data.tar.gz: 5121db4aa26fcef8c6b70c60b44eaadd7a85a985bcaa7e67b55a129694346def44743150866d7287528d002164ba9b9c02b4c0922e1c04e3a8a847d7d889a9e4
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'rest-client'
|
2
2
|
require 'json'
|
3
3
|
require 'yaml'
|
4
|
+
require 'base64'
|
4
5
|
|
5
6
|
module Blacksmith
|
6
7
|
class Forge
|
@@ -8,14 +9,19 @@ module Blacksmith
|
|
8
9
|
PUPPETLABS_FORGE = "https://forgeapi.puppetlabs.com"
|
9
10
|
CREDENTIALS_FILE_HOME = "~/.puppetforge.yml"
|
10
11
|
CREDENTIALS_FILE_PROJECT = '.puppetforge.yml'
|
11
|
-
|
12
|
+
FORGE_TYPE_PUPPET = 'puppet'
|
13
|
+
FORGE_TYPE_ARTIFACTORY = 'artifactory'
|
14
|
+
SUPPORTED_FORGE_TYPES = [FORGE_TYPE_PUPPET, FORGE_TYPE_ARTIFACTORY]
|
15
|
+
DEFAULT_CREDENTIALS = { 'url' => PUPPETLABS_FORGE, 'forge_type' => FORGE_TYPE_PUPPET }
|
12
16
|
HEADERS = { 'User-Agent' => "Blacksmith/#{Blacksmith::VERSION} Ruby/#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL} (#{RUBY_RELEASE_DATE}; #{RUBY_PLATFORM})" }
|
13
17
|
|
14
|
-
attr_accessor :username, :password, :url, :client_id, :client_secret
|
18
|
+
attr_accessor :username, :password, :url, :client_id, :client_secret, :forge_type, :token, :api_key
|
15
19
|
|
16
|
-
def initialize(username = nil, password = nil, url = nil)
|
20
|
+
def initialize(username = nil, password = nil, url = nil, forge_type = nil, token = nil, api_key = nil)
|
17
21
|
self.username = username
|
18
22
|
self.password = password
|
23
|
+
self.token = token
|
24
|
+
self.api_key = api_key
|
19
25
|
RestClient.proxy = ENV['http_proxy']
|
20
26
|
load_credentials
|
21
27
|
load_client_credentials_from_file
|
@@ -24,19 +30,64 @@ module Blacksmith
|
|
24
30
|
puts "Ignoring url entry in .puppetforge.yml: must point to the api server at #{PUPPETLABS_FORGE}, not the Forge webpage"
|
25
31
|
self.url = PUPPETLABS_FORGE
|
26
32
|
end
|
33
|
+
self.forge_type = forge_type unless forge_type.nil?
|
34
|
+
raise Blacksmith::Error, "Unsupported forge type: #{self.forge_type}" unless SUPPORTED_FORGE_TYPES.include?(self.forge_type)
|
27
35
|
end
|
28
36
|
|
29
|
-
def push!(name, package = nil)
|
37
|
+
def push!(name, package = nil, author = nil, version = nil)
|
38
|
+
user = author || username
|
30
39
|
unless package
|
31
|
-
|
40
|
+
v = version ? Regexp.escape(version) : '.*'
|
41
|
+
regex = /^#{user}-#{name}-#{v}\.tar\.gz$/
|
32
42
|
pkg = File.expand_path("pkg")
|
33
|
-
f = Dir.new(pkg).select{|
|
43
|
+
f = Dir.new(pkg).select{|fn| fn.match(regex)}.last
|
34
44
|
raise Errno::ENOENT, "File not found in #{pkg} with regex #{regex}" if f.nil?
|
35
45
|
package = File.join(pkg, f)
|
36
46
|
end
|
37
47
|
raise Errno::ENOENT, "File does not exist: #{package}" unless File.exists?(package)
|
38
48
|
|
39
|
-
|
49
|
+
upload(user, name, package)
|
50
|
+
end
|
51
|
+
|
52
|
+
private
|
53
|
+
|
54
|
+
def upload(author, name, file)
|
55
|
+
url = http_url(author, name, file)
|
56
|
+
case forge_type
|
57
|
+
when FORGE_TYPE_ARTIFACTORY
|
58
|
+
RestClient::Request.execute(:method => :put, :url => url, :payload => File.new(file, 'rb'), :headers => http_headers)
|
59
|
+
else
|
60
|
+
RestClient::Request.execute(:method => :post, :url => url, :payload => {:file => File.new(file, 'rb')}, :headers => http_headers)
|
61
|
+
end
|
62
|
+
rescue RestClient::Exception => e
|
63
|
+
raise Blacksmith::Error, "Error uploading #{name} to the forge #{url} [#{e.message}]: #{e.response}"
|
64
|
+
end
|
65
|
+
|
66
|
+
def http_url(author, name, file)
|
67
|
+
case forge_type
|
68
|
+
when FORGE_TYPE_ARTIFACTORY
|
69
|
+
"#{url}/#{author}/#{name}/#{File.basename(file)}"
|
70
|
+
else
|
71
|
+
"#{url}/v2/releases"
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
def http_headers
|
76
|
+
case forge_type
|
77
|
+
when FORGE_TYPE_ARTIFACTORY
|
78
|
+
if api_key
|
79
|
+
HEADERS.merge({'X-JFrog-Art-Api' => api_key})
|
80
|
+
elsif token
|
81
|
+
HEADERS.merge({'Authorization' => "Bearer #{token}"})
|
82
|
+
else
|
83
|
+
HEADERS.merge({'Authorization' => "Basic " + Base64.strict_encode64("#{username}:#{password}")})
|
84
|
+
end
|
85
|
+
else
|
86
|
+
HEADERS.merge({'Authorization' => "Bearer #{token || oauth_access_token}"})
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
def oauth_access_token
|
40
91
|
begin
|
41
92
|
response = RestClient.post("#{url}/oauth/token", {
|
42
93
|
'client_id' => client_id,
|
@@ -49,20 +100,9 @@ module Blacksmith
|
|
49
100
|
raise Blacksmith::Error, "Error login to the forge #{url} as #{username} [#{e.message}]: #{e.response}"
|
50
101
|
end
|
51
102
|
login_data = JSON.parse(response)
|
52
|
-
|
53
|
-
|
54
|
-
# upload the file
|
55
|
-
begin
|
56
|
-
response = RestClient.post("#{url}/v2/releases",
|
57
|
-
{:file => File.new(package, 'rb')},
|
58
|
-
HEADERS.merge({'Authorization' => "Bearer #{access_token}"}))
|
59
|
-
rescue RestClient::Exception => e
|
60
|
-
raise Blacksmith::Error, "Error uploading #{package} to the forge #{url} [#{e.message}]: #{e.response}"
|
61
|
-
end
|
103
|
+
login_data['access_token']
|
62
104
|
end
|
63
105
|
|
64
|
-
private
|
65
|
-
|
66
106
|
def load_credentials
|
67
107
|
file_credentials = load_credentials_from_file
|
68
108
|
env_credentials = load_credentials_from_env
|
@@ -72,21 +112,27 @@ module Blacksmith
|
|
72
112
|
|
73
113
|
self.username = credentials['username'] if credentials['username']
|
74
114
|
self.password = credentials['password'] if credentials['password']
|
115
|
+
self.token = credentials['token'] if credentials['token']
|
116
|
+
self.api_key = credentials['api_key'] if credentials['api_key']
|
75
117
|
if credentials['forge']
|
76
118
|
# deprecated
|
77
119
|
puts "'forge' entry is deprecated in .puppetforge.yml, use 'url'"
|
78
120
|
self.url = credentials['forge']
|
79
121
|
end
|
80
122
|
self.url = credentials['url'] if credentials['url']
|
123
|
+
self.forge_type = credentials['forge_type'] if credentials['forge_type']
|
81
124
|
|
82
|
-
unless self.username && self.password
|
125
|
+
unless (self.username && self.password) || self.token || self.api_key
|
83
126
|
raise Blacksmith::Error, <<-eos
|
84
127
|
Could not find Puppet Forge credentials!
|
85
128
|
|
86
129
|
Please set the environment variables
|
87
130
|
BLACKSMITH_FORGE_URL
|
131
|
+
BLACKSMITH_FORGE_TYPE
|
88
132
|
BLACKSMITH_FORGE_USERNAME
|
89
133
|
BLACKSMITH_FORGE_PASSWORD
|
134
|
+
BLACKSMITH_FORGE_TOKEN
|
135
|
+
BLACKSMITH_FORGE_API_KEY
|
90
136
|
|
91
137
|
or create the file '#{CREDENTIALS_FILE_PROJECT}' or '#{CREDENTIALS_FILE_HOME}'
|
92
138
|
with content similiar to:
|
@@ -132,6 +178,18 @@ password: mypassword
|
|
132
178
|
credentials['url'] = ENV['BLACKSMITH_FORGE_URL']
|
133
179
|
end
|
134
180
|
|
181
|
+
if ENV['BLACKSMITH_FORGE_TYPE']
|
182
|
+
credentials['forge_type'] = ENV['BLACKSMITH_FORGE_TYPE']
|
183
|
+
end
|
184
|
+
|
185
|
+
if ENV['BLACKSMITH_FORGE_TOKEN']
|
186
|
+
credentials['token'] = ENV['BLACKSMITH_FORGE_TOKEN']
|
187
|
+
end
|
188
|
+
|
189
|
+
if ENV['BLACKSMITH_FORGE_API_KEY']
|
190
|
+
credentials['api_key'] = ENV['BLACKSMITH_FORGE_API_KEY']
|
191
|
+
end
|
192
|
+
|
135
193
|
return credentials
|
136
194
|
end
|
137
195
|
|
@@ -21,8 +21,11 @@ module Blacksmith
|
|
21
21
|
def name
|
22
22
|
metadata['name'].split('-',2)[1]
|
23
23
|
end
|
24
|
+
def namespace
|
25
|
+
metadata['name'].split('-',2)[0]
|
26
|
+
end
|
24
27
|
def author
|
25
|
-
metadata['author'] ||
|
28
|
+
metadata['author'] || namespace
|
26
29
|
end
|
27
30
|
def version
|
28
31
|
metadata['version']
|
@@ -30,6 +30,7 @@ module Blacksmith
|
|
30
30
|
|
31
31
|
# clear any (auto-)pre-existing task
|
32
32
|
[
|
33
|
+
:build,
|
33
34
|
:bump,
|
34
35
|
'bump:major',
|
35
36
|
'bump:minor',
|
@@ -56,12 +57,20 @@ module Blacksmith
|
|
56
57
|
|
57
58
|
namespace :module do
|
58
59
|
|
60
|
+
desc 'Build the module using puppet-modulebuilder'
|
61
|
+
task :build do
|
62
|
+
require 'puppet/modulebuilder'
|
63
|
+
builder = Puppet::Modulebuilder::Builder.new(Dir.pwd, nil, nil)
|
64
|
+
package_file = builder.build
|
65
|
+
puts "Built #{package_file}"
|
66
|
+
end
|
67
|
+
|
59
68
|
namespace :bump do
|
60
69
|
[:major, :minor, :patch, :full].each do |level|
|
61
70
|
desc "Bump module version to the next #{level.upcase} version"
|
62
71
|
task level do
|
63
72
|
m = Blacksmith::Modulefile.new
|
64
|
-
v = m.
|
73
|
+
v = m.bump!(level)
|
65
74
|
puts "Bumping version from #{m.version} to #{v}"
|
66
75
|
end
|
67
76
|
end
|
@@ -126,11 +135,11 @@ module Blacksmith
|
|
126
135
|
end
|
127
136
|
|
128
137
|
desc "Push module to the Puppet Forge"
|
129
|
-
task :push => :build do
|
138
|
+
task :push => :'module:build' do
|
130
139
|
m = Blacksmith::Modulefile.new
|
131
140
|
forge = Blacksmith::Forge.new
|
132
|
-
puts "Uploading to Puppet Forge #{
|
133
|
-
forge.push!(m.name)
|
141
|
+
puts "Uploading to Puppet Forge #{m.namespace}/#{m.name}"
|
142
|
+
forge.push!(m.name, nil, m.namespace, m.version)
|
134
143
|
end
|
135
144
|
|
136
145
|
desc "Runs clean again"
|
@@ -139,8 +148,8 @@ module Blacksmith
|
|
139
148
|
Rake::Task["clean"].execute
|
140
149
|
end
|
141
150
|
|
142
|
-
desc "Release the Puppet module, doing a clean, build, tag, push
|
143
|
-
release_dependencies = @build ? [:clean, :build, :bump_commit, :tag, :push] : [:clean, :bump_commit, :tag]
|
151
|
+
desc "Release the Puppet module, doing a clean, build, bump_commit, tag, push and git push."
|
152
|
+
release_dependencies = @build ? [:clean, :'module:build', :bump_commit, :tag, :push] : [:clean, :bump_commit, :tag]
|
144
153
|
task :release => release_dependencies do
|
145
154
|
puts "Pushing to remote git repo"
|
146
155
|
git.push!
|
@@ -115,9 +115,11 @@ module Blacksmith
|
|
115
115
|
|
116
116
|
def increment!(term)
|
117
117
|
new_version = clone
|
118
|
-
new_value = send(term) + 1
|
119
118
|
|
120
|
-
|
119
|
+
if term != :patch || @pre.nil?
|
120
|
+
new_version.send("#{term}=", send(term) + 1)
|
121
|
+
end
|
122
|
+
|
121
123
|
new_version.minor = 0 if term == :major
|
122
124
|
new_version.patch = 0 if term == :major || term == :minor
|
123
125
|
new_version.build = new_version.pre = nil
|
@@ -0,0 +1,36 @@
|
|
1
|
+
{
|
2
|
+
"operatingsystem_support": [
|
3
|
+
{
|
4
|
+
"operatingsystem": "CentOS",
|
5
|
+
"operatingsystemrelease": [
|
6
|
+
"4",
|
7
|
+
"5",
|
8
|
+
"6"
|
9
|
+
]
|
10
|
+
}
|
11
|
+
],
|
12
|
+
"requirements": [
|
13
|
+
{
|
14
|
+
"name": "pe",
|
15
|
+
"version_requirement": "3.2.x"
|
16
|
+
},
|
17
|
+
{
|
18
|
+
"name": "puppet",
|
19
|
+
"version_requirement": ">=2.7.20 <7.0.0"
|
20
|
+
}
|
21
|
+
],
|
22
|
+
"name": "maestrodev-test",
|
23
|
+
"version": "1.0.0",
|
24
|
+
"source": "git://github.com/puppetlabs/puppetlabs-stdlib",
|
25
|
+
"author": "MaestroDev",
|
26
|
+
"license": "Apache 2.0",
|
27
|
+
"summary": "Puppet Module Standard Library",
|
28
|
+
"description": "Standard Library for Puppet Modules",
|
29
|
+
"project_page": "https://github.com/puppetlabs/puppetlabs-stdlib",
|
30
|
+
"dependencies": [
|
31
|
+
{
|
32
|
+
"name": "puppetlabs-stdlib",
|
33
|
+
"version_requirement": ">= 3.0.0"
|
34
|
+
}
|
35
|
+
]
|
36
|
+
}
|
@@ -0,0 +1,35 @@
|
|
1
|
+
{
|
2
|
+
"operatingsystem_support": [
|
3
|
+
{
|
4
|
+
"operatingsystem": "CentOS",
|
5
|
+
"operatingsystemrelease": [
|
6
|
+
"4",
|
7
|
+
"5",
|
8
|
+
"6"
|
9
|
+
]
|
10
|
+
}
|
11
|
+
],
|
12
|
+
"requirements": [
|
13
|
+
{
|
14
|
+
"name": "pe",
|
15
|
+
"version_requirement": "3.2.x"
|
16
|
+
},
|
17
|
+
{
|
18
|
+
"name": "puppet",
|
19
|
+
"version_requirement": ">=2.7.20 <7.0.0"
|
20
|
+
}
|
21
|
+
],
|
22
|
+
"name": "maestrodev-test",
|
23
|
+
"version": "1.0.0",
|
24
|
+
"source": "git://github.com/puppetlabs/puppetlabs-stdlib",
|
25
|
+
"license": "Apache 2.0",
|
26
|
+
"summary": "Puppet Module Standard Library",
|
27
|
+
"description": "Standard Library for Puppet Modules",
|
28
|
+
"project_page": "https://github.com/puppetlabs/puppetlabs-stdlib",
|
29
|
+
"dependencies": [
|
30
|
+
{
|
31
|
+
"name": "puppetlabs-stdlib",
|
32
|
+
"version_requirement": ">= 3.0.0"
|
33
|
+
}
|
34
|
+
]
|
35
|
+
}
|
data/spec/data/metadata.json
CHANGED
@@ -16,7 +16,7 @@
|
|
16
16
|
},
|
17
17
|
{
|
18
18
|
"name": "puppet",
|
19
|
-
"version_requirement": ">=2.7.20 <
|
19
|
+
"version_requirement": ">=2.7.20 <7.0.0"
|
20
20
|
}
|
21
21
|
],
|
22
22
|
"name": "maestrodev-test",
|
@@ -28,9 +28,9 @@
|
|
28
28
|
"description": "Standard Library for Puppet Modules",
|
29
29
|
"project_page": "https://github.com/puppetlabs/puppetlabs-stdlib",
|
30
30
|
"dependencies": [
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
31
|
+
{
|
32
|
+
"name": "puppetlabs-stdlib",
|
33
|
+
"version_requirement": ">= 3.0.0"
|
34
|
+
}
|
35
35
|
]
|
36
36
|
}
|
@@ -15,9 +15,9 @@ RSpec.shared_context "forge" do
|
|
15
15
|
let(:module_name) { "test" }
|
16
16
|
let(:version) { "1.0.0" }
|
17
17
|
let(:module_name) { "maestrodev-test" }
|
18
|
-
let(:spec_data) { File.join(
|
18
|
+
let(:spec_data) { File.join(__dir__, '..', 'data') }
|
19
19
|
let(:spec_module) { File.join(spec_data, module_name) }
|
20
|
-
let(:target) { File.expand_path(File.join(
|
20
|
+
let(:target) { File.expand_path(File.join(__dir__, "..", "..", "pkg", module_name)) }
|
21
21
|
let(:package) { "#{target}.tar.gz" }
|
22
22
|
|
23
23
|
let(:headers) { { 'User-Agent' => %r{^Blacksmith/#{Blacksmith::VERSION} Ruby/.* \(.*\)$} } }
|
@@ -32,6 +32,6 @@ RSpec.shared_context "forge" do
|
|
32
32
|
File.open(File.join(target, "metadata.json"),"w") do |file|
|
33
33
|
file.write(JSON.pretty_generate(metadata))
|
34
34
|
end
|
35
|
-
`cd #{target}
|
35
|
+
`cd '#{target}/..'; tar -czf #{module_name}.tar.gz #{module_name}`
|
36
36
|
end
|
37
37
|
end
|
@@ -91,7 +91,7 @@ describe 'Blacksmith::Forge' do
|
|
91
91
|
:headers => {})
|
92
92
|
|
93
93
|
stub_request(:post, "#{forge}/v2/releases").with(
|
94
|
-
:headers => headers.merge({'Accept'=>'*/*', 'Accept-Encoding'=>'gzip,
|
94
|
+
:headers => headers.merge({'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization'=>'Bearer e52f78b62e97cb8d8db6659a73aa522cca0f5c74d4714e0ed0bdd10000000000', 'Content-Type'=>%r{\Amultipart/form-data;}})
|
95
95
|
) { |request |
|
96
96
|
request.body =~ %r{Content-Disposition: form-data; name=\"file\"; filename=\"maestrodev-test.tar.gz\"\r\nContent-Type: application/gzip}
|
97
97
|
}.to_return(:status => 200, :body => File.read(File.join(spec_data, "response.json")), :headers => {})
|
@@ -3,16 +3,16 @@ require 'spec_helper'
|
|
3
3
|
describe 'Blacksmith::Git' do
|
4
4
|
|
5
5
|
subject { Blacksmith::Git.new(path) }
|
6
|
-
let(:path) { File.expand_path(File.join(
|
6
|
+
let(:path) { File.expand_path(File.join(__dir__, '../../tmp/git_test')) }
|
7
7
|
let(:version) { '1.0.0' }
|
8
8
|
let(:metadata_file) { "metadata.json" }
|
9
9
|
|
10
10
|
before do
|
11
11
|
FileUtils.rm_rf path
|
12
12
|
FileUtils.mkdir_p(path)
|
13
|
-
`git init #{path}`
|
13
|
+
`git init '#{path}'`
|
14
14
|
FileUtils.touch(File.join(path, metadata_file))
|
15
|
-
`cd #{path} && git add #{metadata_file} && git commit -am "Init"`
|
15
|
+
`cd '#{path}' && git add #{metadata_file} && git commit -am "Init"`
|
16
16
|
end
|
17
17
|
|
18
18
|
shared_examples_for :git do
|
@@ -47,7 +47,7 @@ describe 'Blacksmith::Git' do
|
|
47
47
|
context 'basic tag' do
|
48
48
|
before { subject.tag!(version) }
|
49
49
|
it "should have the tag" do
|
50
|
-
out = `cd #{path} && git tag`
|
50
|
+
out = `cd '#{path}' && git tag`
|
51
51
|
expect(out.chomp).to match(/^v1.0.0$/)
|
52
52
|
end
|
53
53
|
end
|
@@ -11,6 +11,32 @@ describe 'Blacksmith::Modulefile' do
|
|
11
11
|
it { expect(subject.name).to eql("test") }
|
12
12
|
end
|
13
13
|
|
14
|
+
context "using different author" do
|
15
|
+
let(:path) { "spec/data/metadata-different-author.json" }
|
16
|
+
|
17
|
+
subject { Blacksmith::Modulefile.new(path) }
|
18
|
+
|
19
|
+
it_behaves_like :metadata
|
20
|
+
|
21
|
+
describe "author and namespace" do
|
22
|
+
it { expect(subject.author).to eql("MaestroDev") }
|
23
|
+
it { expect(subject.namespace).to eql("maestrodev") }
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
context "using no author" do
|
28
|
+
let(:path) { "spec/data/metadata-no-author.json" }
|
29
|
+
|
30
|
+
subject { Blacksmith::Modulefile.new(path) }
|
31
|
+
|
32
|
+
it_behaves_like :metadata
|
33
|
+
|
34
|
+
describe "author and namespace" do
|
35
|
+
it { expect(subject.author).to eql("maestrodev") }
|
36
|
+
it { expect(subject.namespace).to eql("maestrodev") }
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
14
40
|
context "using metadata.json" do
|
15
41
|
|
16
42
|
it_behaves_like :metadata
|
@@ -37,7 +63,7 @@ describe 'Blacksmith::Modulefile' do
|
|
37
63
|
},
|
38
64
|
{
|
39
65
|
"name": "puppet",
|
40
|
-
"version_requirement": ">=2.7.20 <
|
66
|
+
"version_requirement": ">=2.7.20 <7.0.0"
|
41
67
|
}
|
42
68
|
],
|
43
69
|
"name": "maestrodev-test",
|
@@ -83,7 +109,7 @@ describe 'Blacksmith::Modulefile' do
|
|
83
109
|
},
|
84
110
|
{
|
85
111
|
"name": "puppet",
|
86
|
-
"version_requirement": ">=2.7.20 <
|
112
|
+
"version_requirement": ">=2.7.20 <7.0.0"
|
87
113
|
}
|
88
114
|
],
|
89
115
|
"name": "maestrodev-test",
|
@@ -116,25 +142,28 @@ describe 'Blacksmith::Modulefile' do
|
|
116
142
|
describe 'increase_version' do
|
117
143
|
it { expect(subject.increase_version("1.0.0")).to eql("1.0.1") }
|
118
144
|
it { expect(subject.increase_version("1.0.1")).to eql("1.0.2") }
|
119
|
-
it { expect { subject.increase_version("1.0") }.to raise_error }
|
120
|
-
it { expect { subject.increase_version("1.0.12qwe") }.to raise_error }
|
145
|
+
it { expect { subject.increase_version("1.0") }.to raise_error(ArgumentError) }
|
146
|
+
it { expect { subject.increase_version("1.0.12qwe") }.to raise_error(ArgumentError) }
|
121
147
|
end
|
122
148
|
|
123
149
|
describe 'bump patch version' do
|
124
150
|
it { expect(subject.increase_version("1.0.0", :patch)).to eql("1.0.1") }
|
125
151
|
it { expect(subject.increase_version("1.1.0", :patch)).to eql("1.1.1") }
|
126
152
|
it { expect(subject.increase_version("1.1.1", :patch)).to eql("1.1.2") }
|
153
|
+
it { expect(subject.increase_version("1.1.2-rc0", :patch)).to eql("1.1.2") }
|
127
154
|
end
|
128
155
|
|
129
156
|
describe 'bump minor version' do
|
130
157
|
it { expect(subject.increase_version("1.0.0", :minor)).to eql("1.1.0") }
|
131
158
|
it { expect(subject.increase_version("1.1.0", :minor)).to eql("1.2.0") }
|
132
159
|
it { expect(subject.increase_version("1.1.1", :minor)).to eql("1.2.0") }
|
160
|
+
it { expect(subject.increase_version("1.1.1-rc0", :minor)).to eql("1.2.0") }
|
133
161
|
end
|
134
162
|
|
135
163
|
describe 'bump major version' do
|
136
164
|
it { expect(subject.increase_version("1.0.0", :major)).to eql("2.0.0") }
|
137
165
|
it { expect(subject.increase_version("1.1.0", :major)).to eql("2.0.0") }
|
138
166
|
it { expect(subject.increase_version("1.1.1", :major)).to eql("2.0.0") }
|
167
|
+
it { expect(subject.increase_version("1.1.1-rc0", :major)).to eql("2.0.0") }
|
139
168
|
end
|
140
169
|
end
|
metadata
CHANGED
@@ -1,15 +1,30 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: puppet-blacksmith
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 6.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- MaestroDev
|
8
|
+
- Vox Pupuli
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date:
|
12
|
+
date: 2020-10-06 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: puppet-modulebuilder
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - "~>"
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '0.1'
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - "~>"
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '0.1'
|
13
28
|
- !ruby/object:Gem::Dependency
|
14
29
|
name: rest-client
|
15
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -25,7 +40,7 @@ dependencies:
|
|
25
40
|
- !ruby/object:Gem::Version
|
26
41
|
version: '2.0'
|
27
42
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
43
|
+
name: bundler
|
29
44
|
requirement: !ruby/object:Gem::Requirement
|
30
45
|
requirements:
|
31
46
|
- - ">="
|
@@ -39,33 +54,33 @@ dependencies:
|
|
39
54
|
- !ruby/object:Gem::Version
|
40
55
|
version: '0'
|
41
56
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
57
|
+
name: rake
|
43
58
|
requirement: !ruby/object:Gem::Requirement
|
44
59
|
requirements:
|
45
60
|
- - ">="
|
46
61
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
62
|
+
version: '0'
|
48
63
|
type: :development
|
49
64
|
prerelease: false
|
50
65
|
version_requirements: !ruby/object:Gem::Requirement
|
51
66
|
requirements:
|
52
67
|
- - ">="
|
53
68
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
69
|
+
version: '0'
|
55
70
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
71
|
+
name: puppet
|
57
72
|
requirement: !ruby/object:Gem::Requirement
|
58
73
|
requirements:
|
59
74
|
- - ">="
|
60
75
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
76
|
+
version: 2.7.16
|
62
77
|
type: :development
|
63
78
|
prerelease: false
|
64
79
|
version_requirements: !ruby/object:Gem::Requirement
|
65
80
|
requirements:
|
66
81
|
- - ">="
|
67
82
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
83
|
+
version: 2.7.16
|
69
84
|
- !ruby/object:Gem::Dependency
|
70
85
|
name: cucumber
|
71
86
|
requirement: !ruby/object:Gem::Requirement
|
@@ -124,7 +139,7 @@ dependencies:
|
|
124
139
|
version: '2.0'
|
125
140
|
description: Puppet module tools for development and Puppet Forge management
|
126
141
|
email:
|
127
|
-
-
|
142
|
+
- voxpupuli@groups.io
|
128
143
|
executables: []
|
129
144
|
extensions: []
|
130
145
|
extra_rdoc_files: []
|
@@ -139,8 +154,9 @@ files:
|
|
139
154
|
- lib/puppet_blacksmith/rake_tasks.rb
|
140
155
|
- lib/puppet_blacksmith/version.rb
|
141
156
|
- lib/puppet_blacksmith/version_helper.rb
|
142
|
-
- spec/data/Modulefile
|
143
157
|
- spec/data/maestrodev-test/metadata.json
|
158
|
+
- spec/data/metadata-different-author.json
|
159
|
+
- spec/data/metadata-no-author.json
|
144
160
|
- spec/data/metadata.json
|
145
161
|
- spec/data/response.json
|
146
162
|
- spec/puppet_blacksmith/forge_live_spec.rb
|
@@ -160,26 +176,26 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
160
176
|
requirements:
|
161
177
|
- - ">="
|
162
178
|
- !ruby/object:Gem::Version
|
163
|
-
version: 2.
|
179
|
+
version: 2.4.0
|
164
180
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
165
181
|
requirements:
|
166
182
|
- - ">="
|
167
183
|
- !ruby/object:Gem::Version
|
168
184
|
version: '0'
|
169
185
|
requirements: []
|
170
|
-
|
171
|
-
rubygems_version: 2.7.3
|
186
|
+
rubygems_version: 3.0.8
|
172
187
|
signing_key:
|
173
188
|
specification_version: 4
|
174
189
|
summary: Tasks to manage Puppet module builds
|
175
190
|
test_files:
|
176
|
-
- spec/data/Modulefile
|
177
|
-
- spec/data/maestrodev-test/metadata.json
|
178
|
-
- spec/data/response.json
|
179
|
-
- spec/data/metadata.json
|
180
|
-
- spec/puppet_blacksmith/forge_live_spec.rb
|
181
191
|
- spec/puppet_blacksmith/forge_shared.rb
|
182
|
-
- spec/puppet_blacksmith/
|
192
|
+
- spec/puppet_blacksmith/forge_live_spec.rb
|
183
193
|
- spec/puppet_blacksmith/git_spec.rb
|
184
194
|
- spec/puppet_blacksmith/modulefile_spec.rb
|
195
|
+
- spec/puppet_blacksmith/forge_spec.rb
|
185
196
|
- spec/spec_helper.rb
|
197
|
+
- spec/data/metadata-different-author.json
|
198
|
+
- spec/data/metadata-no-author.json
|
199
|
+
- spec/data/maestrodev-test/metadata.json
|
200
|
+
- spec/data/response.json
|
201
|
+
- spec/data/metadata.json
|
data/spec/data/Modulefile
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
name 'maestrodev-test'
|
2
|
-
version '1.0.0'
|
3
|
-
|
4
|
-
license 'Apache License, Version 2.0'
|
5
|
-
project_page 'http://github.com/maestrodev/puppet-blacksmith'
|
6
|
-
source 'http://github.com/maestrodev/puppet-blacksmith'
|
7
|
-
summary 'Testing Puppet module operations'
|
8
|
-
description 'Testing Puppet module operations'
|
9
|
-
dependency 'puppetlabs/stdlib', '>= 3.0.0'
|