| | 164 | |
|---|
| | 165 | |
|---|
| | 166 | # Method to create a standard Dabo directory structure layout |
|---|
| | 167 | def makeDaboDirectories(homedir=None): |
|---|
| | 168 | """If homedir is passes, the directories will be created off of that |
|---|
| | 169 | directory. Otherwise, it is assumed that they should be created |
|---|
| | 170 | in the current directory location. |
|---|
| | 171 | """ |
|---|
| | 172 | currLoc = os.getcwd() |
|---|
| | 173 | if homedir is not None: |
|---|
| | 174 | os.chdir(homedir) |
|---|
| | 175 | for d in ("biz", "db", "ui", "resources", "reports"): |
|---|
| | 176 | if not os.path.exists(d): |
|---|
| | 177 | os.mkdir(d) |
|---|
| | 178 | os.chdir(currLoc) |
|---|
| | 179 | |
|---|
| | 180 | |
|---|
| | 181 | def quickStart(homedir=None): |
|---|
| | 182 | """This creates a bare-bones application in either the specified |
|---|
| | 183 | directory, or the current one if none is specified. |
|---|
| | 184 | """ |
|---|
| | 185 | currLoc = os.getcwd() |
|---|
| | 186 | if homedir is not None: |
|---|
| | 187 | os.chdir(homedir) |
|---|
| | 188 | makeDaboDirectories() |
|---|
| | 189 | open("main.py", "w").write("""#!/usr/bin/env python |
|---|
| | 190 | # -*- coding: utf-8 -*- |
|---|
| | 191 | import dabo |
|---|
| | 192 | |
|---|
| | 193 | app = dabo.dApp() |
|---|
| | 194 | app.start() |
|---|
| | 195 | """) |
|---|
| | 196 | os.chmod("main.py", 0744) |
|---|
| | 197 | os.chdir(currLoc) |
|---|
| | 198 | |
|---|