Changeset 8492

Show
Ignore:
Timestamp:
03/29/08 12:28:40 (6 years ago)
Author:
tomyhero
Message:

lang/perl/App-Starter : pod fix

Location:
lang/perl/App-Starter/trunk
Files:
1 added
2 modified
1 moved

Legend:

Unmodified
Added
Removed
  • lang/perl/App-Starter/trunk/bin/app-starter.pl

    r8490 r8492  
    66use App::Starter; 
    77use Getopt::Long; 
     8use Pod::Usage; 
    89 
    9 my %opt; 
    10 GetOptions( \%opt, 'config=s' , 'name=s' , 'template=s' ); 
     10 
     11GetOptions( \my %opt, 'config=s' , 'name=s' , 'template=s' ); 
     12 
    1113App::Starter->new( { config => $opt{config} , name => $opt{name} , template => $opt{template}  } )->create; 
    1214 
     
    2224 app-script.pl --config conf/your-config.yml --name my_application 
    2325 
    24  #or even  
     26 #or you can use ~/.app-starter/skell/your_skel  ~/.app-starter/conf/your_skel.yml with --template setting 
    2527  
    2628 app-script.pl --template your_skel  --name my_application 
  • lang/perl/App-Starter/trunk/lib/App/Starter.pm

    r8491 r8492  
    1313use base qw/Class::Accessor/; 
    1414 
    15 our $VERSION = '0.04'; 
     15our $VERSION = '0.06'; 
    1616 
    1717my $DIR = {}; 
    1818 
    19 __PACKAGE__->mk_accessors(qw/config name from replace ignore tag_style template/); 
     19__PACKAGE__->mk_accessors( 
     20    qw/config name from replace ignore tag_style template/); 
    2021 
    2122sub create { 
     
    2930    $config->{name}      = $self->{name}      if $self->{name}; 
    3031    $config->{tag_style} = $self->{tag_style} if $self->{tag_style}; 
    31     $config->{template}  = $self->{template} if $self->{template}; 
     32    $config->{template}  = $self->{template}  if $self->{template}; 
    3233 
    3334    if ( $config->{template} ) { 
    34         $config->{from}     = File::Spec->catfile( $ENV{HOME} , '/.app-starter/skel', $config->{template} ) ; 
    35         $self->{config} =  File::Spec->catfile( $ENV{HOME} , '/.app-starter/conf' , $config->{template} . '.yml' ); 
    36     }; 
     35        $config->{from} 
     36            = File::Spec->catfile( $ENV{HOME}, '/.app-starter/skel', 
     37            $config->{template} ); 
     38 
     39        my $conf_file = ''; 
     40        if (-e  File::Spec->catfile( $ENV{HOME}, '/.app-starter/conf', $config->{template} . '.yml' ) ) { 
     41            $conf_file =  File::Spec->catfile( $ENV{HOME}, '/.app-starter/conf', $config->{template} . '.yml' ) ;     
     42        } 
     43        else { 
     44            $conf_file = File::Spec->catfile(  $ENV{HOME}, '/.app-starter/conf', $config->{template} . '.yaml' ); 
     45        } 
     46 
     47        $self->{config} = $conf_file ; 
     48    } 
    3749 
    3850    if ( $self->{config} ) { 
     
    4456    my $name      = $config->{name}; 
    4557    my $tag_style = $config->{tag_style} || 'template'; 
    46  
    47  
    4858 
    4959    # check 
     
    121131=head1 SYNPSYS 
    122132 
    123  my $app = App::Starter->new( { config => ' /home/tomyhero/work/App-Starter/conf/config.yaml' } )->create; 
     133 
     134 my $app = App::Starter->new( { config => ' /home/tomyhero/work/App-Starter/conf/config.yml' } )->create; 
     135 
     136 # or 
     137 # from = 'tmp/a' , replace => { module => 'MyApp' } overwrite config.yml setting. 
     138 my $app = App::Starter->new( { config => ' /home/tomyhero/work/App-Starter/conf/config.yml' ,  from => '/tmp/a' , name => 'my_app' , replace => { module => 'MyApp' } } )->create; 
    124139  
    125  # or 
     140 # or even you can use ~/.app-sterter  
    126141 
    127  my $app = App::Starter->new( { config => ' /home/tomyhero/work/App-Starter/conf/config.yaml' ,  from => '/tmp/a' , name => 'my_app' , replace => { module => 'MyApp' } } )->create; 
    128   
    129  # or 
    130  # This setting map to ~/.app-starter/skell/pand/* as from and ~/.app-starter/conf/panda.yml  as config 
    131  my $app = App::Starter->new( { template => 'panda' , name =>'foo'  } )->create; 
     142 #~/.app-starter 
     143 #|-- conf 
     144 #|   `-- sample.conf 
     145 #`-- skel 
     146 #    `-- sample 
     147 #        |-- bin 
     148 #        |   `-- __app__.pl 
     149 #        `-- lib 
     150 #            `-- __app__ 
     151 #                `-- Foo.pm 
     152 my $app = App::Starter->new( { template => 'sample' , name =>'foo'  } )->create; 
    132153 
    133154=head1 DESCRIPTION 
    134155 
    135 you can start your project easier once you craete start files with this module. This module only does is rename key to value. in your template file , you can set like this  [% key_name %] 
     156you can start your application quickly once you craete skelton with this module. This module only does is rename key to value. in your template file , you can set like this  [% key_name %] 
    136157which replace with value you set in config. and also you can use __key_name__ format as file or directory name which replace as rule you set at config 
    137158 
    138159=head1 CONFIG 
    139160 
    140  name    : my_app 
    141  from    : /foo/bar/my-skell 
    142  # tag_style : star # SEE ALSO L<Template> TAG_STYLE OPTION 
    143  ignore  : 
     161 name    : my_app  # ${current_dir}/my_app is created as new appication skelton 
     162 from    : /foo/bar/my-skell # where to fine your skel setup. if you use ~/.app-starter then you do not need this. 
     163 tag_style : star # SEE ALSO L<Template> TAG_STYLE OPTION 
     164 ignore  :   # you want to ignore some of files or directories 
    144165    - \.svn 
    145166    - \.cvs 
    146  replace : 
     167 replace :   # rule for replace key : value  
    147168    module : MyApp 
    148169 
     
    151172=head2 new 
    152173 
    153 constractor 
     174 constractor 
    154175 
    155176=head2 create