From 81e203dcfbded9880bc84c22766d67f2372d442d Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Sat, 12 Nov 2016 14:33:04 +0000 Subject: Don't include region in the product name when region is 'all'. --- lib/MDV/Draklive/Live.pm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/MDV/Draklive/Live.pm b/lib/MDV/Draklive/Live.pm index 545c96c..d2adb1f 100644 --- a/lib/MDV/Draklive/Live.pm +++ b/lib/MDV/Draklive/Live.pm @@ -7,9 +7,17 @@ sub new { bless {}, $class; } +sub default_name_fields { + my ($live) = @_; + [ qw(name version product desktop), + if_($live->{settings}{region} ne 'all', region), + qw(arch media) + ]; +} + sub get_name { my ($live) = @_; - my $fields = $live->{name_fields} || [ qw(name version product desktop region arch media) ]; + my $fields = $live->{name_fields} || default_name_fields($live); join('-', grep { $_ } @{$live->{settings}}{@$fields}); } -- cgit v1.2.1