Skip to content

Commit

Permalink
regen
Browse files Browse the repository at this point in the history
  • Loading branch information
xaicron committed Jul 4, 2016
1 parent a94f235 commit aa13a66
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 75 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -25,3 +25,4 @@ dll*
!Build/
!META.json
!LICENSE
/Build.bat
6 changes: 6 additions & 0 deletions .travis.yml
@@ -0,0 +1,6 @@
language: perl
perl:
- 5.24
- 5.22
- 5.20
- 5.18
60 changes: 2 additions & 58 deletions Build.PL
Expand Up @@ -4,65 +4,9 @@
# =========================================================================

use 5.008_001;

use strict;
use warnings;
use utf8;

use Module::Build;
use File::Basename;
use File::Spec;
use CPAN::Meta;
use CPAN::Meta::Prereqs;

my %args = (
license => 'perl',
dynamic_config => 0,

configure_requires => {
'Module::Build' => 0.38,
},

name => 'Data-WeightedRoundRobin',
module_name => 'Data::WeightedRoundRobin',
allow_pure_perl => 0,

script_files => [glob('script/*'), glob('bin/*')],

test_files => ((-d '.git' || $ENV{RELEASE_TESTING}) && -d 'xt') ? 't/ xt/' : 't/',
recursive_test_files => 1,
);
if (-d 'share') {
$args{share_dir} = 'share';
}
use Module::Build::Tiny 0.035;

my $builder = Module::Build->subclass(
class => 'MyBuilder',
code => q{
sub ACTION_distmeta {
die "Do not run distmeta. Install Minilla and `minil install` instead.\n";
}
sub ACTION_installdeps {
die "Do not run installdeps. Run `cpanm --installdeps .` instead.\n";
}
}
)->new(%args);
$builder->create_build_script();
Build_PL();

my $mbmeta = CPAN::Meta->load_file('MYMETA.json');
my $meta = CPAN::Meta->load_file('META.json');
my $prereqs_hash = CPAN::Meta::Prereqs->new(
$meta->prereqs
)->with_merged_prereqs(
CPAN::Meta::Prereqs->new($mbmeta->prereqs)
)->as_string_hash;
my $mymeta = CPAN::Meta->new(
{
%{$meta->as_struct},
prereqs => $prereqs_hash
}
);
print "Merging cpanfile prereqs to MYMETA.yml\n";
$mymeta->save('MYMETA.yml', { version => 1.4 });
print "Merging cpanfile prereqs to MYMETA.json\n";
$mymeta->save('MYMETA.json', { version => 2 });
18 changes: 10 additions & 8 deletions META.json
Expand Up @@ -4,7 +4,7 @@
"xaicron <xaicron {at} cpan.org>"
],
"dynamic_config" : 0,
"generated_by" : "Minilla/v0.4.3, CPAN::Meta::Converter version 2.130880",
"generated_by" : "Minilla/v3.0.2, CPAN::Meta::Converter version 2.150005",
"license" : [
"perl_5"
],
Expand All @@ -21,7 +21,8 @@
"share",
"eg",
"examples",
"author"
"author",
"builder"
]
},
"prereqs" : {
Expand All @@ -32,17 +33,16 @@
},
"configure" : {
"requires" : {
"CPAN::Meta" : "0",
"CPAN::Meta::Prereqs" : "0",
"Module::Build" : "0.38"
"Module::Build::Tiny" : "0.035"
}
},
"develop" : {
"requires" : {
"Test::CPAN::Meta" : "0",
"Test::MinimumVersion" : "0.10108",
"Test::MinimumVersion::Fast" : "0.04",
"Test::PAUSE::Permissions" : "0.04",
"Test::Pod" : "1.41",
"Test::Spellunker" : "v0.2.2"
"Test::Spellunker" : "v0.2.7"
}
},
"runtime" : {
Expand All @@ -69,7 +69,9 @@
}
},
"version" : "0.06",
"x_authority" : "cpan:XAICRON",
"x_contributors" : [
"xaicron <xaicron@gmail.com>"
]
],
"x_serialization_backend" : "JSON::PP version 2.27400"
}
18 changes: 9 additions & 9 deletions README.md
@@ -1,3 +1,4 @@
[![Build Status](https://travis-ci.org/xaicron/p5-Data-WeightedRoundRobin.svg?branch=master)](https://travis-ci.org/xaicron/p5-Data-WeightedRoundRobin)
# NAME

Data::WeightedRoundRobin - Serve data in a Weighted RoundRobin manner.
Expand Down Expand Up @@ -34,7 +35,7 @@ Data::WeightedRoundRobin is a Serve data in a Weighted RoundRobin manner.
\{ foo => 'bar' },
]);

Sets default\_weight option, DEFAULT is __$Data::WeightedRoundRobin::DEFAULT\_WEIGHT__.
Sets default\_weight option, DEFAULT is **$Data::WeightedRoundRobin::DEFAULT\_WEIGHT**.

# foo : bar : baz = 0.3 : 0.7 : 1
$dwr = Data::WeightedRoundRobin->new([
Expand All @@ -47,12 +48,11 @@ Data::WeightedRoundRobin is a Serve data in a Weighted RoundRobin manner.

Fetch a data.

my $dwr = Data::WeightedRoundRobin->new([
qw/foo bar/],
{ value => 'baz', weight => 50 },
);

my $dwr = Data::WeightedRoundRobin->new([
qw/foo bar/],
{ value => 'baz', weight => 50 },
);
# Infinite loop
while (my $data = $dwr->next) {
say $data; # foo : bar : baz = 100 : 100 : 50
Expand Down Expand Up @@ -91,7 +91,7 @@ Data::WeightedRoundRobin is a Serve data in a Weighted RoundRobin manner.

use Test::More;
my $dwr = Data::WeightedRoundRobin->new([qw/foo/, { value => 'bar', weight => 50 }]);
is $dwr->replace('baz'), 1, 'replaced bar';
is $dwr->replace('bar'), 1, 'replaced bar to default weight (50 -> 100)';
is $dwr->replace('hoge'), 0, 'hoge is not found';
is $dwr->replace({ value => 'foo', weight => 80 }), 1, 'replaced foo with weight 80';
is $dwr->replace(), undef, 'error';
Expand Down Expand Up @@ -122,7 +122,7 @@ Data::WeightedRoundRobin is a Serve data in a Weighted RoundRobin manner.

# AUTHOR

xaicron <xaicron {at} cpan.org>
xaicron &lt;xaicron {at} cpan.org>

# COPYRIGHT

Expand Down
6 changes: 6 additions & 0 deletions minil.toml
@@ -0,0 +1,6 @@
name = "Data-WeightedRoundRobin"
badges = ["travis"]
authority="cpan:XAICRON"

module_maker="ModuleBuildTiny"

0 comments on commit aa13a66

Please sign in to comment.