Package ajango :: Package contrib :: Package automatic :: Package management :: Package commands :: Module generateapps
[hide private]
[frames] | no frames]

Source Code for Module ajango.contrib.automatic.management.commands.generateapps

 1  ########################################################################### 
 2  #                                                                         # 
 3  #  Copyright (C) 2016  Rafal Kobel <rafyco1@gmail.com>                    # 
 4  #                                                                         # 
 5  #  This program is free software: you can redistribute it and/or modify   # 
 6  #  it under the terms of the GNU General Public License as published by   # 
 7  #  the Free Software Foundation, either version 3 of the License, or      # 
 8  #  (at your option) any later version.                                    # 
 9  #                                                                         # 
10  #  This program is distributed in the hope that it will be useful,        # 
11  #  but WITHOUT ANY WARRANTY; without even the implied warranty of         # 
12  #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the           # 
13  #  GNU General Public License for more details.                           # 
14  #                                                                         # 
15  #  You should have received a copy of the GNU General Public License      # 
16  #  along with this program.  If not, see <http://www.gnu.org/licenses/>.  # 
17  #                                                                         # 
18  ########################################################################### 
19  """ 
20  Polecenie generujace aplikacje na podstawie szkieletu. 
21   
22  Polecenie pozwala na wygenerowanie aplikacji na podstawie pliku szablonu. 
23  Aplikacja wymaga do poprawnego dzialania zainstalowanej biblioteki I{Ajango} 
24  Wiecej informacji na ten temat w L{ajango}. 
25   
26  Skladnia polecenia 
27  ================== 
28   
29  Przykladowe wywolanie polecenia:: 
30   
31      $ python manager.py generateapps 
32   
33  Generator skorzysta domyslnie z pliku U{skeleton.xml}. Mozna to ustawienie 
34  zmienic wywolujac polecenie z flaga C{-f} po ktorej podana powinna byc nazwa 
35  pliku z szablonem. 
36   
37  Nalezy zwrocic uwage na to iz Ajagno nie jest w stanie wygenerowac aplikacji 
38  w katalogu w ktorym sie znajduje. W przypadku testowania dzialania generatora 
39  zaleca sie wykonanie kopi zapasowej katalogu projektowego oraz podmienianie go 
40  przed kolejnym generowaniem aplikacji. 
41  """ 
42   
43  from django.core.management.base import BaseCommand 
44  from ajango.generator            import AjangoGenerator 
45   
46 -class Command(BaseCommand):
47 """ 48 Generowanie aplikacji na podstawie szkieletu. 49 50 Polecenie generuje aplikacje na postawie szkieletu. Jest on domyslnie 51 przechowywany w pliku I{skeleton.xml} i moze byc ustawiony flaga C{-f} lub 52 C{--file}. 53 """ 54 help = ("Generate application from specyfic xml file.")
55 - def add_arguments(self, parser):
56 """ Definiowanie argumentow. """ 57 parser.add_argument( 58 '-f', '--file', 59 action='store', dest='skeleton_file', default='skeleton.xml', 60 help='Path to file with skeleton', 61 ) 62 parser.add_argument( 63 '-p', '--project', 64 action='store', dest='project_name', default='project', 65 help='Name of actual project', 66 )
67 - def handle(self, **options):
68 """ Obsluga polecenia. """ 69 skeleton_file = options['skeleton_file'] 70 project_name = options['project_name'] 71 options['extensions'] = ['py'] 72 options['files'] = [] 73 options['template'] = None 74 generator = AjangoGenerator(project_name, skeleton_file) 75 generator.set_options(options) 76 generator.make_apps()
77