| 1 | package Alien::cargo; | ||||||||||
| 2 | |||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 1 | ▶ | use 5.008004; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 1 | ▶ | use File::Which qw( which ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 1 | ▶ | use Capture::Tiny qw( capture ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 1 | ▶ | use Env qw( @PATH $RUSTUP_HOME ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | # ABSTRACT: Find or download the cargo command (build system and package manager for Rust) | ||||||||||
| 11 | our $VERSION = '0.03'; # VERSION | ||||||||||
| 12 | |||||||||||
| 13 | |||||||||||
| 14 | our %config; | ||||||||||
| 15 | |||||||||||
| 16 | if( which 'cargo' ) { | ||||||||||
| 17 | my($text, $stderr) = capture { system 'cargo', 'version' }; | ||||||||||
| 18 | if($text =~ /^cargo ([0-9\.]+)/) { | ||||||||||
| 19 | %config = ( | ||||||||||
| 20 | version => $1, | ||||||||||
| 21 | install_type => 'system', | ||||||||||
| 22 | bin_dir => [], | ||||||||||
| 23 | ); | ||||||||||
| 24 | } | ||||||||||
| 25 | } | ||||||||||
| 26 | |||||||||||
| 27 | unless(%config) { | ||||||||||
| 28 | require Alien::Rust; | ||||||||||
| 29 | $RUSTUP_HOME = Alien::Rust->rustup_home if Alien::Rust->needs_rustup_home; | ||||||||||
| 30 | %config = ( | ||||||||||
| 31 | version => Alien::Rust->version, | ||||||||||
| 32 | install_type => Alien::Rust->install_type, | ||||||||||
| 33 | bin_dir => [Alien::Rust->bin_dir], | ||||||||||
| 34 | ); | ||||||||||
| 35 | } | ||||||||||
| 36 | |||||||||||
| 37 | # these are for compatability with Alien::Base and not documented | ||||||||||
| 38 | 0 | ▶ | sub new { return bless {}, $_[0] } | ||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
| |||||||||||
| 39 | 0 | ▶ | sub cflags { '' } | ||||||||
|
Subroutine
cflags: not called CC=1 SCAR=6.9
| |||||||||||
| 40 | 0 | ▶ | sub libs { '' } | ||||||||
|
Subroutine
libs: not called CC=1 SCAR=6.9
| |||||||||||
| 41 | 0 | ▶ | sub dynamic_libs { () } | ||||||||
|
Subroutine
dynamic_libs: not called CC=1 SCAR=6.9
| |||||||||||
| 42 | |||||||||||
| 43 | |||||||||||
| 44 | 0 | ▶ | sub bin_dir { @{ $config{bin_dir } } } | ||||||||
|
Subroutine
bin_dir: not called CC=1 SCAR=6.9
| |||||||||||
| 45 | 0 | ▶ | sub version { $config{version} } | ||||||||
|
Subroutine
version: not called CC=1 SCAR=6.9
| |||||||||||
| 46 | 0 | ▶ | sub install_type { | ||||||||
|
Subroutine
install_type: not called CC=2 SCAR=17.9
| |||||||||||
| 47 | 0 | my $self = shift; | |||||||||
| 48 | 0 | my $type = $config{install_type}; | |||||||||
| 49 | 0 | ▶ | return @_ ? $type eq $_[0] : $type; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 50 | } | ||||||||||
| 51 | |||||||||||
| 52 | 1; | ||||||||||
| 53 | |||||||||||
| 54 | __END__ | ||||||||||