puppet-blacksmith 6.1.1 → 7.0.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: e245b9c1dd5511577bfdee9a4b13d43747755d360ff6489fa87251033819e823
4
- data.tar.gz: 67b1f15dddd35faeb8d86a70e255cae13cbeaf20e6fff840f2ef6c8a187281fd
3
+ metadata.gz: 7c7bee48c6c7f0c798b04eaa62ff7cc324f86bf3680669d6a7439e21f57a9af5
4
+ data.tar.gz: 469cf79ee47215247d6b6a7c4becff05d468aa2322cb7b167ed6018ffce78737
5
5
  SHA512:
6
- metadata.gz: 602fa94091986550141377a0fd867b9a999c865cbfcd74ee98d804d69f4ee983d5883a59e34b1739355a5120531c68294787b85b11a7d1c2247d861588974a05
7
- data.tar.gz: d04eafeeb3507cf89af8ef28ac2cbe0efd0ade986c165e8eb68ba9b0edafaba6c2c81c42149abe9f669ddb919f7130e67731f36822ecbe7441dc8b51298c3a55
6
+ metadata.gz: a3070761a6409076d8ef4881e18b228fd2cb8b7245d9be6f5b39099cb3bbdbd5c97f7ff36865938c916fbb78995bd3dbd7c8356666b858a2c4730dad1d9db9a8
7
+ data.tar.gz: 901a0e0891af8a24780728a6346f7218720f8057a436c7314f6b01e6998cee10a94b0fb37eace37e25953b3732f0a510a67149a4b898e8119cbad5b840cb5bdc
@@ -5,9 +5,8 @@ require 'base64'
5
5
 
6
6
  module Blacksmith
7
7
  class Forge
8
-
9
- PUPPETLABS_FORGE = "https://forgeapi.puppetlabs.com"
10
- CREDENTIALS_FILE_HOME = "~/.puppetforge.yml"
8
+ PUPPETLABS_FORGE = 'https://forgeapi.puppetlabs.com'
9
+ CREDENTIALS_FILE_HOME = '~/.puppetforge.yml'
11
10
  CREDENTIALS_FILE_PROJECT = '.puppetforge.yml'
12
11
  FORGE_TYPE_PUPPET = 'puppet'
13
12
  FORGE_TYPE_ARTIFACTORY = 'artifactory'
@@ -15,18 +14,17 @@ module Blacksmith
15
14
  DEFAULT_CREDENTIALS = { 'url' => PUPPETLABS_FORGE, 'forge_type' => FORGE_TYPE_PUPPET }
16
15
  HEADERS = { 'User-Agent' => "Blacksmith/#{Blacksmith::VERSION} Ruby/#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL} (#{RUBY_RELEASE_DATE}; #{RUBY_PLATFORM})" }
17
16
 
18
- attr_accessor :username, :password, :url, :client_id, :client_secret, :forge_type, :token, :api_key
17
+ attr_accessor :username, :password, :url, :forge_type, :token, :api_key
19
18
 
20
19
  def initialize(username = nil, password = nil, url = nil, forge_type = nil, token = nil, api_key = nil)
21
20
  self.username = username
22
21
  self.password = password
23
22
  self.token = token
24
23
  self.api_key = api_key
25
- RestClient.proxy = ENV['http_proxy']
24
+ RestClient.proxy = ENV.fetch('http_proxy', nil)
26
25
  load_credentials
27
- load_client_credentials_from_file
28
26
  self.url = url unless url.nil?
29
- if self.url =~ %r{http(s)?://forge.puppetlabs.com}
27
+ if %r{http(s)?://forge.puppetlabs.com}.match?(self.url)
30
28
  puts "Ignoring url entry in .puppetforge.yml: must point to the api server at #{PUPPETLABS_FORGE}, not the Forge webpage"
31
29
  self.url = PUPPETLABS_FORGE
32
30
  end
@@ -39,12 +37,13 @@ module Blacksmith
39
37
  unless package
40
38
  v = version ? Regexp.escape(version) : '.*'
41
39
  regex = /^#{user}-#{name}-#{v}\.tar\.gz$/
42
- pkg = File.expand_path("pkg")
43
- f = Dir.new(pkg).select{|fn| fn.match(regex)}.last
40
+ pkg = File.expand_path('pkg')
41
+ f = Dir.new(pkg).select { |fn| fn.match(regex) }.last
44
42
  raise Errno::ENOENT, "File not found in #{pkg} with regex #{regex}" if f.nil?
43
+
45
44
  package = File.join(pkg, f)
46
45
  end
47
- raise Errno::ENOENT, "File does not exist: #{package}" unless File.exists?(package)
46
+ raise Errno::ENOENT, "File does not exist: #{package}" unless File.exist?(package)
48
47
 
49
48
  upload(user, name, package)
50
49
  end
@@ -55,9 +54,9 @@ module Blacksmith
55
54
  url = http_url(author, name, file)
56
55
  case forge_type
57
56
  when FORGE_TYPE_ARTIFACTORY
58
- RestClient::Request.execute(:method => :put, :url => url, :payload => File.new(file, 'rb'), :headers => http_headers)
57
+ RestClient::Request.execute(method: :put, url: url, payload: File.new(file, 'rb'), headers: http_headers)
59
58
  else
60
- RestClient::Request.execute(:method => :post, :url => url, :payload => {:file => File.new(file, 'rb')}, :headers => http_headers)
59
+ RestClient::Request.execute(method: :post, url: url, payload: { file: File.new(file, 'rb') }, headers: http_headers)
61
60
  end
62
61
  rescue RestClient::Exception => e
63
62
  raise Blacksmith::Error, "Error uploading #{name} to the forge #{url} [#{e.message}]: #{e.response}"
@@ -68,7 +67,7 @@ module Blacksmith
68
67
  when FORGE_TYPE_ARTIFACTORY
69
68
  "#{url}/#{author}/#{name}/#{File.basename(file)}"
70
69
  else
71
- "#{url}/v2/releases"
70
+ "#{url}/v3/releases"
72
71
  end
73
72
  end
74
73
 
@@ -76,31 +75,15 @@ module Blacksmith
76
75
  case forge_type
77
76
  when FORGE_TYPE_ARTIFACTORY
78
77
  if api_key
79
- HEADERS.merge({'X-JFrog-Art-Api' => api_key})
78
+ HEADERS.merge({ 'X-JFrog-Art-Api' => api_key })
80
79
  elsif token
81
- HEADERS.merge({'Authorization' => "Bearer #{token}"})
80
+ HEADERS.merge({ 'Authorization' => "Bearer #{token}" })
82
81
  else
83
- HEADERS.merge({'Authorization' => "Basic " + Base64.strict_encode64("#{username}:#{password}")})
82
+ HEADERS.merge({ 'Authorization' => 'Basic ' + Base64.strict_encode64("#{username}:#{password}") })
84
83
  end
85
84
  else
86
- HEADERS.merge({'Authorization' => "Bearer #{api_key || token || oauth_access_token}"})
87
- end
88
- end
89
-
90
- def oauth_access_token
91
- begin
92
- response = RestClient.post("#{url}/oauth/token", {
93
- 'client_id' => client_id,
94
- 'client_secret' => client_secret,
95
- 'username' => username,
96
- 'password' => password,
97
- 'grant_type' => 'password'
98
- }, HEADERS)
99
- rescue RestClient::Exception => e
100
- raise Blacksmith::Error, "Error login to the forge #{url} as #{username} [#{e.message}]: #{e.response}"
85
+ HEADERS.merge({ 'Authorization' => "Bearer #{api_key || token}" })
101
86
  end
102
- login_data = JSON.parse(response)
103
- login_data['access_token']
104
87
  end
105
88
 
106
89
  def load_credentials
@@ -122,83 +105,56 @@ module Blacksmith
122
105
  self.url = credentials['url'] if credentials['url']
123
106
  self.forge_type = credentials['forge_type'] if credentials['forge_type']
124
107
 
125
- unless (self.username && self.password) || self.token || self.api_key
126
- raise Blacksmith::Error, <<-eos
127
- Could not find Puppet Forge credentials!
108
+ unless (username && password) || token || api_key
109
+ raise Blacksmith::Error, <<~EOS
110
+ Could not find Puppet Forge credentials!
128
111
 
129
- Please set the environment variables
130
- BLACKSMITH_FORGE_URL
131
- BLACKSMITH_FORGE_TYPE
132
- BLACKSMITH_FORGE_USERNAME
133
- BLACKSMITH_FORGE_PASSWORD
134
- BLACKSMITH_FORGE_TOKEN
135
- BLACKSMITH_FORGE_API_KEY
112
+ Please set the environment variables
113
+ BLACKSMITH_FORGE_URL
114
+ BLACKSMITH_FORGE_TYPE
115
+ BLACKSMITH_FORGE_USERNAME
116
+ BLACKSMITH_FORGE_PASSWORD
117
+ BLACKSMITH_FORGE_TOKEN
118
+ BLACKSMITH_FORGE_API_KEY
136
119
 
137
- or create the file '#{CREDENTIALS_FILE_PROJECT}' or '#{CREDENTIALS_FILE_HOME}'
138
- with content similiar to:
120
+ or create the file '#{CREDENTIALS_FILE_PROJECT}' or '#{CREDENTIALS_FILE_HOME}'
121
+ with content similiar to:
139
122
 
140
- ---
141
- url: https://forgeapi.puppetlabs.com
142
- username: myuser
143
- password: mypassword
123
+ ---
124
+ url: https://forgeapi.puppetlabs.com
125
+ username: myuser
126
+ password: mypassword
144
127
 
145
- eos
128
+ EOS
146
129
  end
147
130
  end
148
131
 
149
132
  def load_credentials_from_file
150
- credentials_file = [
151
- File.join(Dir.pwd, CREDENTIALS_FILE_PROJECT),
152
- File.expand_path(CREDENTIALS_FILE_HOME)
153
- ]
154
- .select { |file| File.exists?(file) }
155
- .first
133
+ credentials_file = [File.join(Dir.pwd, CREDENTIALS_FILE_PROJECT), File.expand_path(CREDENTIALS_FILE_HOME)].select { |file| File.exist?(file) }.first
156
134
 
157
135
  if credentials_file
158
- credentials = YAML.load_file(credentials_file)
136
+ YAML.load_file(credentials_file)
159
137
  else
160
- credentials = Hash.new
138
+ {}
161
139
  end
162
-
163
- return credentials
164
140
  end
165
141
 
166
142
  def load_credentials_from_env
167
- credentials = Hash.new
143
+ credentials = {}
168
144
 
169
- if ENV['BLACKSMITH_FORGE_USERNAME']
170
- credentials['username'] = ENV['BLACKSMITH_FORGE_USERNAME']
171
- end
145
+ credentials['username'] = ENV['BLACKSMITH_FORGE_USERNAME'] if ENV['BLACKSMITH_FORGE_USERNAME']
172
146
 
173
- if ENV['BLACKSMITH_FORGE_PASSWORD']
174
- credentials['password'] = ENV['BLACKSMITH_FORGE_PASSWORD']
175
- end
147
+ credentials['password'] = ENV['BLACKSMITH_FORGE_PASSWORD'] if ENV['BLACKSMITH_FORGE_PASSWORD']
176
148
 
177
- if ENV['BLACKSMITH_FORGE_URL']
178
- credentials['url'] = ENV['BLACKSMITH_FORGE_URL']
179
- end
149
+ credentials['url'] = ENV['BLACKSMITH_FORGE_URL'] if ENV['BLACKSMITH_FORGE_URL']
180
150
 
181
- if ENV['BLACKSMITH_FORGE_TYPE']
182
- credentials['forge_type'] = ENV['BLACKSMITH_FORGE_TYPE']
183
- end
151
+ credentials['forge_type'] = ENV['BLACKSMITH_FORGE_TYPE'] if ENV['BLACKSMITH_FORGE_TYPE']
184
152
 
185
- if ENV['BLACKSMITH_FORGE_TOKEN']
186
- credentials['token'] = ENV['BLACKSMITH_FORGE_TOKEN']
187
- end
153
+ credentials['token'] = ENV['BLACKSMITH_FORGE_TOKEN'] if ENV['BLACKSMITH_FORGE_TOKEN']
188
154
 
189
- if ENV['BLACKSMITH_FORGE_API_KEY']
190
- credentials['api_key'] = ENV['BLACKSMITH_FORGE_API_KEY']
191
- end
155
+ credentials['api_key'] = ENV['BLACKSMITH_FORGE_API_KEY'] if ENV['BLACKSMITH_FORGE_API_KEY']
192
156
 
193
- return credentials
194
- end
195
-
196
- def load_client_credentials_from_file
197
- credentials_file = File.expand_path(File.join(__FILE__, "..", "credentials.yml"))
198
- credentials = YAML.load_file(credentials_file)
199
- self.client_id = credentials['client_id']
200
- self.client_secret = credentials['client_secret']
157
+ credentials
201
158
  end
202
159
  end
203
-
204
160
  end
@@ -2,28 +2,19 @@ require 'open3'
2
2
 
3
3
  module Blacksmith
4
4
  class Git
5
-
6
- attr_accessor :path, :tag_pattern, :tag_message_pattern, :tag_sign, :commit_message_pattern
7
- attr_writer :tag_pattern, :tag_message_pattern, :tag_sign, :commit_message_pattern
5
+ attr_accessor :path, :tag_message_pattern, :tag_sign
6
+ attr_writer :tag_pattern, :commit_message_pattern
8
7
 
9
8
  # Pattern to use for tags, %s is replaced with the actual version
10
9
  def commit_message_pattern
11
- @commit_message_pattern || "[blacksmith] Bump version to %s"
10
+ @commit_message_pattern || '[blacksmith] Bump version to %s'
12
11
  end
13
12
 
14
13
  def tag_pattern
15
14
  @tag_pattern || 'v%s'
16
15
  end
17
16
 
18
- def tag_message_pattern
19
- @tag_message_pattern
20
- end
21
-
22
- def tag_sign
23
- @tag_sign
24
- end
25
-
26
- def initialize(path = ".")
17
+ def initialize(path = '.')
27
18
  @path = File.expand_path(path)
28
19
  end
29
20
 
@@ -38,53 +29,57 @@ module Blacksmith
38
29
 
39
30
  def tag!(version)
40
31
  tag = tag_pattern % version
41
- command = ["tag", tag]
32
+ command = ['tag', tag]
42
33
  if tag_message_pattern
43
34
  tag_message = tag_message_pattern % version
44
- command += ["-m", tag_message]
35
+ command += ['-m', tag_message]
45
36
  end
46
37
  if tag_sign
47
38
  raise Blacksmith::Error, 'Signed tags require messages - set tag_message_pattern' unless tag_message_pattern
48
- command += ["-s"]
39
+
40
+ command += ['-s']
49
41
  end
50
42
  exec_git command
51
43
  end
52
44
 
53
45
  def commit_modulefile!(version)
54
- files = Blacksmith::Modulefile::FILES.select {|f| File.exists?(File.join(@path,f))}
46
+ files = Blacksmith::Modulefile::FILES.select { |f| File.exist?(File.join(@path, f)) }
55
47
  message = commit_message_pattern % version
56
- s = exec_git ["add"] + files
57
- s += exec_git ["commit", "-m", message]
48
+ s = exec_git ['add'] + files
49
+ s += exec_git ['commit', '-m', message]
58
50
  s
59
51
  end
60
52
 
61
53
  def push!
62
- s = exec_git ["push"]
63
- s += exec_git ["push", "--tags"]
54
+ s = exec_git ['push']
55
+ s += exec_git ['push', '--tags']
64
56
  s
65
57
  end
66
58
 
67
59
  private
68
60
 
69
61
  def exec_git(cmd)
70
- out = ""
71
- err = ""
62
+ out = ''
63
+ err = ''
72
64
  exit_status = nil
73
- new_cmd = ["git", "--git-dir", File.join(@path, '.git'), "--work-tree", @path] + cmd
65
+ new_cmd = ['git', '--git-dir', File.join(@path, '.git'), '--work-tree', @path] + cmd
74
66
  # wait_thr is nil in JRuby < 1.7.5 see http://jira.codehaus.org/browse/JRUBY-6409
75
- Open3.popen3(*new_cmd) do |stdin, stdout, stderr, wait_thr|
67
+ Open3.popen3(*new_cmd) do |_stdin, stdout, stderr, wait_thr|
76
68
  out = stdout.read
77
69
  err = stderr.read
78
70
  exit_status = wait_thr.nil? ? nil : wait_thr.value
79
71
  end
80
72
  if exit_status.nil?
81
- raise Blacksmith::Error, "Command #{new_cmd} failed with stderr:\n#{err}#{"\nstdout:\n" + out unless out.empty?}" unless err.empty?
73
+ unless err.empty?
74
+ raise Blacksmith::Error,
75
+ "Command #{new_cmd} failed with stderr:\n#{err}#{"\nstdout:\n" + out unless out.empty?}"
76
+ end
82
77
  elsif !exit_status.success?
83
78
  msg = err.empty? ? out : err
84
79
  msg = "\n#{msg}" unless msg.empty?
85
80
  raise Blacksmith::Error, "Command #{new_cmd} failed with exit status #{exit_status}#{msg}"
86
81
  end
87
- return out
82
+ out
88
83
  end
89
84
  end
90
85
  end
@@ -2,31 +2,33 @@ require 'puppet_blacksmith/version_helper'
2
2
 
3
3
  module Blacksmith
4
4
  class Modulefile
5
-
6
- FILES = ["metadata.json"]
5
+ FILES = ['metadata.json']
7
6
 
8
7
  attr_reader :path
9
8
 
10
9
  def initialize(path = nil)
11
- @path = path.nil? ? FILES.find {|f| File.exists? f} : path
10
+ @path = path.nil? ? FILES.find { |f| File.exist? f } : path
12
11
  raise Blacksmith::Error, "Unable to find any of #{FILES}" unless @path
13
12
  end
14
13
 
15
14
  def metadata
16
- @metadata = JSON.parse(File.read(path)) unless @metadata
15
+ @metadata ||= JSON.parse(File.read(path))
17
16
  @metadata
18
17
  end
19
18
 
20
19
  # name in metadata.json is author-modulename
21
20
  def name
22
- metadata['name'].split('-',2)[1]
21
+ metadata['name'].split('-', 2)[1]
23
22
  end
23
+
24
24
  def namespace
25
- metadata['name'].split('-',2)[0]
25
+ metadata['name'].split('-', 2)[0]
26
26
  end
27
+
27
28
  def author
28
29
  metadata['author'] || namespace
29
30
  end
31
+
30
32
  def version
31
33
  metadata['version']
32
34
  end
@@ -34,7 +36,7 @@ module Blacksmith
34
36
  def bump_to_version!(new_version)
35
37
  text = File.read(path)
36
38
  text = replace_version(text, new_version)
37
- File.open(path,"w") { |file| file.puts text }
39
+ File.open(path, 'w') { |file| file.puts text }
38
40
  new_version
39
41
  end
40
42
 
@@ -43,14 +45,14 @@ module Blacksmith
43
45
  bump_to_version!(new_version)
44
46
  end
45
47
 
46
- [:major, :minor, :patch, :full].each do |level|
48
+ %i[major minor patch full].each do |level|
47
49
  define_method("bump_#{level}!") { bump!(level) }
48
50
  end
49
51
 
50
52
  def bump_dep!(module_name, version)
51
53
  text = File.read(path)
52
54
  text = replace_dependency_version(text, module_name, version)
53
- File.open(path, "w") {|file| file.puts text}
55
+ File.open(path, 'w') { |file| file.puts text }
54
56
  end
55
57
 
56
58
  def replace_version(text, version)
@@ -65,7 +67,7 @@ module Blacksmith
65
67
  end
66
68
 
67
69
  def replace_dependency_version(text, module_name, version)
68
- module_name = module_name.sub(/\//, '-')
70
+ module_name = module_name.sub(%r{/}, '-')
69
71
  json = JSON.parse(text)
70
72
  new_dep_list = []
71
73
  json['dependencies'].each do |dep|
@@ -4,13 +4,12 @@ require 'puppet_blacksmith'
4
4
 
5
5
  module Blacksmith
6
6
  class RakeTask < ::Rake::TaskLib
7
-
8
7
  attr_accessor :tag_pattern, :tag_message_pattern, :tag_sign, :commit_message_pattern, :build
9
8
 
10
9
  def initialize(*args, &task_block)
11
10
  @build = true
12
- @task_name = args.shift || "blacksmith"
13
- @desc = args.shift || "Puppet Forge utilities"
11
+ @task_name = args.shift || 'blacksmith'
12
+ @desc = args.shift || 'Puppet Forge utilities'
14
13
  define(args, &task_block)
15
14
  end
16
15
 
@@ -25,8 +24,7 @@ module Blacksmith
25
24
  end
26
25
 
27
26
  def define(args, &task_block)
28
-
29
- task_block.call(*[self, args].slice(0, task_block.arity)) if task_block
27
+ yield(*[self, args].slice(0, task_block.arity)) if task_block
30
28
 
31
29
  # clear any (auto-)pre-existing task
32
30
  [
@@ -50,13 +48,12 @@ module Blacksmith
50
48
  :push,
51
49
  :clean,
52
50
  :release,
53
- :dependency
51
+ :dependency,
54
52
  ].each do |t|
55
53
  Rake::Task.task_defined?("module:#{t}") && Rake::Task["module:#{t}"].clear
56
54
  end
57
55
 
58
56
  namespace :module do
59
-
60
57
  desc 'Build the module using puppet-modulebuilder'
61
58
  task :build do
62
59
  require 'puppet/modulebuilder'
@@ -66,7 +63,7 @@ module Blacksmith
66
63
  end
67
64
 
68
65
  namespace :bump do
69
- [:major, :minor, :patch, :full].each do |level|
66
+ %i[major minor patch full].each do |level|
70
67
  desc "Bump module version to the next #{level.upcase} version"
71
68
  task level do
72
69
  m = Blacksmith::Modulefile.new
@@ -76,34 +73,34 @@ module Blacksmith
76
73
  end
77
74
  end
78
75
 
79
- desc "Bump module to specific version number"
80
- task :bump_to_version, [:new_version] do |t, targs|
76
+ desc 'Bump module to specific version number'
77
+ task :bump_to_version, [:new_version] do |_t, targs|
81
78
  m = Blacksmith::Modulefile.new
82
79
  m.bump_to_version!(targs[:new_version])
83
80
  puts "Bumping version to #{targs[:new_version]}"
84
81
  end
85
82
 
86
- desc "Bump module version to the next patch"
83
+ desc 'Bump module version to the next patch'
87
84
  task :bump do
88
85
  m = Blacksmith::Modulefile.new
89
86
  v = m.bump_patch!
90
87
  puts "Bumping version from #{m.version} to #{v}"
91
88
  end
92
89
 
93
- desc "Git tag with the current module version"
90
+ desc 'Git tag with the current module version'
94
91
  task :tag do
95
92
  m = Blacksmith::Modulefile.new
96
93
  git.tag!(m.version)
97
94
  end
98
95
 
99
96
  namespace :version do
100
- desc "Get next module version"
97
+ desc 'Get next module version'
101
98
  task :next do
102
99
  m = Blacksmith::Modulefile.new
103
100
  puts m.increase_version(m.version, 'patch')
104
101
  end
105
102
 
106
- [:major, :minor, :patch].each do |level|
103
+ %i[major minor patch].each do |level|
107
104
  desc "Get the next #{level.upcase} version"
108
105
  task "next:#{level}".to_sym do
109
106
  m = Blacksmith::Modulefile.new
@@ -112,14 +109,14 @@ module Blacksmith
112
109
  end
113
110
  end
114
111
 
115
- desc "Get current module version"
112
+ desc 'Get current module version'
116
113
  task :version do
117
114
  m = Blacksmith::Modulefile.new
118
115
  puts m.version
119
116
  end
120
117
 
121
118
  namespace :bump_commit do
122
- [:major, :minor, :patch, :full].each do |level|
119
+ %i[major minor patch full].each do |level|
123
120
  desc "Bump module version to the next #{level.upcase} version and git commit"
124
121
  task level => "bump:#{level}".to_sym do
125
122
  m = Blacksmith::Modulefile.new
@@ -128,25 +125,25 @@ module Blacksmith
128
125
  end
129
126
  end
130
127
 
131
- desc "Bump version and git commit"
132
- task :bump_commit => :bump do
128
+ desc 'Bump version and git commit'
129
+ task bump_commit: :bump do
133
130
  m = Blacksmith::Modulefile.new
134
131
  git.commit_modulefile!(m.version)
135
132
  end
136
133
 
137
- desc "Push module to the Puppet Forge"
138
- task :push => :'module:build' do
134
+ desc 'Push module to the Puppet Forge'
135
+ task push: :'module:build' do
139
136
  m = Blacksmith::Modulefile.new
140
137
  forge = Blacksmith::Forge.new
141
138
  puts "Uploading to Puppet Forge #{m.namespace}/#{m.name}"
142
139
  forge.push!(m.name, nil, m.namespace, m.version)
143
140
  end
144
141
 
145
- desc "Runs clean again"
142
+ desc 'Runs clean again'
146
143
  task :clean do
147
- puts "Cleaning for module build"
148
- if Rake::Task::task_defined?(:clean)
149
- Rake::Task["clean"].execute
144
+ puts 'Cleaning for module build'
145
+ if Rake::Task.task_defined?(:clean)
146
+ Rake::Task['clean'].execute
150
147
  else
151
148
  # identical to the clean task in puppetlabs_spec_helper on 2021-07-30
152
149
  # https://github.com/puppetlabs/puppetlabs_spec_helper/blob/24d7b21280a26cc682146839f41dbf1c0793e494/lib/puppetlabs_spec_helper/rake_tasks.rb#L165-L168
@@ -155,15 +152,20 @@ module Blacksmith
155
152
  end
156
153
  end
157
154
 
158
- desc "Release the Puppet module, doing a clean, build, bump_commit, tag, push and git push."
159
- release_dependencies = @build ? [:clean, :'module:build', :bump_commit, :tag, :push] : [:clean, :bump_commit, :tag]
160
- task :release => release_dependencies do
161
- puts "Pushing to remote git repo"
155
+ desc 'Release the Puppet module, doing a clean, build, bump_commit, tag, push and git push.'
156
+ release_dependencies = if @build
157
+ %i[clean module:build bump_commit tag
158
+ push]
159
+ else
160
+ %i[clean bump_commit tag]
161
+ end
162
+ task release: release_dependencies do
163
+ puts 'Pushing to remote git repo'
162
164
  git.push!
163
165
  end
164
166
 
165
- desc "Set specific module dependency version"
166
- task :dependency, [:module_name, :version] do |t, targs|
167
+ desc 'Set specific module dependency version'
168
+ task :dependency, [:module_name, :version] do |_t, targs|
167
169
  mn = targs[:module_name]
168
170
  mv = targs[:version]
169
171
  m = Blacksmith::Modulefile.new
@@ -1,3 +1,3 @@
1
1
  module Blacksmith
2
- VERSION = '6.1.1'
2
+ VERSION = '7.0.0'
3
3
  end