Skip to content

Commit

Permalink
replaced libuuid with uuid::tiny
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Duggan committed Mar 5, 2015
1 parent c44c928 commit 180266f
Show file tree
Hide file tree
Showing 16 changed files with 34 additions and 32 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,5 @@ cache:
- /home/travis/perl5/perlbrew/perls/5.20/lib/site_perl
- /home/travis/perl5/perlbrew/perls/5.16/lib/site_perl
before_install :
- cpanm -f Data::UUID::LibUUID
# - sudo apt-get install libuuid1 uuid-dev raptor2-utils

2 changes: 1 addition & 1 deletion Build.PL
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ my $builder = Module::Build::Database->new(
'YAML::Syck' => 0,
'YAML::XS' => 0,
'YAML' => 0,
'Data::UUID::LibUUID' => 0,
'UUID::Tiny' => 0,
'Rose::DB' => '0.772',
'Rose::DB::Object' => 0,
'DBD::Pg' => '3.003',
Expand Down
9 changes: 4 additions & 5 deletions lib/Tuba.pm
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ use Mojo::Base qw/Mojolicious/;
use Mojo::ByteStream qw/b/;
use Tuba::Converter;
use Tuba::Log;
use Tuba::Util qw/set_config/;
use Data::UUID::LibUUID;
use Tuba::Util qw/set_config new_uuid/;
use Path::Class qw/file/;
use strict;

Expand Down Expand Up @@ -277,9 +276,9 @@ sub startup {
return $c->render( text => "sorry, max is 1000 at once" ) if $count > 1000;
$c->res->headers->content_type('text/plain');
$c->respond_to(
text => sub { shift->render( text => ( join "\n", (map new_uuid_string(4), 1..$count) ) ) },
html => sub { shift->render( text => ( join "\n", (map new_uuid_string(4), 1..$count) ) ) },
json => sub { shift->render( json => [ map new_uuid_string(4), 1..$count ] ) },
text => sub { shift->render( text => ( join "\n", (map new_uuid(), 1..$count) ) ) },
html => sub { shift->render( text => ( join "\n", (map new_uuid(), 1..$count) ) ) },
json => sub { shift->render( json => [ map new_uuid(), 1..$count ] ) },
);
} => 'uuid'
);
Expand Down
4 changes: 2 additions & 2 deletions lib/Tuba/Array.pm
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use Path::Class qw/file dir/;
use File::Basename qw/basename/;
use Tuba::Log;
use Tuba::DB::Objects qw/-nicknames/;
use Data::UUID::LibUUID;
use Tuba::Util qw[new_uuid];
use Text::CSV_XS;

=head1 ROUTES
Expand Down Expand Up @@ -73,7 +73,7 @@ sub update_rel {

sub create_form {
my $c = shift;
$c->param(identifier => new_uuid_string(4));
$c->param(identifier => new_uuid());
$c->stash(controls => {
rows => { template => 'grid' }
});
Expand Down
3 changes: 1 addition & 2 deletions lib/Tuba/Controller.pm
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,10 @@ use Tuba::Search;
use Pg::hstore qw/hstore_encode hstore_decode/;
use Path::Class qw/file/;
use Tuba::Log;
use Tuba::Util qw/nice_db_error show_diffs/;
use Tuba::Util qw/nice_db_error show_diffs human_duration/;
use File::Temp;
use YAML qw/Dump/;
use Encode qw/encode decode/;
use Tuba::Util qw/human_duration/;
use Mojo::Util qw/camelize decamelize/;
use LWP::UserAgent;
use HTTP::Request;
Expand Down
4 changes: 2 additions & 2 deletions lib/Tuba/DB/Mixin/Object/Activity.pm
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package Tuba::DB::Object::Activity;
# Tuba::DB::Mixin::Object::Activity
use Data::UUID::LibUUID;
use Tuba::Util qw[new_uuid];
use strict;

__PACKAGE__->meta->primary_key_generator(sub {
return new_uuid_string(4);
return new_uuid();
});

sub stringify {
Expand Down
4 changes: 2 additions & 2 deletions lib/Tuba/DB/Mixin/Object/Array.pm
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package Tuba::DB::Object::Array;
# Tuba::DB::Mixin::Object::Array;
use Mojo::ByteStream qw/b/;
use Data::UUID::LibUUID;
use Tuba::Util qw[new_uuid];
use List::Util qw/max/;
use strict;

__PACKAGE__->meta->primary_key_generator(sub {
return new_uuid_string(4);
return new_uuid();
});

sub stringify {
Expand Down
4 changes: 2 additions & 2 deletions lib/Tuba/DB/Mixin/Object/Book.pm
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package Tuba::DB::Object::Book;
# Tuba::DB::Mixin::Object::Book
use Data::UUID::LibUUID;
use Tuba::Util qw[new_uuid];
use strict;

__PACKAGE__->meta->primary_key_generator(sub {
return new_uuid_string(4);
return new_uuid();
});


Expand Down
4 changes: 2 additions & 2 deletions lib/Tuba/DB/Mixin/Object/File.pm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package Tuba::DB::Object::File;
# Tuba::DB::Mixin::Object::File;
use Mojo::ByteStream qw/b/;
use Mojo::Parameters;
use Data::UUID::LibUUID;
use Tuba::Util qw[new_uuid];
use Path::Class ();
use Tuba::Log qw/logger/;
use Tuba::Util qw/get_config/;
Expand All @@ -11,7 +11,7 @@ use Path::Class ();
use strict;

__PACKAGE__->meta->primary_key_generator(sub {
return new_uuid_string(4);
return new_uuid();
});

our %typeMap = (
Expand Down
4 changes: 2 additions & 2 deletions lib/Tuba/DB/Mixin/Object/Generic.pm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package Tuba::DB::Object::Generic;
# Tuba::DB::Mixin::Object::Generic;
use Data::UUID::LibUUID;
use Tuba::Util qw[new_uuid];
use Pg::hstore;
use Encode;
use strict;
Expand All @@ -18,7 +18,7 @@ __PACKAGE__->meta->column('attrs')->add_trigger(
});

__PACKAGE__->meta->primary_key_generator(sub {
return new_uuid_string(4);
return new_uuid();
});


Expand Down
4 changes: 2 additions & 2 deletions lib/Tuba/DB/Mixin/Object/Image.pm
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package Tuba::DB::Object::Image;
# Tuba::DB::Mixin::Object::Image;
use Data::UUID::LibUUID;
use Tuba::Util qw[new_uuid];

__PACKAGE__->meta->primary_key_generator(sub {
return new_uuid_string(4);
return new_uuid();
});

sub stringify {
Expand Down
4 changes: 2 additions & 2 deletions lib/Tuba/DB/Mixin/Object/ModelRun.pm
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package Tuba::DB::Object::ModelRun;
# Tuba::DB::Mixin::Object::ModelRun;
use Data::UUID::LibUUID;
use Tuba::Util qw[new_uuid];

__PACKAGE__->meta->primary_key_generator(sub {
return new_uuid_string(4);
return new_uuid();
});

1;
Expand Down
4 changes: 2 additions & 2 deletions lib/Tuba/DB/Mixin/Object/Webpage.pm
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package Tuba::DB::Object::Webpage;
# Tuba::DB::Mixin::Object::Webpage
use Data::UUID::LibUUID;
use Tuba::Util qw[new_uuid];
use strict;

__PACKAGE__->meta->primary_key_generator(sub {
return new_uuid_string(4);
return new_uuid();
});


Expand Down
4 changes: 2 additions & 2 deletions lib/Tuba/Image.pm
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use Path::Class qw/file dir/;
use File::Basename qw/basename/;
use Tuba::Log;
use Tuba::DB::Objects qw/-nicknames/;
use Data::UUID::LibUUID;
use Tuba::Util qw[new_uuid];

=head1 ROUTES
Expand Down Expand Up @@ -72,7 +72,7 @@ sub update_rel {

sub create_form {
my $c = shift;
$c->param(identifier => new_uuid_string(4));
$c->param(identifier => new_uuid());
return $c->SUPER::create_form(@_);
}

Expand Down
4 changes: 2 additions & 2 deletions lib/Tuba/Reference.pm
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use Mojo::Base qw/Tuba::Controller/;
use Tuba::DB::Objects qw/-nicknames/;
use Rose::DB::Object::Util qw/:all/;
use Tuba::Log qw/logger/;;
use Data::UUID::LibUUID;
use Tuba::Util qw[new_uuid];

sub list {
my $c = shift;
Expand Down Expand Up @@ -349,7 +349,7 @@ sub set_title {

sub create_form {
my $c = shift;
$c->param(identifier => new_uuid_string(4));
$c->param(identifier => new_uuid());
return $c->SUPER::create_form(@_);
}

Expand Down
7 changes: 6 additions & 1 deletion lib/Tuba/Util.pm
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ use Mojo::ByteStream qw/b/;
use Mojo::Util qw/xml_escape/;
use Encode qw/decode/;
use DateTime::Format::Human::Duration;
use UUID::Tiny qw/:std/;

our @EXPORT_OK = qw/nice_db_error set_config get_config show_diffs elide_str human_duration/;
our @EXPORT_OK = qw/nice_db_error set_config get_config show_diffs elide_str human_duration new_uuid/;

sub nice_db_error {
my $err = shift or return;
Expand Down Expand Up @@ -60,5 +61,9 @@ sub human_duration {
return DateTime::Format::Human::Duration->new()->format_duration($d);
}

sub new_uuid {
return create_uuid_as_string(UUID_V4);
}

1;

0 comments on commit 180266f

Please sign in to comment.