diff options
author | Six <unknown> | 2011-05-03 21:02:56 -0400 |
---|---|---|
committer | Six <unknown> | 2011-05-03 21:02:56 -0400 |
commit | 43e904ceedbc363980d4c1caaf3d0b2b2d6b6cff (patch) | |
tree | d972ce73d5f2ce6c64b2775a490fe77c09b00a6e | |
parent | 9302855a3d4a8bfbd4b4e5e09857380a6012fe82 (diff) | |
download | d2-43e904ceedbc363980d4c1caaf3d0b2b2d6b6cff.tar.bz2 d2-43e904ceedbc363980d4c1caaf3d0b2b2d6b6cff.tar.xz d2-43e904ceedbc363980d4c1caaf3d0b2b2d6b6cff.zip |
added index directory to the setup scripts
-rw-r--r-- | lib/d2/bin/d2_setup.py | 12 | ||||
-rw-r--r-- | lib/d2/config/locations.py | 13 |
2 files changed, 22 insertions, 3 deletions
diff --git a/lib/d2/bin/d2_setup.py b/lib/d2/bin/d2_setup.py index f36c199..d201333 100644 --- a/lib/d2/bin/d2_setup.py +++ b/lib/d2/bin/d2_setup.py | |||
@@ -33,6 +33,7 @@ class Args(object): | |||
33 | def __call__(self): | 33 | def __call__(self): |
34 | self._config_directory() | 34 | self._config_directory() |
35 | self._data_directory() | 35 | self._data_directory() |
36 | self._index_directory() | ||
36 | self._log_directory() | 37 | self._log_directory() |
37 | self._log_level() | 38 | self._log_level() |
38 | self._webserver_port() | 39 | self._webserver_port() |
@@ -71,6 +72,15 @@ class Args(object): | |||
71 | 'files: (default: %(default)s)' | 72 | 'files: (default: %(default)s)' |
72 | ) | 73 | ) |
73 | 74 | ||
75 | def _index_directory(self): | ||
76 | self.parser.add_argument( | ||
77 | '--index-directory', | ||
78 | type=str, | ||
79 | default=self.locations.index_directory, | ||
80 | help='The directory that will contain the index (search) '\ | ||
81 | 'files: (default: %(default)s)' | ||
82 | ) | ||
83 | |||
74 | def _log_directory(self): | 84 | def _log_directory(self): |
75 | self.parser.add_argument( | 85 | self.parser.add_argument( |
76 | '--log-directory', | 86 | '--log-directory', |
@@ -306,9 +316,9 @@ class ConfigFile(BaseFilesystem): | |||
306 | sec = 'directories' | 316 | sec = 'directories' |
307 | config.add_section(sec) | 317 | config.add_section(sec) |
308 | config.set(sec, 'data', args.data_directory) | 318 | config.set(sec, 'data', args.data_directory) |
319 | config.set(sec, 'index', args.index_directory) | ||
309 | 320 | ||
310 | def _build_log_section(self, config, args): | 321 | def _build_log_section(self, config, args): |
311 | |||
312 | filename = LogFile.filename(args) | 322 | filename = LogFile.filename(args) |
313 | sec = 'log' | 323 | sec = 'log' |
314 | config.add_section(sec) | 324 | config.add_section(sec) |
diff --git a/lib/d2/config/locations.py b/lib/d2/config/locations.py index 925cf17..7967d0d 100644 --- a/lib/d2/config/locations.py +++ b/lib/d2/config/locations.py | |||
@@ -10,7 +10,8 @@ class Locations(object): | |||
10 | LOG_FILE = '{project}.log' | 10 | LOG_FILE = '{project}.log' |
11 | CONFIG_FILE = 'config' | 11 | CONFIG_FILE = 'config' |
12 | TEMPLATES = 'templates' | 12 | TEMPLATES = 'templates' |
13 | STATIC= 'static' | 13 | STATIC = 'static' |
14 | INDEX = 'index' | ||
14 | 15 | ||
15 | def __init__(self, project): | 16 | def __init__(self, project): |
16 | self.project = project | 17 | self.project = project |
@@ -22,6 +23,7 @@ class Locations(object): | |||
22 | self._config_file_ = None | 23 | self._config_file_ = None |
23 | self._log_file_ = None | 24 | self._log_file_ = None |
24 | self._static_directory_ = None | 25 | self._static_directory_ = None |
26 | self._index_directory_ = None | ||
25 | 27 | ||
26 | @property | 28 | @property |
27 | def home_directory(self): | 29 | def home_directory(self): |
@@ -64,6 +66,13 @@ class Locations(object): | |||
64 | return self._data_directory_ | 66 | return self._data_directory_ |
65 | 67 | ||
66 | @property | 68 | @property |
69 | def index_directory(self): | ||
70 | if not self._index_directory_: | ||
71 | self._index_directory_ = os.path.join(self.data_directory, | ||
72 | self.INDEX) | ||
73 | return self._index_directory_ | ||
74 | |||
75 | @property | ||
67 | def template_directory(self): | 76 | def template_directory(self): |
68 | """The directory that holds the html templates used by tornado | 77 | """The directory that holds the html templates used by tornado |
69 | """ | 78 | """ |
@@ -118,4 +127,4 @@ class Locations(object): | |||
118 | def load(cls, project=None): | 127 | def load(cls, project=None): |
119 | if not project: | 128 | if not project: |
120 | project = 'd2' | 129 | project = 'd2' |
121 | return cls(project) \ No newline at end of file | 130 | return cls(project) |