Skip to content

Commit

Permalink
Use the App::Parrot::Create:: namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
dboys committed Sep 21, 2013
1 parent c32444a commit 0af0e43
Show file tree
Hide file tree
Showing 7 changed files with 86 additions and 89 deletions.
8 changes: 4 additions & 4 deletions app-parrot-create
@@ -1,8 +1,8 @@
#!/usr/bin/env perl
use Mojolicious::Lite;
use Mojo::Home;
use Parrot::HLL;
use Parrot::Library;
use App::Parrot::Create::HLL;
use App::Parrot::Create::Library;

# Read configuration file
plugin 'yaml_config';
Expand All @@ -21,7 +21,7 @@ post '/' => sub {
($name, $builder, $harness, $with_pmc, $with_ops, $with_doc)
= map { $self->param($_) } qw/hll_name hll_builder hll_test with_pmc with_ops with_doc/;

my $hll = Parrot::HLL->new();
my $hll = App::Parrot::Create::HLL->new();
$hll->init($name, $builder, $harness, $with_pmc, $with_ops, $with_doc, $self->app->config->{hll_template});

if ($archive_path = $hll->generate()) {
Expand All @@ -31,7 +31,7 @@ post '/' => sub {
elsif(defined $self->param("lib")){
($name, $builder, $harness) = map { $self->param($_) } qw/lib_name lib_builder lib_test/;

my $library = Parrot::Library->new();
my $library = App::Parrot::Create::Library->new();
$library->init($name, $builder, $harness, $self->app->config->{library_template});

if ($archive_path = $library->generate()) {
Expand Down
32 changes: 16 additions & 16 deletions lib/Parrot/Base.pm → lib/App/Parrot/Create/Base.pm
@@ -1,8 +1,8 @@
package Parrot::Base;
package App::Parrot::Create::Base;

use v5.10;
use v5.14;
use Moose::Role;
use Parrot::Type;
use App::Parrot::Create::Type;
use Template;
use Method::Signatures;
use File::Spec;
Expand Down Expand Up @@ -78,12 +78,12 @@ method generate_template($template_dir,$template_file) {

my $tt = Template->new($config);
my $objects = {
WINXED => Parrot::Type::WINXED,
NQP => Parrot::Type::NQP,
PERL5 => Parrot::Type::PERL5,
PIR => Parrot::Type::PIR,
ROSELLA_WINXED => Parrot::Type::ROSELLA_WINXED,
ROSELLA_NQP => Parrot::Type::ROSELLA_NQP,
WINXED => App::Parrot::Create::Type::WINXED,
NQP => App::Parrot::Create::Type::NQP,
PERL5 => App::Parrot::Create::Type::PERL5,
PIR => App::Parrot::Create::Type::PIR,
ROSELLA_WINXED => App::Parrot::Create::Type::ROSELLA_WINXED,
ROSELLA_NQP => App::Parrot::Create::Type::ROSELLA_NQP,
object => $self,
};

Expand Down Expand Up @@ -166,13 +166,13 @@ __END__
=head1 NAME
Parrot::Base - Moose role for app-parrot-create web project.
App::Parrot::Create::Base - Moose role for app-parrot-create web project.
=head1 SYNOPSIS
package Foo;
use Moose;
with 'Parrot::Base';
with 'App::Parrot::Create::Base';
sub init {
#need to set base options
Expand Down Expand Up @@ -201,21 +201,21 @@ __END__
}
build_system - Build system based on one of the languages which providing Parrot VM.
It's a String Constant type from Parrot::Type package.
It's a String Constant type from App::Parrot::Create::Type package.
#set the build system
$self->build_system(Parrot::Type::WINXED)
$self->build_system(App::Parrot::Create::Type::WINXED)
#check the build system
if ($self->has_build_system){
...
}
test_system - Test system based on one of the languages which providing Parrot VM.
It's a String Constant type from Parrot::Type package.
It's a String Constant type from App::Parrot::Create::Type package.
#set the test system
$self->test_system(Parrot::Type::WINXED)
$self->test_system(App::Parrot::Create::Type::WINXED)
#check the test system
if ($self->has_test_system){
Expand Down Expand Up @@ -311,7 +311,7 @@ __END__
=head1 DESCRIPTION
This module built on Moose::Role module. It's including a base methods and fields, which is the same for Parrot:HLL and Parrot::Library.
This module built on Moose::Role module. It's including a base methods and fields, which is the same for Parrot:HLL and App::Parrot::Create::Library.
If you want to use this role you will need to realization an init method. In this method you will need to set a required fields.
It are name, build_system, test_system.
Expand Down
13 changes: 6 additions & 7 deletions lib/Parrot/HLL.pm → lib/App/Parrot/Create/HLL.pm
@@ -1,11 +1,10 @@
package Parrot::HLL;
package App::Parrot::Create::HLL;

use v5.10;
use Moose;
use Parrot::Type;
use App::Parrot::Create::Type;
use Method::Signatures;

with 'Parrot::Base';
with 'App::Parrot::Create::Base';

has 'with_pmc' => (
isa => 'Bool',
Expand Down Expand Up @@ -52,12 +51,12 @@ __END__
=head1 NAME
Parrot::HLL - Moose class for work with high level language.
App::Parrot::Create::HLL - Moose class for work with high level language.
=head1 SYNOPSIS
#simple using
my $hll = Parrot::HLL->new();
my $hll = App::Parrot::Create::HLL->new();
$hll->init($name, $builder, $harness, $with_pmc, $with_ops, $with_doc, $template);
#generate and return archive
Expand Down Expand Up @@ -122,7 +121,7 @@ __END__
=head1 DESCRIPTION
Class is using for work with HLL objects. It's implementing a Parrot::Base role and expanding its api.
Class is using for work with HLL objects. It's implementing a App::Parrot::Create::Base role and expanding its api.
=head1 BUGS
Expand Down
11 changes: 5 additions & 6 deletions lib/Parrot/Library.pm → lib/App/Parrot/Create/Library.pm
@@ -1,10 +1,9 @@
package Parrot::Library;
package App::Parrot::Create::Library;

use v5.10;
use Moose;
use Method::Signatures;

with 'Parrot::Base';
with 'App::Parrot::Create::Base';

method init($name, $build_system, $test_system, $template) {
$self->name($name);
Expand All @@ -25,12 +24,12 @@ __END__
=head1 NAME
Parrot::Library - Moose class for work with parrot library.
App::Parrot::Create::Library - Moose class for work with parrot library.
=head1 SYNOPSIS
#simple using
my $lib = Parrot::Library->new();
my $lib = App::Parrot::Create::Library->new();
$lib->init($name, $builder, $harness, $template);
#generate and return archive
Expand All @@ -57,7 +56,7 @@ __END__
=head1 DESCRIPTION
Class is using for work with Parrot Library objects. It's implementing a Parrot::Base role and expanding its api.
Class is using for work with Parrot Library objects. It's implementing a App::Parrot::Create::Base role and expanding its api.
=head1 BUGS
Expand Down
7 changes: 3 additions & 4 deletions lib/Parrot/Type.pm → lib/App/Parrot/Create/Type.pm
@@ -1,6 +1,5 @@
package Parrot::Type;
package App::Parrot::Create::Type;

use v5.10;
use Moose::Util::TypeConstraints;

use constant {
Expand Down Expand Up @@ -34,7 +33,7 @@ __END__
=head1 NAME
Parrot::Type - basic data types for app-parrot-create project.
App::Parrot::Create::Type - basic data types for app-parrot-create project.
=head1 CONSTANTS
Expand Down Expand Up @@ -69,7 +68,7 @@ __END__
=head1 DESCRIPTION
It's module a provide a new data types, which is using on Parrot::Base.
It's module a provide a new data types, which is using on App::Parrot::Create::Base.
=head1 BUGS
Expand Down
52 changes: 26 additions & 26 deletions t/hll.t
Expand Up @@ -4,133 +4,133 @@ use Test::Mojo;
use FindBin;
require "$FindBin::Bin/../app-parrot-create";
use lib "$FindBin::Bin/../lib"; # install location
use Parrot::HLL;
use App::Parrot::Create::HLL;

ok(my $hll = Parrot::HLL->new(),"Create HLL object");
ok(my $hll = App::Parrot::Create::HLL->new(),"Create HLL object");

my ($name, $builder, $harness, $with_pmc, $with_ops, $with_doc, $template) =
('a',Parrot::Type::WINXED,Parrot::Type::PERL5,1,1,1,"project-templates/hll.parrot");
('a',App::Parrot::Create::Type::WINXED,App::Parrot::Create::Type::PERL5,1,1,1,"project-templates/hll.parrot");
$hll->init($name, $builder, $harness, $with_pmc, $with_ops, $with_doc, $template);
ok(my $archive_path = $hll->generate(),"Winxed build + Perl 5 test with options");

($name, $builder, $harness, $with_pmc, $with_ops, $with_doc, $template) =
('ab',Parrot::Type::WINXED,Parrot::Type::PERL5,0,0,0,"project-templates/hll.parrot");
('ab',App::Parrot::Create::Type::WINXED,App::Parrot::Create::Type::PERL5,0,0,0,"project-templates/hll.parrot");
$hll->init($name, $builder, $harness, $with_pmc, $with_ops, $with_doc, $template);
ok($archive_path = $hll->generate(),"Winxed build + Perl 5 test without options");

($name, $builder, $harness, $with_pmc, $with_ops, $with_doc, $template) =
('abc', Parrot::Type::NQP, Parrot::Type::PERL5,1,1,1,"project-templates/hll.parrot");
('abc', App::Parrot::Create::Type::NQP, App::Parrot::Create::Type::PERL5,1,1,1,"project-templates/hll.parrot");
$hll->init($name, $builder, $harness, $with_pmc, $with_ops, $with_doc, $template);
ok($archive_path = $hll->generate(),"NQP build + Perl 5 test with options");

($name, $builder, $harness, $with_pmc, $with_ops, $with_doc, $template) =
('abcd', Parrot::Type::NQP, Parrot::Type::PERL5,0,0,0,"project-templates/hll.parrot");
('abcd', App::Parrot::Create::Type::NQP, App::Parrot::Create::Type::PERL5,0,0,0,"project-templates/hll.parrot");
$hll->init($name, $builder, $harness, $with_pmc, $with_ops, $with_doc, $template);
ok($archive_path = $hll->generate(),"NQP build + Perl 5 test without options");

($name, $builder, $harness, $with_pmc, $with_ops, $with_doc, $template) =
('abcde', Parrot::Type::PIR, Parrot::Type::PERL5,1,1,1,"project-templates/hll.parrot");
('abcde', App::Parrot::Create::Type::PIR, App::Parrot::Create::Type::PERL5,1,1,1,"project-templates/hll.parrot");
$hll->init($name, $builder, $harness, $with_pmc, $with_ops, $with_doc, $template);
ok($archive_path = $hll->generate(),"PIR build + Perl 5 test with options");

($name, $builder, $harness, $with_pmc, $with_ops, $with_doc, $template) =
('abcdef', Parrot::Type::PIR, Parrot::Type::PERL5,0,0,0,"project-templates/hll.parrot");
('abcdef', App::Parrot::Create::Type::PIR, App::Parrot::Create::Type::PERL5,0,0,0,"project-templates/hll.parrot");
$hll->init($name, $builder, $harness, $with_pmc, $with_ops, $with_doc, $template);
ok($archive_path = $hll->generate(),"PIR build + Perl 5 test without options");

($name, $builder, $harness, $with_pmc, $with_ops, $with_doc, $template) =
('abcdefg', Parrot::Type::PERL5, Parrot::Type::PERL5,1,1,1,"project-templates/hll.parrot");
('abcdefg', App::Parrot::Create::Type::PERL5, App::Parrot::Create::Type::PERL5,1,1,1,"project-templates/hll.parrot");
$hll->init($name, $builder, $harness, $with_pmc, $with_ops, $with_doc, $template);
ok($archive_path = $hll->generate(),"Perl 5 build + Perl 5 test with options");

($name, $builder, $harness, $with_pmc, $with_ops, $with_doc, $template) =
('abcdefgh', Parrot::Type::PERL5, Parrot::Type::PERL5,0,0,0,"project-templates/hll.parrot");
('abcdefgh', App::Parrot::Create::Type::PERL5, App::Parrot::Create::Type::PERL5,0,0,0,"project-templates/hll.parrot");
$hll->init($name, $builder, $harness, $with_pmc, $with_ops, $with_doc, $template);
ok($archive_path = $hll->generate(),"Perl 5 build + Perl 5 test without options");




($name, $builder, $harness, $with_pmc, $with_ops, $with_doc, $template) =
('b',Parrot::Type::WINXED,Parrot::Type::ROSELLA_WINXED,1,1,1,"project-templates/hll.parrot");
('b',App::Parrot::Create::Type::WINXED,App::Parrot::Create::Type::ROSELLA_WINXED,1,1,1,"project-templates/hll.parrot");
$hll->init($name, $builder, $harness, $with_pmc, $with_ops, $with_doc, $template);
ok($archive_path = $hll->generate(),"Winxed build + Rosella(Winxed) test with options");

($name, $builder, $harness, $with_pmc, $with_ops, $with_doc, $template) =
('bc',Parrot::Type::WINXED,Parrot::Type::ROSELLA_WINXED,0,0,0,"project-templates/hll.parrot");
('bc',App::Parrot::Create::Type::WINXED,App::Parrot::Create::Type::ROSELLA_WINXED,0,0,0,"project-templates/hll.parrot");
$hll->init($name, $builder, $harness, $with_pmc, $with_ops, $with_doc, $template);
ok($archive_path = $hll->generate(),"Winxed build + Rosella(Winxed) test without options");

($name, $builder, $harness, $with_pmc, $with_ops, $with_doc, $template) =
('bcd', Parrot::Type::NQP, Parrot::Type::ROSELLA_WINXED,1,1,1,"project-templates/hll.parrot");
('bcd', App::Parrot::Create::Type::NQP, App::Parrot::Create::Type::ROSELLA_WINXED,1,1,1,"project-templates/hll.parrot");
$hll->init($name, $builder, $harness, $with_pmc, $with_ops, $with_doc, $template);
ok($archive_path = $hll->generate(),"NQP build + Rosella(Winxed) test with options");

($name, $builder, $harness, $with_pmc, $with_ops, $with_doc, $template) =
('bcde', Parrot::Type::NQP, Parrot::Type::ROSELLA_WINXED,0,0,0,"project-templates/hll.parrot");
('bcde', App::Parrot::Create::Type::NQP, App::Parrot::Create::Type::ROSELLA_WINXED,0,0,0,"project-templates/hll.parrot");
$hll->init($name, $builder, $harness, $with_pmc, $with_ops, $with_doc, $template);
ok($archive_path = $hll->generate(),"NQP build + Rosella(Winxed) test without options");

($name, $builder, $harness, $with_pmc, $with_ops, $with_doc, $template) =
('bcdef', Parrot::Type::PIR, Parrot::Type::ROSELLA_WINXED,1,1,1,"project-templates/hll.parrot");
('bcdef', App::Parrot::Create::Type::PIR, App::Parrot::Create::Type::ROSELLA_WINXED,1,1,1,"project-templates/hll.parrot");
$hll->init($name, $builder, $harness, $with_pmc, $with_ops, $with_doc, $template);
ok($archive_path = $hll->generate(),"PIR build + Rosella(Winxed) test with options");

($name, $builder, $harness, $with_pmc, $with_ops, $with_doc, $template) =
('bcdefg', Parrot::Type::PIR, Parrot::Type::ROSELLA_WINXED,0,0,0,"project-templates/hll.parrot");
('bcdefg', App::Parrot::Create::Type::PIR, App::Parrot::Create::Type::ROSELLA_WINXED,0,0,0,"project-templates/hll.parrot");
$hll->init($name, $builder, $harness, $with_pmc, $with_ops, $with_doc, $template);
ok($archive_path = $hll->generate(),"PIR build + Rosella(Winxed) test without options");

($name, $builder, $harness, $with_pmc, $with_ops, $with_doc, $template) =
('bcdfgh', Parrot::Type::PERL5, Parrot::Type::ROSELLA_WINXED,1,1,1,"project-templates/hll.parrot");
('bcdfgh', App::Parrot::Create::Type::PERL5, App::Parrot::Create::Type::ROSELLA_WINXED,1,1,1,"project-templates/hll.parrot");
$hll->init($name, $builder, $harness, $with_pmc, $with_ops, $with_doc, $template);
ok($archive_path = $hll->generate(),"Perl 5 build + Perl 5 test with options");

($name, $builder, $harness, $with_pmc, $with_ops, $with_doc, $template) =
('bcdfghk', Parrot::Type::PERL5, Parrot::Type::ROSELLA_WINXED,0,0,0,"project-templates/hll.parrot");
('bcdfghk', App::Parrot::Create::Type::PERL5, App::Parrot::Create::Type::ROSELLA_WINXED,0,0,0,"project-templates/hll.parrot");
$hll->init($name, $builder, $harness, $with_pmc, $with_ops, $with_doc, $template);
ok($archive_path = $hll->generate(),"Perl 5 build + Perl 5 test without options");




($name, $builder, $harness, $with_pmc, $with_ops, $with_doc, $template) =
('c',Parrot::Type::WINXED,Parrot::Type::ROSELLA_NQP,1,1,1,"project-templates/hll.parrot");
('c',App::Parrot::Create::Type::WINXED,App::Parrot::Create::Type::ROSELLA_NQP,1,1,1,"project-templates/hll.parrot");
$hll->init($name, $builder, $harness, $with_pmc, $with_ops, $with_doc, $template);
ok($archive_path = $hll->generate(),"Winxed build + Rosella(Winxed) test with options");

($name, $builder, $harness, $with_pmc, $with_ops, $with_doc, $template) =
('cd',Parrot::Type::WINXED,Parrot::Type::ROSELLA_NQP,0,0,0,"project-templates/hll.parrot");
('cd',App::Parrot::Create::Type::WINXED,App::Parrot::Create::Type::ROSELLA_NQP,0,0,0,"project-templates/hll.parrot");
$hll->init($name, $builder, $harness, $with_pmc, $with_ops, $with_doc, $template);
ok($archive_path = $hll->generate(),"Winxed build + Rosella(Winxed) test without options");

($name, $builder, $harness, $with_pmc, $with_ops, $with_doc, $template) =
('cde', Parrot::Type::NQP, Parrot::Type::ROSELLA_NQP,1,1,1,"project-templates/hll.parrot");
('cde', App::Parrot::Create::Type::NQP, App::Parrot::Create::Type::ROSELLA_NQP,1,1,1,"project-templates/hll.parrot");
$hll->init($name, $builder, $harness, $with_pmc, $with_ops, $with_doc, $template);
ok($archive_path = $hll->generate(),"NQP build + Rosella(Winxed) test with options");

($name, $builder, $harness, $with_pmc, $with_ops, $with_doc, $template) =
('cdef', Parrot::Type::NQP, Parrot::Type::ROSELLA_NQP,0,0,0,"project-templates/hll.parrot");
('cdef', App::Parrot::Create::Type::NQP, App::Parrot::Create::Type::ROSELLA_NQP,0,0,0,"project-templates/hll.parrot");
$hll->init($name, $builder, $harness, $with_pmc, $with_ops, $with_doc, $template);
ok($archive_path = $hll->generate(),"NQP build + Rosella(Winxed) test without options");

($name, $builder, $harness, $with_pmc, $with_ops, $with_doc, $template) =
('cdefg', Parrot::Type::PIR, Parrot::Type::ROSELLA_NQP,1,1,1,"project-templates/hll.parrot");
('cdefg', App::Parrot::Create::Type::PIR, App::Parrot::Create::Type::ROSELLA_NQP,1,1,1,"project-templates/hll.parrot");
$hll->init($name, $builder, $harness, $with_pmc, $with_ops, $with_doc, $template);
ok($archive_path = $hll->generate(),"PIR build + Rosella(Winxed) test with options");

($name, $builder, $harness, $with_pmc, $with_ops, $with_doc, $template) =
('cdefgh', Parrot::Type::PIR, Parrot::Type::ROSELLA_NQP,0,0,0,"project-templates/hll.parrot");
('cdefgh', App::Parrot::Create::Type::PIR, App::Parrot::Create::Type::ROSELLA_NQP,0,0,0,"project-templates/hll.parrot");
$hll->init($name, $builder, $harness, $with_pmc, $with_ops, $with_doc, $template);
ok($archive_path = $hll->generate(),"PIR build + Rosella(Winxed) test without options");

($name, $builder, $harness, $with_pmc, $with_ops, $with_doc, $template) =
('cdefghk', Parrot::Type::PERL5, Parrot::Type::ROSELLA_NQP,1,1,1,"project-templates/hll.parrot");
('cdefghk', App::Parrot::Create::Type::PERL5, App::Parrot::Create::Type::ROSELLA_NQP,1,1,1,"project-templates/hll.parrot");
$hll->init($name, $builder, $harness, $with_pmc, $with_ops, $with_doc, $template);
ok($archive_path = $hll->generate(),"Perl 5 build + Perl 5 test with options");

($name, $builder, $harness, $with_pmc, $with_ops, $with_doc, $template) =
('cdefghkm', Parrot::Type::PERL5, Parrot::Type::ROSELLA_NQP,0,0,0,"project-templates/hll.parrot");
('cdefghkm', App::Parrot::Create::Type::PERL5, App::Parrot::Create::Type::ROSELLA_NQP,0,0,0,"project-templates/hll.parrot");
$hll->init($name, $builder, $harness, $with_pmc, $with_ops, $with_doc, $template);
ok($archive_path = $hll->generate(),"Perl 5 build + Perl 5 test without options");

Expand Down

1 comment on commit 0af0e43

@leto
Copy link
Member

@leto leto commented on 0af0e43 Sep 21, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! With this, we can release to CPAN much sooner.

Please sign in to comment.