puppet-blacksmith 4.1.2 → 6.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0c5fe0a0ea848cc10d19a20511cee762cb0b6441d99f08f637ba9c81a7fa4b8a
4
- data.tar.gz: a5a715ea02d0a7b4878679ec0a7d9c1350e361eac887c3127bafa2a444604093
3
+ metadata.gz: 831c83df3a3914c5302c2a6c5b9edc3109e0cdc346818b0f49794159f5ee0961
4
+ data.tar.gz: 5b8d9388f85252d81e841f3cb0a02e8f8f6f4315556c124fbe6918e760233fce
5
5
  SHA512:
6
- metadata.gz: b1b32ddcc1022b19845e1bfcbafcb7aebb17d6096bfd17a332dbd84aa3aa0a877c1f447e5eb15bad0232a957d727873272b5a38049efe2f5ecd20e19235a139b
7
- data.tar.gz: 0f3757316471f2d9709f5b6d96dc63e0f6496b4a88ecb55bab0c9f6e908d548159f0ab201032fbf4297efe794f7a96fe147d504f5b41d1ea8c8092a029d38d82
6
+ metadata.gz: 78e89d0d7e97dd8b82f3e4288933971ba021506aebf7ba1ebdba6df066872f7988598ff861298ec461337361eacf449fb9e90be4ddab1bd4c1f4d9a1e63e8d3c
7
+ data.tar.gz: ecf85ece2841aee1371683d6f6b74a111e548729b4a593576299e91505b090230a20dfa801a5b5304c03e64b51261a644f3e716bae58904c59b231c53f7fcb9e
data/LICENSE CHANGED
@@ -1,13 +1,203 @@
1
1
  Copyright (c) 2013 MaestroDev
2
2
 
3
- Licensed under the Apache License, Version 2.0 (the "License");
4
- you may not use this file except in compliance with the License.
5
- You may obtain a copy of the License at
3
+ Apache License
4
+ Version 2.0, January 2004
5
+ http://www.apache.org/licenses/
6
6
 
7
- http://www.apache.org/licenses/LICENSE-2.0
7
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
8
8
 
9
- Unless required by applicable law or agreed to in writing, software
10
- distributed under the License is distributed on an "AS IS" BASIS,
11
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- See the License for the specific language governing permissions and
13
- limitations under the License.
9
+ 1. Definitions.
10
+
11
+ "License" shall mean the terms and conditions for use, reproduction,
12
+ and distribution as defined by Sections 1 through 9 of this document.
13
+
14
+ "Licensor" shall mean the copyright owner or entity authorized by
15
+ the copyright owner that is granting the License.
16
+
17
+ "Legal Entity" shall mean the union of the acting entity and all
18
+ other entities that control, are controlled by, or are under common
19
+ control with that entity. For the purposes of this definition,
20
+ "control" means (i) the power, direct or indirect, to cause the
21
+ direction or management of such entity, whether by contract or
22
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
23
+ outstanding shares, or (iii) beneficial ownership of such entity.
24
+
25
+ "You" (or "Your") shall mean an individual or Legal Entity
26
+ exercising permissions granted by this License.
27
+
28
+ "Source" form shall mean the preferred form for making modifications,
29
+ including but not limited to software source code, documentation
30
+ source, and configuration files.
31
+
32
+ "Object" form shall mean any form resulting from mechanical
33
+ transformation or translation of a Source form, including but
34
+ not limited to compiled object code, generated documentation,
35
+ and conversions to other media types.
36
+
37
+ "Work" shall mean the work of authorship, whether in Source or
38
+ Object form, made available under the License, as indicated by a
39
+ copyright notice that is included in or attached to the work
40
+ (an example is provided in the Appendix below).
41
+
42
+ "Derivative Works" shall mean any work, whether in Source or Object
43
+ form, that is based on (or derived from) the Work and for which the
44
+ editorial revisions, annotations, elaborations, or other modifications
45
+ represent, as a whole, an original work of authorship. For the purposes
46
+ of this License, Derivative Works shall not include works that remain
47
+ separable from, or merely link (or bind by name) to the interfaces of,
48
+ the Work and Derivative Works thereof.
49
+
50
+ "Contribution" shall mean any work of authorship, including
51
+ the original version of the Work and any modifications or additions
52
+ to that Work or Derivative Works thereof, that is intentionally
53
+ submitted to Licensor for inclusion in the Work by the copyright owner
54
+ or by an individual or Legal Entity authorized to submit on behalf of
55
+ the copyright owner. For the purposes of this definition, "submitted"
56
+ means any form of electronic, verbal, or written communication sent
57
+ to the Licensor or its representatives, including but not limited to
58
+ communication on electronic mailing lists, source code control systems,
59
+ and issue tracking systems that are managed by, or on behalf of, the
60
+ Licensor for the purpose of discussing and improving the Work, but
61
+ excluding communication that is conspicuously marked or otherwise
62
+ designated in writing by the copyright owner as "Not a Contribution."
63
+
64
+ "Contributor" shall mean Licensor and any individual or Legal Entity
65
+ on behalf of whom a Contribution has been received by Licensor and
66
+ subsequently incorporated within the Work.
67
+
68
+ 2. Grant of Copyright License. Subject to the terms and conditions of
69
+ this License, each Contributor hereby grants to You a perpetual,
70
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
71
+ copyright license to reproduce, prepare Derivative Works of,
72
+ publicly display, publicly perform, sublicense, and distribute the
73
+ Work and such Derivative Works in Source or Object form.
74
+
75
+ 3. Grant of Patent License. Subject to the terms and conditions of
76
+ this License, each Contributor hereby grants to You a perpetual,
77
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
78
+ (except as stated in this section) patent license to make, have made,
79
+ use, offer to sell, sell, import, and otherwise transfer the Work,
80
+ where such license applies only to those patent claims licensable
81
+ by such Contributor that are necessarily infringed by their
82
+ Contribution(s) alone or by combination of their Contribution(s)
83
+ with the Work to which such Contribution(s) was submitted. If You
84
+ institute patent litigation against any entity (including a
85
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
86
+ or a Contribution incorporated within the Work constitutes direct
87
+ or contributory patent infringement, then any patent licenses
88
+ granted to You under this License for that Work shall terminate
89
+ as of the date such litigation is filed.
90
+
91
+ 4. Redistribution. You may reproduce and distribute copies of the
92
+ Work or Derivative Works thereof in any medium, with or without
93
+ modifications, and in Source or Object form, provided that You
94
+ meet the following conditions:
95
+
96
+ (a) You must give any other recipients of the Work or
97
+ Derivative Works a copy of this License; and
98
+
99
+ (b) You must cause any modified files to carry prominent notices
100
+ stating that You changed the files; and
101
+
102
+ (c) You must retain, in the Source form of any Derivative Works
103
+ that You distribute, all copyright, patent, trademark, and
104
+ attribution notices from the Source form of the Work,
105
+ excluding those notices that do not pertain to any part of
106
+ the Derivative Works; and
107
+
108
+ (d) If the Work includes a "NOTICE" text file as part of its
109
+ distribution, then any Derivative Works that You distribute must
110
+ include a readable copy of the attribution notices contained
111
+ within such NOTICE file, excluding those notices that do not
112
+ pertain to any part of the Derivative Works, in at least one
113
+ of the following places: within a NOTICE text file distributed
114
+ as part of the Derivative Works; within the Source form or
115
+ documentation, if provided along with the Derivative Works; or,
116
+ within a display generated by the Derivative Works, if and
117
+ wherever such third-party notices normally appear. The contents
118
+ of the NOTICE file are for informational purposes only and
119
+ do not modify the License. You may add Your own attribution
120
+ notices within Derivative Works that You distribute, alongside
121
+ or as an addendum to the NOTICE text from the Work, provided
122
+ that such additional attribution notices cannot be construed
123
+ as modifying the License.
124
+
125
+ You may add Your own copyright statement to Your modifications and
126
+ may provide additional or different license terms and conditions
127
+ for use, reproduction, or distribution of Your modifications, or
128
+ for any such Derivative Works as a whole, provided Your use,
129
+ reproduction, and distribution of the Work otherwise complies with
130
+ the conditions stated in this License.
131
+
132
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
133
+ any Contribution intentionally submitted for inclusion in the Work
134
+ by You to the Licensor shall be under the terms and conditions of
135
+ this License, without any additional terms or conditions.
136
+ Notwithstanding the above, nothing herein shall supersede or modify
137
+ the terms of any separate license agreement you may have executed
138
+ with Licensor regarding such Contributions.
139
+
140
+ 6. Trademarks. This License does not grant permission to use the trade
141
+ names, trademarks, service marks, or product names of the Licensor,
142
+ except as required for reasonable and customary use in describing the
143
+ origin of the Work and reproducing the content of the NOTICE file.
144
+
145
+ 7. Disclaimer of Warranty. Unless required by applicable law or
146
+ agreed to in writing, Licensor provides the Work (and each
147
+ Contributor provides its Contributions) on an "AS IS" BASIS,
148
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
149
+ implied, including, without limitation, any warranties or conditions
150
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
151
+ PARTICULAR PURPOSE. You are solely responsible for determining the
152
+ appropriateness of using or redistributing the Work and assume any
153
+ risks associated with Your exercise of permissions under this License.
154
+
155
+ 8. Limitation of Liability. In no event and under no legal theory,
156
+ whether in tort (including negligence), contract, or otherwise,
157
+ unless required by applicable law (such as deliberate and grossly
158
+ negligent acts) or agreed to in writing, shall any Contributor be
159
+ liable to You for damages, including any direct, indirect, special,
160
+ incidental, or consequential damages of any character arising as a
161
+ result of this License or out of the use or inability to use the
162
+ Work (including but not limited to damages for loss of goodwill,
163
+ work stoppage, computer failure or malfunction, or any and all
164
+ other commercial damages or losses), even if such Contributor
165
+ has been advised of the possibility of such damages.
166
+
167
+ 9. Accepting Warranty or Additional Liability. While redistributing
168
+ the Work or Derivative Works thereof, You may choose to offer,
169
+ and charge a fee for, acceptance of support, warranty, indemnity,
170
+ or other liability obligations and/or rights consistent with this
171
+ License. However, in accepting such obligations, You may act only
172
+ on Your own behalf and on Your sole responsibility, not on behalf
173
+ of any other Contributor, and only if You agree to indemnify,
174
+ defend, and hold each Contributor harmless for any liability
175
+ incurred by, or claims asserted against, such Contributor by reason
176
+ of your accepting any such warranty or additional liability.
177
+
178
+ END OF TERMS AND CONDITIONS
179
+
180
+ APPENDIX: How to apply the Apache License to your work.
181
+
182
+ To apply the Apache License to your work, attach the following
183
+ boilerplate notice, with the fields enclosed by brackets "[]"
184
+ replaced with your own identifying information. (Don't include
185
+ the brackets!) The text should be enclosed in the appropriate
186
+ comment syntax for the file format. We also recommend that a
187
+ file or class name and description of purpose be included on the
188
+ same "printed page" as the copyright notice for easier
189
+ identification within third-party archives.
190
+
191
+ Copyright [yyyy] [name of copyright owner]
192
+
193
+ Licensed under the Apache License, Version 2.0 (the "License");
194
+ you may not use this file except in compliance with the License.
195
+ You may obtain a copy of the License at
196
+
197
+ http://www.apache.org/licenses/LICENSE-2.0
198
+
199
+ Unless required by applicable law or agreed to in writing, software
200
+ distributed under the License is distributed on an "AS IS" BASIS,
201
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
202
+ See the License for the specific language governing permissions and
203
+ limitations under the License.
@@ -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
- DEFAULT_CREDENTIALS = { 'url' => PUPPETLABS_FORGE }
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
- regex = /^#{username}-#{name}-.*\.tar\.gz$/
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{|f| f.match(regex)}.last
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
- # login to the puppet forge
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 #{api_key || 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
- access_token = login_data['access_token']
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'] || metadata['name'].split('-',2)[0]
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)
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.send("bump_#{level}!")
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 #{forge.username}/#{m.name}"
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, bump_commit and git 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!
@@ -1,3 +1,3 @@
1
1
  module Blacksmith
2
- VERSION = '4.1.2'
2
+ VERSION = '6.1.0'
3
3
  end
@@ -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
- new_version.send("#{term}=", new_value)
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
+ }
@@ -16,7 +16,7 @@
16
16
  },
17
17
  {
18
18
  "name": "puppet",
19
- "version_requirement": ">=2.7.20 <4.0.0"
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
- "name": "puppetlabs-stdlib",
33
- "version_requirement": ">= 3.0.0"
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(File.dirname(__FILE__), '/../data') }
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(__FILE__, "../../..", "pkg", module_name)) }
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}/..; tar -czf #{module_name}.tar.gz #{module_name}`
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, deflate', 'Authorization'=>'Bearer e52f78b62e97cb8d8db6659a73aa522cca0f5c74d4714e0ed0bdd10000000000', 'Content-Type'=>%r{\Amultipart/form-data;}})
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(File.dirname(__FILE__), '../../tmp/git_test')) }
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 <4.0.0"
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 <4.0.0"
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.1.2
4
+ version: 6.1.0
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: 2017-12-15 00:00:00.000000000 Z
12
+ date: 2020-11-18 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.2'
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - "~>"
26
+ - !ruby/object:Gem::Version
27
+ version: '0.2'
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: rake
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: puppet
57
+ name: rake
43
58
  requirement: !ruby/object:Gem::Requirement
44
59
  requirements:
45
60
  - - ">="
46
61
  - !ruby/object:Gem::Version
47
- version: 2.7.16
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: 2.7.16
69
+ version: '0'
55
70
  - !ruby/object:Gem::Dependency
56
- name: puppetlabs_spec_helper
71
+ name: puppet
57
72
  requirement: !ruby/object:Gem::Requirement
58
73
  requirements:
59
74
  - - ">="
60
75
  - !ruby/object:Gem::Version
61
- version: '0'
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: '0'
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
- - info@maestrodev.com
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
@@ -150,7 +166,8 @@ files:
150
166
  - spec/puppet_blacksmith/modulefile_spec.rb
151
167
  - spec/spec_helper.rb
152
168
  homepage: http://github.com/voxpupuli/puppet-blacksmith
153
- licenses: []
169
+ licenses:
170
+ - Apache-2.0
154
171
  metadata: {}
155
172
  post_install_message:
156
173
  rdoc_options: []
@@ -160,26 +177,26 @@ required_ruby_version: !ruby/object:Gem::Requirement
160
177
  requirements:
161
178
  - - ">="
162
179
  - !ruby/object:Gem::Version
163
- version: 2.0.0
180
+ version: 2.4.0
164
181
  required_rubygems_version: !ruby/object:Gem::Requirement
165
182
  requirements:
166
183
  - - ">="
167
184
  - !ruby/object:Gem::Version
168
185
  version: '0'
169
186
  requirements: []
170
- rubyforge_project:
171
- rubygems_version: 2.7.3
187
+ rubygems_version: 3.0.8
172
188
  signing_key:
173
189
  specification_version: 4
174
190
  summary: Tasks to manage Puppet module builds
175
191
  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
192
  - spec/puppet_blacksmith/forge_shared.rb
182
- - spec/puppet_blacksmith/forge_spec.rb
193
+ - spec/puppet_blacksmith/forge_live_spec.rb
183
194
  - spec/puppet_blacksmith/git_spec.rb
184
195
  - spec/puppet_blacksmith/modulefile_spec.rb
196
+ - spec/puppet_blacksmith/forge_spec.rb
185
197
  - spec/spec_helper.rb
198
+ - spec/data/metadata-different-author.json
199
+ - spec/data/metadata-no-author.json
200
+ - spec/data/maestrodev-test/metadata.json
201
+ - spec/data/response.json
202
+ - spec/data/metadata.json
@@ -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'