Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add darwin specific version / release to $*KERNEL
  • Loading branch information
lizmat committed May 28, 2014
1 parent 0d32312 commit 973bae7
Showing 1 changed file with 24 additions and 4 deletions.
28 changes: 24 additions & 4 deletions src/core/Kernel.pm
Expand Up @@ -4,9 +4,10 @@
# with the values that you expected and how to get them in your situation.

class Kernel does Systemic {
has $!hardware;
has $!arch;
has $!bits;
has Str $.release;
has Str $!hardware;
has Str $!arch;
has Int $!bits;

submethod BUILD (:$!auth = "unknown") {}

Expand All @@ -26,16 +27,35 @@ class Kernel does Systemic {
method version {
$!version //= Version.new( do {
given $*DISTRO.name {
when any <linux macosx> { # needs adapting
when 'linux' { # needs adapting
qx/uname -v/.chomp;
}
when 'macosx' {
my $unamev = qx/uname -v/;
$unamev ~~ m/^Darwin \s+ Kernel \s+ Version \s+ (<[\d\.]>+)/
?? ~$0
!! $unamev.chomp;
}
default {
"unknown";
}
}
} );
}

method release {
$!release //= do {
given $*DISTRO.name {
when any <linux macosx> { # needs adapting
qx/uname -v/.chomp;
}
default {
"unknown";
}
}
}
}

method hardware {
$!hardware //= do {
given $*DISTRO.name {
Expand Down

0 comments on commit 973bae7

Please sign in to comment.