Skip to content

Commit

Permalink
initial implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
plicease committed May 7, 2024
1 parent f2fcc21 commit e76ecc2
Show file tree
Hide file tree
Showing 8 changed files with 201 additions and 16 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ jobs:
fail-fast: false
matrix:
cip_tag:
- "5.37"
- "5.39"
- "5.38"
- "5.36"
- "5.34"
- "5.32"
Expand Down
44 changes: 44 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Alien::cue ![static](https://github.com/PerlAlien/Alien-cue/workflows/static/badge.svg) ![linux](https://github.com/PerlAlien/Alien-cue/workflows/linux/badge.svg)

Find or download the cue configuration language tool

# SYNOPSIS

In your script or module:

```perl
use Alien::cue;
use Env qw( @PATH );

unshift @PATH, Alien::cue->bin_dir;
```

# DESCRIPTION

This package can be used by other CPAN modules that require cue,
the configuration language tool.

# HELPERS

## cue

```
%{cue}
```

Returns the name of the cue command. Usually just `cue`.

# SEE ALSO

[Alien](https://metacpan.org/pod/Alien), [Alien::Base](https://metacpan.org/pod/Alien::Base), [Alien::Build::Manual::AlienUser](https://metacpan.org/pod/Alien::Build::Manual::AlienUser)

# AUTHOR

Graham Ollis <[email protected]>

# COPYRIGHT AND LICENSE

This software is copyright (c) 2024 by Graham Ollis.

This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
34 changes: 26 additions & 8 deletions alienfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,31 @@
use alienfile;
plugin 'PkgConfig' => 'libfoo';

plugin 'Probe::CommandLine' => (
command => 'cue',
args => [ 'version' ],
match => qr/cue version/,
version => qr/cue version ([0-9\.]+)/,
);

share {
plugin Download => (
url => 'http://...',
filter => qr/*\.tar\.gz$/,
version => qr/([0-9\.]+)/,

requires 'Alien::Go';

plugin 'Download::GitHub' => (
github_user => 'cue-lang',
github_repo => 'cue',
prefer => sub {
my($build, $res) = @_;
return {
type => 'list',
list => [grep { $_->{version} !~ /alpha/ } @{ $res->{list} }],
};
},
);
plugin Extract => 'tar.gz';
plugin 'Build::Autoconf';
};

build [
'env GOPATH=%{.install.prefix} go install ./cmd/cue',
'env GOPATH=%{.install.prefix} go clean -modcache',
];

};
5 changes: 2 additions & 3 deletions author.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,5 @@ pod_coverage:
skip: 0
# format is "Class#method" or "Class",regex allowed
# for either Class or method.
private: []


private:
- Alien::cue#alien_helper
7 changes: 6 additions & 1 deletion dist.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ copyright_holder = Graham Ollis
copyright_year = 2024
version = 0.01

[AlienBase::Doc]
name = cue
type = tool

[@Author::Plicease]
:version = 2.75
release_tests = 1
Expand All @@ -21,4 +25,5 @@ irc = irc://irc.perl.org/#native
[Author::Plicease::Upload]
cpan = 0


[AlienBuild]
:version = 0.10
28 changes: 26 additions & 2 deletions lib/Alien/cue.pm
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,33 @@ use warnings;
use 5.008004;
use base qw( Alien::Base );

# ABSTRACT: Find or download the cue programming language tool
# ABSTRACT: Find or download the cue configuration language tool
# VERSION
# ALIEN SYNOPSIS

1;
=head1 DESCRIPTION
This package can be used by other CPAN modules that require cue,
the configuration language tool.
=head1 HELPERS
=head2 cue
%{cue}
Returns the name of the cue command. Usually just C<cue>.
=cut

sub alien_helper
{
return {
cue => sub { 'cue' },
};
}

# ALIEN SEE ALSO


1;
91 changes: 91 additions & 0 deletions t/00_diag.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
use Test2::V0 -no_srand => 1;
use Config;

eval { require 'Test/More.pm' };

# This .t file is generated.
# make changes instead to dist.ini

my %modules;
my $post_diag;

$modules{$_} = $_ for qw(
Alien::Base
Alien::Build
Alien::Build::MM
Alien::Build::Plugin::Download::GitHub
ExtUtils::MakeMaker
Test2::V0
Test::Alien
);



my @modules = sort keys %modules;

sub spacer ()
{
diag '';
diag '';
diag '';
}

pass 'okay';

my $max = 1;
$max = $_ > $max ? $_ : $max for map { length $_ } @modules;
our $format = "%-${max}s %s";

spacer;

my @keys = sort grep /(MOJO|PERL|\A(LC|HARNESS)_|\A(SHELL|LANG)\Z)/i, keys %ENV;

if(@keys > 0)
{
diag "$_=$ENV{$_}" for @keys;

if($ENV{PERL5LIB})
{
spacer;
diag "PERL5LIB path";
diag $_ for split $Config{path_sep}, $ENV{PERL5LIB};

}
elsif($ENV{PERLLIB})
{
spacer;
diag "PERLLIB path";
diag $_ for split $Config{path_sep}, $ENV{PERLLIB};
}

spacer;
}

diag sprintf $format, 'perl', "$] $^O $Config{archname}";

foreach my $module (sort @modules)
{
my $pm = "$module.pm";
$pm =~ s{::}{/}g;
if(eval { require $pm; 1 })
{
my $ver = eval { $module->VERSION };
$ver = 'undef' unless defined $ver;
diag sprintf $format, $module, $ver;
}
else
{
diag sprintf $format, $module, '-';
}
}

if($post_diag)
{
spacer;
$post_diag->();
}

spacer;

done_testing;

5 changes: 4 additions & 1 deletion t/alien_cue.t
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
use Test2::V0 -no_srand => 1;
use Alien::cue;
use Test::Alien;

ok 1, 'todo';
alien_ok 'Alien::cue';
run_ok(['cue', 'version'])
->note;

done_testing;

Expand Down

0 comments on commit e76ecc2

Please sign in to comment.