Skip to content

Commit ba02b95

Browse files
committed
Rubocop Fixes
1 parent 7cbe3fd commit ba02b95

1 file changed

Lines changed: 30 additions & 20 deletions

File tree

rakelib/versions_task.rb

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -33,26 +33,11 @@ class VersionsTask < Rake::TaskLib
3333
def initialize
3434
JavaBuildpack::Logging::LoggerFactory.instance.setup "#{BUILD_DIR}/"
3535

36-
desc 'Display the versions of buildpack dependencies in human readable form'
37-
task versions: [] do
38-
v = versions
39-
40-
puts Terminal::Table.new title: "Java Buildpack #{v['buildpack']}",
41-
rows: v['dependencies']
42-
.sort_by { |dependency| dependency['name'] }
43-
.map { |dependency| [dependency['name'], dependency['version']] }
44-
end
36+
version_task
4537

4638
namespace 'versions' do
47-
desc 'Display the versions of buildpack dependencies in JSON form'
48-
task json: [] do
49-
puts JSON.pretty_generate(versions)
50-
end
51-
52-
desc 'Display the versions of buildpack dependencies in YAML form'
53-
task yaml: [] do
54-
puts YAML.dump(versions)
55-
end
39+
version_json_task
40+
version_yaml_task
5641
end
5742
end
5843

@@ -93,7 +78,6 @@ def initialize
9378

9479
PLATFORM_PATTERN = /\{platform\}/
9580

96-
9781
private_constant :ARCHITECTURE_PATTERN, :DEFAULT_REPOSITORY_ROOT_PATTERN, :NAME_MAPPINGS,
9882
:PLATFORM_PATTERN
9983

@@ -192,7 +176,6 @@ def dependency_versions
192176
index_configuration(configuration).each do |index_configuration|
193177
version, uri = get_from_cache(cache, configuration, index_configuration)
194178

195-
196179
dependency_versions << {
197180
'id' => id,
198181
'name' => NAME_MAPPINGS[id] || 'UNKNOWN',
@@ -223,6 +206,33 @@ def version(configuration, index)
223206
.resolve(JavaBuildpack::Util::TokenizedVersion.new(configuration['version']), index.keys)
224207
end
225208

209+
def version_task
210+
desc 'Display the versions of buildpack dependencies in human readable form'
211+
task versions: [] do
212+
v = versions
213+
214+
rows = v['dependencies']
215+
.sort_by { |dependency| dependency['name'] }
216+
.map { |dependency| [dependency['name'], dependency['version']] }
217+
218+
puts Terminal::Table.new title: "Java Buildpack #{v['buildpack']}", rows: rows
219+
end
220+
end
221+
222+
def version_json_task
223+
desc 'Display the versions of buildpack dependencies in JSON form'
224+
task json: [] do
225+
puts JSON.pretty_generate(versions)
226+
end
227+
end
228+
229+
def version_yaml_task
230+
desc 'Display the versions of buildpack dependencies in YAML form'
231+
task yaml: [] do
232+
puts YAML.dump(versions)
233+
end
234+
end
235+
226236
def versions
227237
{
228238
'buildpack' => Package.version,

0 commit comments

Comments
 (0)