From 0b28d6d5c6c8c370562476359270dbdb726deeb3 Mon Sep 17 00:00:00 2001 From: Kent Fredric Date: Sat, 27 Jul 2013 18:13:39 +1200 Subject: [PATCH] Build results of e9de004 (on 0.2-series) --- Build.PL | 6 +- Changes | 18 + MANIFEST | 57 +-- META.json | 28 +- META.yml | 27 +- README | 2 +- .../examples => examples}/consolePrintDemo.pl | 16 +- examples/fileBelongsToPackage.pl | 32 ++ .../examples => examples}/formatUseflags.pl | 1 - .../examples => examples}/getArch.pl | 1 - .../getAvailableArches.pl | 1 - .../getAvailableEbuilds.pl | 1 - .../examples => examples}/getCategories.pl | 1 - .../examples => examples}/getEbuildName.pl | 1 - .../examples => examples}/getEbuildVersion.pl | 1 - examples/getFilesOfInstalledPackage.pl | 19 + .../examples => examples}/getHomedir.pl | 1 - .../getPackagesFromCategory.pl | 1 - .../getPackagesFromWorld.pl | 1 - .../examples => examples}/getParamFromFile.pl | 1 - .../getPortageMakeParam.pl | 1 - .../getPortdirOverlay.pl | 1 - .../examples => examples}/getProfilePath.pl | 1 - .../getUseSettingsOfInstalledPackage.pl | 1 - .../examples => examples}/getUsedesc.pl | 1 - .../examples => examples}/getUsedescs.pl | 1 - .../getUsemasksFromProfile.pl | 1 - .../recordAndRemovePackageFromWorld.pl | 1 - .../examples => examples}/resolveMirror.pl | 1 - .../searchInstalledPackage.pl | 1 - .../examples => examples}/searchPackage.pl | 1 - .../searchPackageByHerd.pl | 1 - .../searchPackageByMaintainer.pl | 1 - .../examples => examples}/spinner.pl | 1 - lib/PortageXS.pm | 108 +++--- lib/PortageXS/Colors.pm | 324 ++++++++++++++++++ lib/PortageXS/Core.pm | 46 +-- lib/PortageXS/System.pm | 11 +- lib/PortageXS/UI/Console.pm | 59 ++-- lib/PortageXS/UI/Spinner.pm | 4 +- lib/PortageXS/Useflags.pm | 14 +- lib/PortageXS/Version.pm | 4 +- .../examples/fileBelongsToPackage.pl | 32 -- .../examples/getFilesOfInstalledPackage.pl | 20 -- t/000-report-versions-tiny.t | 4 + 45 files changed, 574 insertions(+), 282 deletions(-) rename {lib/PortageXS/examples => examples}/consolePrintDemo.pl (63%) create mode 100755 examples/fileBelongsToPackage.pl rename {lib/PortageXS/examples => examples}/formatUseflags.pl (97%) rename {lib/PortageXS/examples => examples}/getArch.pl (87%) rename {lib/PortageXS/examples => examples}/getAvailableArches.pl (91%) rename {lib/PortageXS/examples => examples}/getAvailableEbuilds.pl (92%) rename {lib/PortageXS/examples => examples}/getCategories.pl (96%) rename {lib/PortageXS/examples => examples}/getEbuildName.pl (92%) rename {lib/PortageXS/examples => examples}/getEbuildVersion.pl (92%) create mode 100755 examples/getFilesOfInstalledPackage.pl rename {lib/PortageXS/examples => examples}/getHomedir.pl (88%) rename {lib/PortageXS/examples => examples}/getPackagesFromCategory.pl (94%) rename {lib/PortageXS/examples => examples}/getPackagesFromWorld.pl (92%) rename {lib/PortageXS/examples => examples}/getParamFromFile.pl (93%) rename {lib/PortageXS/examples => examples}/getPortageMakeParam.pl (89%) rename {lib/PortageXS/examples => examples}/getPortdirOverlay.pl (90%) rename {lib/PortageXS/examples => examples}/getProfilePath.pl (88%) rename {lib/PortageXS/examples => examples}/getUseSettingsOfInstalledPackage.pl (98%) rename {lib/PortageXS/examples => examples}/getUsedesc.pl (91%) rename {lib/PortageXS/examples => examples}/getUsedescs.pl (91%) rename {lib/PortageXS/examples => examples}/getUsemasksFromProfile.pl (96%) rename {lib/PortageXS/examples => examples}/recordAndRemovePackageFromWorld.pl (96%) rename {lib/PortageXS/examples => examples}/resolveMirror.pl (90%) rename {lib/PortageXS/examples => examples}/searchInstalledPackage.pl (92%) rename {lib/PortageXS/examples => examples}/searchPackage.pl (95%) rename {lib/PortageXS/examples => examples}/searchPackageByHerd.pl (94%) rename {lib/PortageXS/examples => examples}/searchPackageByMaintainer.pl (94%) rename {lib/PortageXS/examples => examples}/spinner.pl (93%) create mode 100644 lib/PortageXS/Colors.pm delete mode 100755 lib/PortageXS/examples/fileBelongsToPackage.pl delete mode 100755 lib/PortageXS/examples/getFilesOfInstalledPackage.pl diff --git a/Build.PL b/Build.PL index 75ac6f2..40558a7 100644 --- a/Build.PL +++ b/Build.PL @@ -19,7 +19,7 @@ my %module_build_args = ( "Kent Fredric " ], "dist_name" => "PortageXS", - "dist_version" => "0.2.12", + "dist_version" => "0.3.0", "license" => "gpl", "module_name" => "PortageXS", "recommends" => {}, @@ -28,9 +28,13 @@ my %module_build_args = ( "Carp" => 0, "DirHandle" => 0, "Exporter" => 0, + "Moo" => "1.000008", + "Role::Tiny" => 0, + "Role::Tiny::With" => 0, "Scalar::Util" => 0, "Shell::EnvImporter" => 0, "Term::ANSIColor" => 0, + "Tie::Hash::Method" => 0, "overload" => 0, "perl" => "v5.10.0", "strict" => 0, diff --git a/Changes b/Changes index 8cd7eee..923badc 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,23 @@ Revision history for PortageXS +0.3.0 2013-07-27T06:13:05Z + [00 Major Changes] + - Color logic factored out into its own module + - examples moved top level + - Exporter stuff replaced with Roles + - Hash is tied to warn about legacy code. + - ::UI::Console has most its methods deprecated now + + [Bugfix] + - another residual path to make.conf ... better solution still in the + works. + + [Dependencies::Added / runtime requires] + - Moo 1.000008 + - Role::Tiny + - Role::Tiny::With + - Tie::Hash::Method + 0.2.12 2013-07-24T06:23:39Z [Bugfix] - Partial solution to b.g.o #264680, bailing on unreadable categories, diff --git a/MANIFEST b/MANIFEST index 9683ab4..dd0390f 100644 --- a/MANIFEST +++ b/MANIFEST @@ -18,41 +18,42 @@ etc/pxs/certs/server-key.enc etc/pxs/certs/server-key.pem etc/pxs/certs/test-ca.pem etc/pxs/portagexsd.conf +examples/consolePrintDemo.pl +examples/fileBelongsToPackage.pl +examples/formatUseflags.pl +examples/getArch.pl +examples/getAvailableArches.pl +examples/getAvailableEbuilds.pl +examples/getCategories.pl +examples/getEbuildName.pl +examples/getEbuildVersion.pl +examples/getFilesOfInstalledPackage.pl +examples/getHomedir.pl +examples/getPackagesFromCategory.pl +examples/getPackagesFromWorld.pl +examples/getParamFromFile.pl +examples/getPortageMakeParam.pl +examples/getPortdirOverlay.pl +examples/getProfilePath.pl +examples/getUseSettingsOfInstalledPackage.pl +examples/getUsedesc.pl +examples/getUsedescs.pl +examples/getUsemasksFromProfile.pl +examples/recordAndRemovePackageFromWorld.pl +examples/resolveMirror.pl +examples/searchInstalledPackage.pl +examples/searchPackage.pl +examples/searchPackageByHerd.pl +examples/searchPackageByMaintainer.pl +examples/spinner.pl lib/PortageXS.pm +lib/PortageXS/Colors.pm lib/PortageXS/Core.pm lib/PortageXS/System.pm lib/PortageXS/UI/Console.pm lib/PortageXS/UI/Spinner.pm lib/PortageXS/Useflags.pm lib/PortageXS/Version.pm -lib/PortageXS/examples/consolePrintDemo.pl -lib/PortageXS/examples/fileBelongsToPackage.pl -lib/PortageXS/examples/formatUseflags.pl -lib/PortageXS/examples/getArch.pl -lib/PortageXS/examples/getAvailableArches.pl -lib/PortageXS/examples/getAvailableEbuilds.pl -lib/PortageXS/examples/getCategories.pl -lib/PortageXS/examples/getEbuildName.pl -lib/PortageXS/examples/getEbuildVersion.pl -lib/PortageXS/examples/getFilesOfInstalledPackage.pl -lib/PortageXS/examples/getHomedir.pl -lib/PortageXS/examples/getPackagesFromCategory.pl -lib/PortageXS/examples/getPackagesFromWorld.pl -lib/PortageXS/examples/getParamFromFile.pl -lib/PortageXS/examples/getPortageMakeParam.pl -lib/PortageXS/examples/getPortdirOverlay.pl -lib/PortageXS/examples/getProfilePath.pl -lib/PortageXS/examples/getUseSettingsOfInstalledPackage.pl -lib/PortageXS/examples/getUsedesc.pl -lib/PortageXS/examples/getUsedescs.pl -lib/PortageXS/examples/getUsemasksFromProfile.pl -lib/PortageXS/examples/recordAndRemovePackageFromWorld.pl -lib/PortageXS/examples/resolveMirror.pl -lib/PortageXS/examples/searchInstalledPackage.pl -lib/PortageXS/examples/searchPackage.pl -lib/PortageXS/examples/searchPackageByHerd.pl -lib/PortageXS/examples/searchPackageByMaintainer.pl -lib/PortageXS/examples/spinner.pl t/00-compile.t t/000-report-versions-tiny.t t/00_PortageXS.t diff --git a/META.json b/META.json index 8852b68..6f5de67 100644 --- a/META.json +++ b/META.json @@ -46,9 +46,13 @@ "Carp" : "0", "DirHandle" : "0", "Exporter" : "0", + "Moo" : "1.000008", + "Role::Tiny" : "0", + "Role::Tiny::With" : "0", "Scalar::Util" : "0", "Shell::EnvImporter" : "0", "Term::ANSIColor" : "0", + "Tie::Hash::Method" : "0", "overload" : "0", "perl" : "v5.10.0", "strict" : "0", @@ -68,31 +72,35 @@ "provides" : { "PortageXS" : { "file" : "lib/PortageXS.pm", - "version" : "v0.2.12" + "version" : "v0.3.0" + }, + "PortageXS::Colors" : { + "file" : "lib/PortageXS/Colors.pm", + "version" : "v0.3.0" }, "PortageXS::Core" : { "file" : "lib/PortageXS/Core.pm", - "version" : "v0.2.12" + "version" : "v0.3.0" }, "PortageXS::System" : { "file" : "lib/PortageXS/System.pm", - "version" : "v0.2.12" + "version" : "v0.3.0" }, "PortageXS::UI::Console" : { "file" : "lib/PortageXS/UI/Console.pm", - "version" : "v0.2.12" + "version" : "v0.3.0" }, "PortageXS::UI::Spinner" : { "file" : "lib/PortageXS/UI/Spinner.pm", - "version" : "v0.2.12" + "version" : "v0.3.0" }, "PortageXS::Useflags" : { "file" : "lib/PortageXS/Useflags.pm", - "version" : "v0.2.12" + "version" : "v0.3.0" }, "PortageXS::Version" : { "file" : "lib/PortageXS/Version.pm", - "version" : "v0.2.12" + "version" : "v0.3.0" } }, "release_status" : "stable", @@ -107,7 +115,7 @@ "web" : "https://github.com/gentoo-perl/PortageXS" } }, - "version" : "0.2.12", + "version" : "0.3.0", "x_BuiltWith" : { "modules" : { "Carp" : "1.29", @@ -118,6 +126,9 @@ "File::Find" : "1.23", "File::Temp" : "0.2301", "Module::Build" : "0.4005", + "Moo" : "1.002", + "Role::Tiny" : "1.002005", + "Role::Tiny::With" : "NA(undef)", "Scalar::Util" : "1.27", "Shell::EnvImporter" : "1.06", "Term::ANSIColor" : "4.02", @@ -126,6 +137,7 @@ "Test::More" : "0.98", "Test::Pod" : "1.48", "Test::Simple" : "0.98", + "Tie::Hash::Method" : "0.02", "lib" : "0.63", "overload" : "1.22", "perl" : "NA(skipped: perl)", diff --git a/META.yml b/META.yml index 8d5994a..a4ed5f1 100644 --- a/META.yml +++ b/META.yml @@ -23,32 +23,39 @@ name: PortageXS provides: PortageXS: file: lib/PortageXS.pm - version: v0.2.12 + version: v0.3.0 + PortageXS::Colors: + file: lib/PortageXS/Colors.pm + version: v0.3.0 PortageXS::Core: file: lib/PortageXS/Core.pm - version: v0.2.12 + version: v0.3.0 PortageXS::System: file: lib/PortageXS/System.pm - version: v0.2.12 + version: v0.3.0 PortageXS::UI::Console: file: lib/PortageXS/UI/Console.pm - version: v0.2.12 + version: v0.3.0 PortageXS::UI::Spinner: file: lib/PortageXS/UI/Spinner.pm - version: v0.2.12 + version: v0.3.0 PortageXS::Useflags: file: lib/PortageXS/Useflags.pm - version: v0.2.12 + version: v0.3.0 PortageXS::Version: file: lib/PortageXS/Version.pm - version: v0.2.12 + version: v0.3.0 requires: Carp: 0 DirHandle: 0 Exporter: 0 + Moo: 1.000008 + Role::Tiny: 0 + Role::Tiny::With: 0 Scalar::Util: 0 Shell::EnvImporter: 0 Term::ANSIColor: 0 + Tie::Hash::Method: 0 overload: 0 perl: v5.10.0 strict: 0 @@ -57,7 +64,7 @@ resources: bugtracker: https://github.com/gentoo-perl/PortageXS/issues homepage: https://github.com/gentoo-perl/PortageXS repository: https://github.com/gentoo-perl/PortageXS.git -version: 0.2.12 +version: 0.3.0 x_BuiltWith: modules: Carp: 1.29 @@ -68,6 +75,9 @@ x_BuiltWith: File::Find: 1.23 File::Temp: 0.2301 Module::Build: 0.4005 + Moo: 1.002 + Role::Tiny: 1.002005 + Role::Tiny::With: NA(undef) Scalar::Util: 1.27 Shell::EnvImporter: 1.06 Term::ANSIColor: 4.02 @@ -76,6 +86,7 @@ x_BuiltWith: Test::More: 0.98 Test::Pod: 1.48 Test::Simple: 0.98 + Tie::Hash::Method: 0.02 lib: 0.63 overload: 1.22 perl: 'NA(skipped: perl)' diff --git a/README b/README index 028b1f6..1321cea 100644 --- a/README +++ b/README @@ -2,7 +2,7 @@ NAME PortageXS - Portage abstraction layer for perl VERSION - version 0.2.12 + version 0.3.0 NAMING For CPAN users, the name of this module is likely confusing, and diff --git a/lib/PortageXS/examples/consolePrintDemo.pl b/examples/consolePrintDemo.pl similarity index 63% rename from lib/PortageXS/examples/consolePrintDemo.pl rename to examples/consolePrintDemo.pl index 2f7f9b1..e2456c2 100755 --- a/lib/PortageXS/examples/consolePrintDemo.pl +++ b/examples/consolePrintDemo.pl @@ -3,10 +3,9 @@ use warnings; use strict; -use lib '../..'; -use PortageXS; +use PortageXS::Colors; -my $pxs=PortageXS->new(); +my $pxs = PortageXS::Colors->new(); $pxs->print_ok("This is ok.\n"); $pxs->print_info("This is a warning.\n"); $pxs->print_err("This is an error.\n"); @@ -26,3 +25,14 @@ $pxs->setPrintColor('YELLOW'); print "This is yellow. "; $pxs->setPrintColor('RESET'); print "This is normal.\n"; +print "\ncalling restoreColors();\n"; +$pxs->restoreColors(); + +$pxs->print_ok("This is ok.\n"); +$pxs->print_info("This is a warning.\n"); +$pxs->print_err("This is an error.\n"); +$pxs->setPrintColor('RED'); print "This is red. "; +$pxs->setPrintColor('BLUE'); print "This is blue. "; +$pxs->setPrintColor('YELLOW'); print "This is yellow. "; +$pxs->setPrintColor('RESET'); print "This is normal.\n"; + diff --git a/examples/fileBelongsToPackage.pl b/examples/fileBelongsToPackage.pl new file mode 100755 index 0000000..cf6dd79 --- /dev/null +++ b/examples/fileBelongsToPackage.pl @@ -0,0 +1,32 @@ +#!/usr/bin/perl + +use warnings; +use strict; + +use PortageXS; + +$|=1; + +my $pxs=PortageXS->new(); +my $color = $pxs->colors; + +if (!-f $ARGV[0]) { + $color->printColored('RED',"Given file does not exist - Aborting!\n"); +} +else { + $color->printColored('LIGHTGREEN',"Searching for '".$ARGV[0]."'.."); + + my @results = $pxs->fileBelongsToPackage($ARGV[0]); + + if ($#results>-1) { + print " done!\n\n"; + $color->printColored('LIGHTGREEN',"The file '".$ARGV[0]."' was installed by these packages:\n"); + print " ".join("\n ",@results)."\n"; + } + else { + $color->printColored('RED',"This file has not been installed by portage.\n"); + } +} + +exit(0); + diff --git a/lib/PortageXS/examples/formatUseflags.pl b/examples/formatUseflags.pl similarity index 97% rename from lib/PortageXS/examples/formatUseflags.pl rename to examples/formatUseflags.pl index 3ce7aa8..2333c69 100755 --- a/lib/PortageXS/examples/formatUseflags.pl +++ b/examples/formatUseflags.pl @@ -3,7 +3,6 @@ use warnings; use strict; -use lib '../..'; use PortageXS; diff --git a/lib/PortageXS/examples/getArch.pl b/examples/getArch.pl similarity index 87% rename from lib/PortageXS/examples/getArch.pl rename to examples/getArch.pl index a96cedf..b74d26b 100755 --- a/lib/PortageXS/examples/getArch.pl +++ b/examples/getArch.pl @@ -3,7 +3,6 @@ use warnings; use strict; -use lib '../..'; use PortageXS; my $pxs=PortageXS->new(); diff --git a/lib/PortageXS/examples/getAvailableArches.pl b/examples/getAvailableArches.pl similarity index 91% rename from lib/PortageXS/examples/getAvailableArches.pl rename to examples/getAvailableArches.pl index 820662d..f10bda0 100755 --- a/lib/PortageXS/examples/getAvailableArches.pl +++ b/examples/getAvailableArches.pl @@ -3,7 +3,6 @@ use warnings; use strict; -use lib '../..'; use PortageXS; my $pxs=PortageXS->new(); diff --git a/lib/PortageXS/examples/getAvailableEbuilds.pl b/examples/getAvailableEbuilds.pl similarity index 92% rename from lib/PortageXS/examples/getAvailableEbuilds.pl rename to examples/getAvailableEbuilds.pl index 493c129..fda56b8 100755 --- a/lib/PortageXS/examples/getAvailableEbuilds.pl +++ b/examples/getAvailableEbuilds.pl @@ -3,7 +3,6 @@ use warnings; use strict; -use lib '../..'; use PortageXS; my $pxs=PortageXS->new(); diff --git a/lib/PortageXS/examples/getCategories.pl b/examples/getCategories.pl similarity index 96% rename from lib/PortageXS/examples/getCategories.pl rename to examples/getCategories.pl index 4c30d52..58a61c5 100755 --- a/lib/PortageXS/examples/getCategories.pl +++ b/examples/getCategories.pl @@ -3,7 +3,6 @@ use warnings; use strict; -use lib '../..'; use PortageXS; my $pxs=PortageXS->new(); diff --git a/lib/PortageXS/examples/getEbuildName.pl b/examples/getEbuildName.pl similarity index 92% rename from lib/PortageXS/examples/getEbuildName.pl rename to examples/getEbuildName.pl index b1a2f07..eecedaa 100755 --- a/lib/PortageXS/examples/getEbuildName.pl +++ b/examples/getEbuildName.pl @@ -3,7 +3,6 @@ use warnings; use strict; -use lib '../..'; use PortageXS; my $pxs=PortageXS->new(); diff --git a/lib/PortageXS/examples/getEbuildVersion.pl b/examples/getEbuildVersion.pl similarity index 92% rename from lib/PortageXS/examples/getEbuildVersion.pl rename to examples/getEbuildVersion.pl index 8f3660e..b05f3e7 100755 --- a/lib/PortageXS/examples/getEbuildVersion.pl +++ b/examples/getEbuildVersion.pl @@ -3,7 +3,6 @@ use warnings; use strict; -use lib '../..'; use PortageXS; my $pxs=PortageXS->new(); diff --git a/examples/getFilesOfInstalledPackage.pl b/examples/getFilesOfInstalledPackage.pl new file mode 100755 index 0000000..16a2d15 --- /dev/null +++ b/examples/getFilesOfInstalledPackage.pl @@ -0,0 +1,19 @@ +#!/usr/bin/perl + +use warnings; +use strict; + +use PortageXS; + +my $pxs=PortageXS->new(); + +if ($ARGV[0]) { + $pxs->colors->printColored('LIGHTGREEN',"List all files belonging to package '".$ARGV[0]."':\n"); + print " ".join("\n ",$pxs->getFilesOfInstalledPackage($ARGV[0]))."\n"; +} +else { + $pxs->colors->printColored('RED',"Please provide a package. Usage: getFilesOfInstalledPackage.pl category/package\n"); +} + +exit(0); + diff --git a/lib/PortageXS/examples/getHomedir.pl b/examples/getHomedir.pl similarity index 88% rename from lib/PortageXS/examples/getHomedir.pl rename to examples/getHomedir.pl index 2749f7d..6a0261a 100755 --- a/lib/PortageXS/examples/getHomedir.pl +++ b/examples/getHomedir.pl @@ -3,7 +3,6 @@ use warnings; use strict; -use lib '../..'; use PortageXS; my $pxs=PortageXS->new(); diff --git a/lib/PortageXS/examples/getPackagesFromCategory.pl b/examples/getPackagesFromCategory.pl similarity index 94% rename from lib/PortageXS/examples/getPackagesFromCategory.pl rename to examples/getPackagesFromCategory.pl index 4f32304..7efc977 100755 --- a/lib/PortageXS/examples/getPackagesFromCategory.pl +++ b/examples/getPackagesFromCategory.pl @@ -3,7 +3,6 @@ use warnings; use strict; -use lib '../..'; use PortageXS; my $pxs=PortageXS->new(); diff --git a/lib/PortageXS/examples/getPackagesFromWorld.pl b/examples/getPackagesFromWorld.pl similarity index 92% rename from lib/PortageXS/examples/getPackagesFromWorld.pl rename to examples/getPackagesFromWorld.pl index e56dc87..7b5cdec 100755 --- a/lib/PortageXS/examples/getPackagesFromWorld.pl +++ b/examples/getPackagesFromWorld.pl @@ -3,7 +3,6 @@ use warnings; use strict; -use lib '../..'; use PortageXS; my $pxs=PortageXS->new(); diff --git a/lib/PortageXS/examples/getParamFromFile.pl b/examples/getParamFromFile.pl similarity index 93% rename from lib/PortageXS/examples/getParamFromFile.pl rename to examples/getParamFromFile.pl index 416b1be..3028625 100755 --- a/lib/PortageXS/examples/getParamFromFile.pl +++ b/examples/getParamFromFile.pl @@ -3,7 +3,6 @@ use warnings; use strict; -use lib '../..'; use PortageXS; my $pxs=PortageXS->new(); diff --git a/lib/PortageXS/examples/getPortageMakeParam.pl b/examples/getPortageMakeParam.pl similarity index 89% rename from lib/PortageXS/examples/getPortageMakeParam.pl rename to examples/getPortageMakeParam.pl index 942b34c..15c21a2 100755 --- a/lib/PortageXS/examples/getPortageMakeParam.pl +++ b/examples/getPortageMakeParam.pl @@ -3,7 +3,6 @@ use warnings; use strict; -use lib '../..'; use PortageXS; my $pxs=PortageXS->new(); diff --git a/lib/PortageXS/examples/getPortdirOverlay.pl b/examples/getPortdirOverlay.pl similarity index 90% rename from lib/PortageXS/examples/getPortdirOverlay.pl rename to examples/getPortdirOverlay.pl index ef4832d..a930202 100755 --- a/lib/PortageXS/examples/getPortdirOverlay.pl +++ b/examples/getPortdirOverlay.pl @@ -3,7 +3,6 @@ use warnings; use strict; -use lib '../..'; use PortageXS; my $pxs=PortageXS->new(); diff --git a/lib/PortageXS/examples/getProfilePath.pl b/examples/getProfilePath.pl similarity index 88% rename from lib/PortageXS/examples/getProfilePath.pl rename to examples/getProfilePath.pl index a38e9c4..ffd4258 100755 --- a/lib/PortageXS/examples/getProfilePath.pl +++ b/examples/getProfilePath.pl @@ -3,7 +3,6 @@ use warnings; use strict; -use lib '../..'; use PortageXS; my $pxs=PortageXS->new(); diff --git a/lib/PortageXS/examples/getUseSettingsOfInstalledPackage.pl b/examples/getUseSettingsOfInstalledPackage.pl similarity index 98% rename from lib/PortageXS/examples/getUseSettingsOfInstalledPackage.pl rename to examples/getUseSettingsOfInstalledPackage.pl index aadaf6b..16f0037 100755 --- a/lib/PortageXS/examples/getUseSettingsOfInstalledPackage.pl +++ b/examples/getUseSettingsOfInstalledPackage.pl @@ -3,7 +3,6 @@ use warnings; use strict; -use lib '../..'; use PortageXS; my $package = "dev-lang/perl"; diff --git a/lib/PortageXS/examples/getUsedesc.pl b/examples/getUsedesc.pl similarity index 91% rename from lib/PortageXS/examples/getUsedesc.pl rename to examples/getUsedesc.pl index c1ee1db..69bf49b 100755 --- a/lib/PortageXS/examples/getUsedesc.pl +++ b/examples/getUsedesc.pl @@ -3,7 +3,6 @@ use warnings; use strict; -use lib '../..'; use PortageXS; my $pxs=PortageXS->new(); diff --git a/lib/PortageXS/examples/getUsedescs.pl b/examples/getUsedescs.pl similarity index 91% rename from lib/PortageXS/examples/getUsedescs.pl rename to examples/getUsedescs.pl index 5cf3233..13ca52a 100755 --- a/lib/PortageXS/examples/getUsedescs.pl +++ b/examples/getUsedescs.pl @@ -3,7 +3,6 @@ use warnings; use strict; -use lib '../..'; use PortageXS; my $pxs=PortageXS->new(); diff --git a/lib/PortageXS/examples/getUsemasksFromProfile.pl b/examples/getUsemasksFromProfile.pl similarity index 96% rename from lib/PortageXS/examples/getUsemasksFromProfile.pl rename to examples/getUsemasksFromProfile.pl index 4eaa6b3..e8e5463 100755 --- a/lib/PortageXS/examples/getUsemasksFromProfile.pl +++ b/examples/getUsemasksFromProfile.pl @@ -3,7 +3,6 @@ use warnings; use strict; -use lib '../..'; use PortageXS; $|=1; diff --git a/lib/PortageXS/examples/recordAndRemovePackageFromWorld.pl b/examples/recordAndRemovePackageFromWorld.pl similarity index 96% rename from lib/PortageXS/examples/recordAndRemovePackageFromWorld.pl rename to examples/recordAndRemovePackageFromWorld.pl index dcde60a..a55ed7f 100755 --- a/lib/PortageXS/examples/recordAndRemovePackageFromWorld.pl +++ b/examples/recordAndRemovePackageFromWorld.pl @@ -2,7 +2,6 @@ use strict; use warnings; -use lib "../.."; use PortageXS; my $pxs=PortageXS->new(); diff --git a/lib/PortageXS/examples/resolveMirror.pl b/examples/resolveMirror.pl similarity index 90% rename from lib/PortageXS/examples/resolveMirror.pl rename to examples/resolveMirror.pl index 613b6c7..543814b 100755 --- a/lib/PortageXS/examples/resolveMirror.pl +++ b/examples/resolveMirror.pl @@ -3,7 +3,6 @@ use warnings; use strict; -use lib '../..'; use PortageXS; my $pxs=PortageXS->new(); diff --git a/lib/PortageXS/examples/searchInstalledPackage.pl b/examples/searchInstalledPackage.pl similarity index 92% rename from lib/PortageXS/examples/searchInstalledPackage.pl rename to examples/searchInstalledPackage.pl index 19ae879..86ca65d 100755 --- a/lib/PortageXS/examples/searchInstalledPackage.pl +++ b/examples/searchInstalledPackage.pl @@ -3,7 +3,6 @@ use warnings; use strict; -use lib '../..'; use PortageXS; my $pxs=PortageXS->new(); diff --git a/lib/PortageXS/examples/searchPackage.pl b/examples/searchPackage.pl similarity index 95% rename from lib/PortageXS/examples/searchPackage.pl rename to examples/searchPackage.pl index e23beec..153f0e9 100755 --- a/lib/PortageXS/examples/searchPackage.pl +++ b/examples/searchPackage.pl @@ -3,7 +3,6 @@ use warnings; use strict; -use lib '../..'; use PortageXS; my $pxs=PortageXS->new(); diff --git a/lib/PortageXS/examples/searchPackageByHerd.pl b/examples/searchPackageByHerd.pl similarity index 94% rename from lib/PortageXS/examples/searchPackageByHerd.pl rename to examples/searchPackageByHerd.pl index e025554..9120663 100755 --- a/lib/PortageXS/examples/searchPackageByHerd.pl +++ b/examples/searchPackageByHerd.pl @@ -3,7 +3,6 @@ use strict; use warnings; -use lib '../..'; use PortageXS; my $pxs=PortageXS->new(); diff --git a/lib/PortageXS/examples/searchPackageByMaintainer.pl b/examples/searchPackageByMaintainer.pl similarity index 94% rename from lib/PortageXS/examples/searchPackageByMaintainer.pl rename to examples/searchPackageByMaintainer.pl index e025554..9120663 100755 --- a/lib/PortageXS/examples/searchPackageByMaintainer.pl +++ b/examples/searchPackageByMaintainer.pl @@ -3,7 +3,6 @@ use strict; use warnings; -use lib '../..'; use PortageXS; my $pxs=PortageXS->new(); diff --git a/lib/PortageXS/examples/spinner.pl b/examples/spinner.pl similarity index 93% rename from lib/PortageXS/examples/spinner.pl rename to examples/spinner.pl index 5e6ff1b..f615ab2 100755 --- a/lib/PortageXS/examples/spinner.pl +++ b/examples/spinner.pl @@ -3,7 +3,6 @@ use warnings; use strict; -use lib '../..'; use PortageXS::UI::Spinner; print "Spinner demonstration.. "; diff --git a/lib/PortageXS.pm b/lib/PortageXS.pm index db57a25..d403845 100644 --- a/lib/PortageXS.pm +++ b/lib/PortageXS.pm @@ -6,7 +6,7 @@ BEGIN { $PortageXS::AUTHORITY = 'cpan:KENTNL'; } { - $PortageXS::VERSION = '0.2.12'; + $PortageXS::VERSION = '0.3.0'; } # ABSTRACT: Portage abstraction layer for perl @@ -27,47 +27,57 @@ BEGIN { # # ----------------------------------------------------------------------------- -use PortageXS::Core; -use PortageXS::System; +use Role::Tiny::With; + + +with 'PortageXS::Core'; +with 'PortageXS::System'; +with 'PortageXS::UI::Console'; +with 'PortageXS::Useflags'; + use PortageXS::Version; -use PortageXS::UI::Console; -use PortageXS::Useflags; -use Term::ANSIColor; - -require Exporter; - -our @ISA = qw(Exporter); -our @EXPORT = qw( - getArch - getPortdir - getPortdirOverlay - getFileContents - searchInstalledPackage - getParamFromFile - getUseSettingsOfInstalledPackage - printColored - print_ok - print_err - print_info - getPortageXScategorylist - getAvailableEbuilds - getBestEbuildVersion - cmdExecute - getAvailableArches - getPackagesFromCategory - fileBelongsToPackage - getFilesOfInstalledPackage - cmdAskUser - getHomedir - getEbuildVersion - getEbuildName - ); + +sub colors { + my $self = shift; + return $self->{colors} if defined $self->{colors}; + return $self->{colors} = do { + require PortageXS::Colors; + my $colors = PortageXS::Colors->new(); + my $makeconf = $self->getFileContents( $self->{'MAKE_CONF_PATH'} ); + my $want_nocolor = + lc( $self->getParamFromFile( $makeconf, 'NOCOLOR', 'lastseen' ) ); + + if ( $want_nocolor eq 'true' ) { + $colors->disableColors; + } + $colors; + }; +} sub new { my $self = shift ; my $pxs = bless {}, $self; - + require Tie::Hash::Method; + my %blacklist = ( + 'COLORS' => 'please use pxs->colors ( PortageXS::Colors )' + ); + tie %{$pxs}, 'Tie::Hash::Method' => ( + FETCH => sub { + my ( $self, $key ) = @_; + if ( exists $blacklist{ $_[1] } ) { + die "$_[1] is gone: " . $blacklist{ $_[1] }; + } + $_[0]->base_hash->{ $_[1] }; + }, + STORE => sub { + my ( $self, $key, $value ) = @_; + if ( exists $blacklist{ $_[1] } ) { + die "$_[1] is gone: " . $blacklist{ $_[1] }; + } + $_[0]->base_hash->{ $_[1] } = $_[2]; + } + ); $pxs->{'VERSION'} = $PortageXS::VERSION; $pxs->{'PORTDIR'} = $pxs->getPortdir(); @@ -112,30 +122,6 @@ sub new { if ( not defined $pxs->{'MAKE_CONF_PATH'} ) { die "Error, none of paths for `make.conf` exists." . join q{, }, @{ $pxs->{'MAKE_CONF_PATHS'} }; } - # - init colors > - $pxs->{'COLORS'}{'YELLOW'} = color('bold yellow'); - $pxs->{'COLORS'}{'GREEN'} = color('green'); - $pxs->{'COLORS'}{'LIGHTGREEN'} = color('bold green'); - $pxs->{'COLORS'}{'WHITE'} = color('bold white'); - $pxs->{'COLORS'}{'CYAN'} = color('bold cyan'); - $pxs->{'COLORS'}{'RED'} = color('bold red'); - $pxs->{'COLORS'}{'BLUE'} = color('bold blue'); - $pxs->{'COLORS'}{'RESET'} = color('reset'); - - my $makeconf = $pxs->getFileContents($pxs->{'MAKE_CONF_PATH'}); - my $want_nocolor = lc($pxs->getParamFromFile($makeconf,'NOCOLOR','lastseen')); - - if ($want_nocolor eq 'true') { - $pxs->{'COLORS'}{'YELLOW'} = ''; - $pxs->{'COLORS'}{'GREEN'} = ''; - $pxs->{'COLORS'}{'LIGHTGREEN'} = ''; - $pxs->{'COLORS'}{'WHITE'} = ''; - $pxs->{'COLORS'}{'CYAN'} = ''; - $pxs->{'COLORS'}{'RED'} = ''; - $pxs->{'COLORS'}{'BLUE'} = ''; - $pxs->{'COLORS'}{'RESET'} = ''; - } - return $pxs; } @@ -154,7 +140,7 @@ PortageXS - Portage abstraction layer for perl =head1 VERSION -version 0.2.12 +version 0.3.0 =head1 NAMING diff --git a/lib/PortageXS/Colors.pm b/lib/PortageXS/Colors.pm new file mode 100644 index 0000000..310eb92 --- /dev/null +++ b/lib/PortageXS/Colors.pm @@ -0,0 +1,324 @@ + +use strict; +use warnings; + +package PortageXS::Colors; +BEGIN { + $PortageXS::Colors::AUTHORITY = 'cpan:KENTNL'; +} +{ + $PortageXS::Colors::VERSION = '0.3.0'; +} + +# ABSTRACT: Colour formatting / translation for Gentoo + +use Moo 1.000008; + +my %colors; + +sub _has_color { + my ( $name, $colorname ) = @_; + has( + 'color_' . $name, + is => rwp =>, + lazy => 1, + builder => sub { + require Term::ANSIColor; + Term::ANSIColor::color($colorname); + } + ); + $colors{$name} = $colorname; +} +my %task_colors; + +sub _has_task_color { + my ( $name, $colorname ) = @_; + has( + 'task_color_' . $name, + is => rwp =>, + lazy => 1, + builder => sub { $colorname } + ); + $task_colors{$name} = $colorname; +} + + +_has_color YELLOW => 'bold yellow'; +_has_color GREEN => 'green'; +_has_color LIGHTGREEN => 'bold green'; + + +_has_color WHITE => 'bold white'; +_has_color CYAN => 'bold cyan'; +_has_color RED => 'bold red'; + + +_has_color BLUE => 'bold blue'; +_has_color RESET => 'reset'; + + +_has_task_color ok => LIGHTGREEN =>; +_has_task_color err => RED =>; +_has_task_color info => YELLOW =>; + + +sub getColor { + my ( $self, $color ) = @_; + if ( not exists $colors{$color} ) { + die "No such color $color"; + } + my $method = "color_$color"; + return $self->$method(); +} + + +sub getTaskColor { + my ( $self, $task ) = @_; + if ( not exists $task_colors{$task} ) { + die "No such task $task"; + } + my $method = "task_color_$task"; + return $self->$method(); +} + + +sub printColor { + my ( $self, $color ) = @_; + return print $self->getColor($color); +} + + +sub setPrintColor { + my ( $self, $color ) = @_; + return print $self->getColor($color); +} + + +sub printTaskColor { + my ( $self, $task ) = @_; + return $self->printColor( $self->getTaskColor($task) ); +} + + +sub disableColors { + my ($self) = @_; + for my $color ( keys %colors ) { + my $setter = "_set_color_$color"; + $self->$setter(''); + } +} + + +sub restoreColors { + my ( $self, ) = @_; + for my $color ( keys %colors ) { + my $setter = "_set_color_$color"; + require Term::ANSIColor; + $self->$setter( Term::ANSIColor::color( $colors{$color} ) ); + } + +} + + +sub messageColored { + my ( $self, $color, @message ) = @_; + return sprintf ' %s* %s%s', $self->getColor($color), $self->color_RESET, + join '', @message; +} + + +sub printColored { + my ( $self, $color, $message ) = @_; + return print $self->messageColored( $color, $message ); +} + + +sub messageTaskColored { + my ( $self, $task, $message ) = @_; + return $self->messageColored( $self->getTaskColor($task), $message ); +} + + +sub printTaskColored { + my ( $self, $task, $message ) = @_; + return print $self->messageTaskColored( $task, $message ); +} + + +sub print_ok { + my ( $self, $message ) = @_; + return $self->printTaskColored( 'ok', $message ); +} + + +sub print_err { + my ( $self, $message ) = @_; + return $self->printTaskColored( 'err', $message ); +} + + +sub print_info { + my ( $self, $message ) = @_; + return $self->printTaskColored( 'info', $message ); +} + +1; + +__END__ + +=pod + +=encoding utf-8 + +=head1 NAME + +PortageXS::Colors - Colour formatting / translation for Gentoo + +=head1 VERSION + +version 0.3.0 + +=head1 METHODS + +=head2 C + + my $colorCode = $colors->getColor('YELLOW'); + +=head2 C + + my $color = $colors->getTaskColor('ok'); + my $colorCode = $colors->getColor($color); + +=head2 C + +Emit a color code, turning on that colour for all future printing + + $colors->printColor('RED'); + print "this is red" + +=head2 C + +Emit a color code, turning on that colour for all future printing + + $colors->setPrintColor('RED'); + print "this is red" + +=head2 C + +Emit a color code for a given task type, turning on that colour for all future printing + + $colors->printTaskColor('ok'); + print "this is green" + +=head2 C + +Replace all colours with empty strings. + + $colors->disableColors; + +=head2 C + +Restores factory color settings + + $colors->restoreColors; + +=head2 C + +Formats a string to Gentoo message styling + + my $message = $color->messageColored( 'RED' , "Hello World" ) + + $message eq " * Hello World" + +=head2 C + +Its C, but prints to STDOUT + + $color->printColored( 'RED' , "Hello World" ) + +=head2 C + +As with C, but takes a task name instead of a color + + my $message = $color->messageTaskColored( 'ok' , "Hello World" ) + + $message eq " * Hello World" + +=head2 C + +Its C, but prints to STDOUT + + $colors->printTaskColored( 'ok' , "Hello World" ) + +=head2 C + +Its C, but shorter and 'ok' is implied + + $colors->printTaskColored( 'ok', $message ); + $colors->print_ok( $message ); # Easy + +=head2 C + +Its C, but shorter and 'err' is implied + + $colors->printTaskColored( 'err', $message ); + $colors->print_err( $message ); # Easy + +=head2 C + +Its C, but shorter and 'info' is implied + + $colors->printTaskColored( 'info', $message ); + $colors->print_err( $message ); # Easy + +=head1 ATTRIBUTES + +=head2 C + +=head2 C + +=head2 C + +=head2 C + +=head2 C + +=head2 C + +=head2 C + +=head2 C + +=head2 task_color_ok + +=head2 task_color_err + +=head2 task_color_info + +=head1 AUTHORS + +=over 4 + +=item * + +Christian Hartmann + +=item * + +Torsten Veller + +=item * + +Kent Fredric + +=back + +=head1 COPYRIGHT AND LICENSE + +This software is Copyright (c) 2013 by Christian Hartmann. + +This is free software, licensed under: + + The GNU General Public License, Version 2, June 1991 + +=cut diff --git a/lib/PortageXS/Core.pm b/lib/PortageXS/Core.pm index 5d51023..fd418ad 100644 --- a/lib/PortageXS/Core.pm +++ b/lib/PortageXS/Core.pm @@ -6,7 +6,7 @@ BEGIN { $PortageXS::Core::AUTHORITY = 'cpan:KENTNL'; } { - $PortageXS::Core::VERSION = '0.2.12'; + $PortageXS::Core::VERSION = '0.3.0'; } # ABSTRACT: Core behaviour role for C @@ -30,45 +30,7 @@ BEGIN { use DirHandle; use Shell::EnvImporter; -require Exporter; -our @ISA = qw(Exporter PortageXS); -our @EXPORT = qw( - getArch - getProfileTree - getPortageMakeParam - getPortageMakeParamHelper - getPortdir - getPortdirOverlay - getFileContents - searchInstalledPackage - searchPackage - _searchPackage_like - _searchPackage_exact - _foreach_category - _foreach_package - getParamFromFile - getUseSettingsOfInstalledPackage - getAvailableEbuilds - getAvailableEbuildVersions - getBestEbuildVersion - getPortageXScategorylist - getAvailableArches - getPackagesFromCategory - fileBelongsToPackage - getFilesOfInstalledPackage - getEbuildVersion - getEbuildName - getReponame - resolveMirror - getCategories - getProfilePath - resetCaches - getPackagesFromWorld - recordPackageInWorld - removePackageFromWorld - searchPackageByMaintainer - searchPackageByHerd - ); +use Role::Tiny; # Description: # Returnvalue is ARCH set in the system-profile. @@ -122,7 +84,7 @@ sub getPortageMakeParam { my $self = shift; my $param = shift; my @files = (); - my @etcfiles = qw(/usr/share/portage/config/make.globals /etc/make.conf); + my @etcfiles = qw(/usr/share/portage/config/make.globals /etc/portage/make.conf); my $v = ''; my $parent = ''; my $curPath; @@ -936,7 +898,7 @@ PortageXS::Core - Core behaviour role for C =head1 VERSION -version 0.2.12 +version 0.3.0 =head1 AUTHORS diff --git a/lib/PortageXS/System.pm b/lib/PortageXS/System.pm index 47de49e..a961d13 100644 --- a/lib/PortageXS/System.pm +++ b/lib/PortageXS/System.pm @@ -6,7 +6,7 @@ BEGIN { $PortageXS::System::AUTHORITY = 'cpan:KENTNL'; } { - $PortageXS::System::VERSION = '0.2.12'; + $PortageXS::System::VERSION = '0.3.0'; } # ABSTRACT: System interactions role for PortageXS # ----------------------------------------------------------------------------- @@ -27,13 +27,8 @@ BEGIN { # ----------------------------------------------------------------------------- use DirHandle; -require Exporter; -our @ISA = qw(Exporter PortageXS); -our @EXPORT = qw( - cmdExecute - getHomedir - ); +use Role::Tiny; # Description: # Executes $program and returns it's returncode. # $returncode=cmdExecute($program); @@ -92,7 +87,7 @@ PortageXS::System - System interactions role for PortageXS =head1 VERSION -version 0.2.12 +version 0.3.0 =head1 AUTHORS diff --git a/lib/PortageXS/UI/Console.pm b/lib/PortageXS/UI/Console.pm index 2605660..72c89b3 100644 --- a/lib/PortageXS/UI/Console.pm +++ b/lib/PortageXS/UI/Console.pm @@ -6,7 +6,7 @@ BEGIN { $PortageXS::UI::Console::AUTHORITY = 'cpan:KENTNL'; } { - $PortageXS::UI::Console::VERSION = '0.2.12'; + $PortageXS::UI::Console::VERSION = '0.3.0'; } # ABSTRACT: Console interface role for PortageXS # ----------------------------------------------------------------------------- @@ -26,52 +26,47 @@ BEGIN { # # ----------------------------------------------------------------------------- -require Exporter; -our @ISA = qw(Exporter PortageXS); -our @EXPORT = qw( - printColored - print_ok - print_err - print_info - setPrintColor - cmdAskUser - formatUseflags - disableColors - ); +use Role::Tiny; # Description: # Prints gentoo-style items. sub printColored { - my $self = shift; - print ' ' . $self->{'COLORS'}{shift()} . '* ' . $self->{'COLORS'}{'RESET'} . shift() , @_; + my ( $self , @rest ) = @_; + warn "please use self->colors->printColored(...)"; + return $_[0]->colors->printColored(@rest); } # Description: # Wrapper for printColored > sub print_ok { - my $self = shift; - $self->printColored('LIGHTGREEN',shift); + my ($self,@rest) = @_; + warn "please use self->colors->print_ok(...)"; + return $self->colors->print_ok(@rest); } # Description: # Wrapper for printColored > sub print_err { - my $self = shift; - $self->printColored('RED',shift); + my ($self,@rest) = @_; + warn "please use self->colors->print_err(...)"; + return $self->colors->print_err(@rest); } # Description: # Wrapper for printColored > sub print_info { - my $self = shift; - $self->printColored('YELLOW',shift); + my ($self,@rest) = @_; + warn "please use self->colors->print_err(...)"; + return $self->colors->print_info(@rest); } # Description: # Changes color to given param > sub setPrintColor { - my $self = shift; - print $self->{'COLORS'}{shift()}; + my ($self,@rest) = @_; + warn "please use self->colors->printColor(...)"; + return $self->colors->printColor(@rest); + } # Description: @@ -166,7 +161,13 @@ sub formatUseflags { $c{'useflag'}=~s/\*//g; } - $c{'compiled'}=$self->{'COLORS'}{$c{'color'}}.$c{'prefix'}.$c{'useflag'}.$self->{'COLORS'}{'RESET'}.$c{'suffix'}; + my $c = $self->colors; + + $c{'compiled'}= + $c->getColor($c{'color'}) . + $c{'prefix'}. + $c{'useflag'}. + $c->getColor('RESET').$c{'suffix'}; if ($masked{$c{'useflag'}}) { $c{'compiled'}='('.$c{'compiled'}.')'; @@ -187,11 +188,9 @@ sub formatUseflags { # Disables colors. / Unsets set colors in PortageXS.pm # $pxs->disableColors(); sub disableColors { - my $self = shift; - foreach my $k1 (keys %{$self->{'COLORS'}}) { - $self->{'COLORS'}{$k1}=''; - } - return 1; + my $self = shift; + warn "please use self->colors->disableColors"; + return $self->colors->disableColors; } 1; @@ -208,7 +207,7 @@ PortageXS::UI::Console - Console interface role for PortageXS =head1 VERSION -version 0.2.12 +version 0.3.0 =head1 AUTHORS diff --git a/lib/PortageXS/UI/Spinner.pm b/lib/PortageXS/UI/Spinner.pm index 1861a72..5b61247 100644 --- a/lib/PortageXS/UI/Spinner.pm +++ b/lib/PortageXS/UI/Spinner.pm @@ -6,7 +6,7 @@ BEGIN { $PortageXS::UI::Spinner::AUTHORITY = 'cpan:KENTNL'; } { - $PortageXS::UI::Spinner::VERSION = '0.2.12'; + $PortageXS::UI::Spinner::VERSION = '0.3.0'; } # ABSTRACT: Dancing \|/- progress bling for consoles. # ----------------------------------------------------------------------------- @@ -67,7 +67,7 @@ PortageXS::UI::Spinner - Dancing \|/- progress bling for consoles. =head1 VERSION -version 0.2.12 +version 0.3.0 =head1 AUTHORS diff --git a/lib/PortageXS/Useflags.pm b/lib/PortageXS/Useflags.pm index 830e038..4db3aed 100644 --- a/lib/PortageXS/Useflags.pm +++ b/lib/PortageXS/Useflags.pm @@ -6,7 +6,7 @@ BEGIN { $PortageXS::Useflags::AUTHORITY = 'cpan:KENTNL'; } { - $PortageXS::Useflags::VERSION = '0.2.12'; + $PortageXS::Useflags::VERSION = '0.3.0'; } # ABSTRACT: Useflag parsing utilities role for PortageXS # ----------------------------------------------------------------------------- @@ -27,15 +27,7 @@ BEGIN { # ----------------------------------------------------------------------------- use DirHandle; -require Exporter; -our @ISA = qw(Exporter PortageXS); -our @EXPORT = qw( - getUsedesc - getUsedescs - sortUseflags - getUsemasksFromProfile - getUsemasksFromProfileHelper - ); +use Role::Tiny; # Description: # Returns useflag description of the given useflag and repository. @@ -229,7 +221,7 @@ PortageXS::Useflags - Useflag parsing utilities role for PortageXS =head1 VERSION -version 0.2.12 +version 0.3.0 =head1 AUTHORS diff --git a/lib/PortageXS/Version.pm b/lib/PortageXS/Version.pm index f45753d..d01672a 100644 --- a/lib/PortageXS/Version.pm +++ b/lib/PortageXS/Version.pm @@ -3,7 +3,7 @@ BEGIN { $PortageXS::Version::AUTHORITY = 'cpan:KENTNL'; } { - $PortageXS::Version::VERSION = '0.2.12'; + $PortageXS::Version::VERSION = '0.3.0'; } # ABSTRACT: Gentoo version object @@ -183,7 +183,7 @@ PortageXS::Version - Gentoo version object =head1 VERSION -version 0.2.12 +version 0.3.0 =head1 DESCRIPTION diff --git a/lib/PortageXS/examples/fileBelongsToPackage.pl b/lib/PortageXS/examples/fileBelongsToPackage.pl deleted file mode 100755 index 72e95d7..0000000 --- a/lib/PortageXS/examples/fileBelongsToPackage.pl +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/perl - -use warnings; -use strict; - -use lib '../..'; -use PortageXS; - -$|=1; - -my $pxs=PortageXS->new(); - -if (!-f $ARGV[0]) { - $pxs->printColored('RED',"Given file does not exist - Aborting!\n"); -} -else { - $pxs->printColored('LIGHTGREEN',"Searching for '".$ARGV[0]."'.."); - - my @results = $pxs->fileBelongsToPackage($ARGV[0]); - - if ($#results>-1) { - print " done!\n\n"; - $pxs->printColored('LIGHTGREEN',"The file '".$ARGV[0]."' was installed by these packages:\n"); - print " ".join("\n ",@results)."\n"; - } - else { - $pxs->printColored('RED',"This file has not been installed by portage.\n"); - } -} - -exit(0); - diff --git a/lib/PortageXS/examples/getFilesOfInstalledPackage.pl b/lib/PortageXS/examples/getFilesOfInstalledPackage.pl deleted file mode 100755 index 23f22ab..0000000 --- a/lib/PortageXS/examples/getFilesOfInstalledPackage.pl +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/perl - -use warnings; -use strict; - -use lib '../..'; -use PortageXS; - -my $pxs=PortageXS->new(); - -if ($ARGV[0]) { - $pxs->printColored('LIGHTGREEN',"List all files belonging to package '".$ARGV[0]."':\n"); - print " ".join("\n ",$pxs->getFilesOfInstalledPackage($ARGV[0]))."\n"; -} -else { - $pxs->printColored('RED',"Please provide a package. Usage: getFilesOfInstalledPackage.pl category/package\n"); -} - -exit(0); - diff --git a/t/000-report-versions-tiny.t b/t/000-report-versions-tiny.t index 44e6f76..68d31a3 100644 --- a/t/000-report-versions-tiny.t +++ b/t/000-report-versions-tiny.t @@ -56,6 +56,9 @@ eval { $v .= pmver('Exporter','any version') }; eval { $v .= pmver('File::Find','any version') }; eval { $v .= pmver('File::Temp','any version') }; eval { $v .= pmver('Module::Build','0.4005') }; +eval { $v .= pmver('Moo','1.000008') }; +eval { $v .= pmver('Role::Tiny','any version') }; +eval { $v .= pmver('Role::Tiny::With','any version') }; eval { $v .= pmver('Scalar::Util','any version') }; eval { $v .= pmver('Shell::EnvImporter','any version') }; eval { $v .= pmver('Term::ANSIColor','any version') }; @@ -64,6 +67,7 @@ eval { $v .= pmver('Test::CPAN::Meta','any version') }; eval { $v .= pmver('Test::More','0.98') }; eval { $v .= pmver('Test::Pod','1.41') }; eval { $v .= pmver('Test::Simple','any version') }; +eval { $v .= pmver('Tie::Hash::Method','any version') }; eval { $v .= pmver('lib','any version') }; eval { $v .= pmver('overload','any version') }; eval { $v .= pmver('strict','any version') };