Changeset 8492 for lang/perl/App-Starter
- Timestamp:
- 03/29/08 12:28:40 (8 months ago)
- Location:
- lang/perl/App-Starter/trunk
- Files:
-
- 1 added
- 2 modified
- 1 moved
-
bin/app-starter-catalyst.pl (added)
-
bin/app-starter.pl (modified) (2 diffs)
-
lib/App/Starter.pm (modified) (5 diffs)
-
sample/skel/app-catalyst (moved) (moved from lang/perl/App-Starter/trunk/sample/skel/oreore-catalyst)
Legend:
- Unmodified
- Added
- Removed
-
lang/perl/App-Starter/trunk/bin/app-starter.pl
r8490 r8492 6 6 use App::Starter; 7 7 use Getopt::Long; 8 use Pod::Usage; 8 9 9 my %opt; 10 GetOptions( \%opt, 'config=s' , 'name=s' , 'template=s' ); 10 11 GetOptions( \my %opt, 'config=s' , 'name=s' , 'template=s' ); 12 11 13 App::Starter->new( { config => $opt{config} , name => $opt{name} , template => $opt{template} } )->create; 12 14 … … 22 24 app-script.pl --config conf/your-config.yml --name my_application 23 25 24 #or even26 #or you can use ~/.app-starter/skell/your_skel ~/.app-starter/conf/your_skel.yml with --template setting 25 27 26 28 app-script.pl --template your_skel --name my_application -
lang/perl/App-Starter/trunk/lib/App/Starter.pm
r8491 r8492 13 13 use base qw/Class::Accessor/; 14 14 15 our $VERSION = '0.0 4';15 our $VERSION = '0.06'; 16 16 17 17 my $DIR = {}; 18 18 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/); 20 21 21 22 sub create { … … 29 30 $config->{name} = $self->{name} if $self->{name}; 30 31 $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}; 32 33 33 34 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 } 37 49 38 50 if ( $self->{config} ) { … … 44 56 my $name = $config->{name}; 45 57 my $tag_style = $config->{tag_style} || 'template'; 46 47 48 58 49 59 # check … … 121 131 =head1 SYNPSYS 122 132 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; 124 139 125 # or 140 # or even you can use ~/.app-sterter 126 141 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; 132 153 133 154 =head1 DESCRIPTION 134 155 135 you can start your project easier once you craete start fileswith this module. This module only does is rename key to value. in your template file , you can set like this [% key_name %]156 you 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 %] 136 157 which 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 137 158 138 159 =head1 CONFIG 139 160 140 name : my_app 141 from : /foo/bar/my-skell 142 #tag_style : star # SEE ALSO L<Template> TAG_STYLE OPTION143 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 144 165 - \.svn 145 166 - \.cvs 146 replace : 167 replace : # rule for replace key : value 147 168 module : MyApp 148 169 … … 151 172 =head2 new 152 173 153 constractor174 constractor 154 175 155 176 =head2 create
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)