Show More
@@ -0,0 +1,76 b'' | |||
|
1 | # -*- coding: utf-8 -*- | |
|
2 | """ | |
|
3 | rhodecode.lib.paster_commands.ishell | |
|
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
|
5 | ||
|
6 | interactive shell paster command for RhodeCode | |
|
7 | ||
|
8 | ||
|
9 | :created_on: Apr 4, 2013 | |
|
10 | :author: marcink | |
|
11 | :copyright: (C) 2010-2013 Marcin Kuzminski <marcin@python-works.com> | |
|
12 | :license: GPLv3, see COPYING for more details. | |
|
13 | """ | |
|
14 | # This program is free software: you can redistribute it and/or modify | |
|
15 | # it under the terms of the GNU General Public License as published by | |
|
16 | # the Free Software Foundation, either version 3 of the License, or | |
|
17 | # (at your option) any later version. | |
|
18 | # | |
|
19 | # This program is distributed in the hope that it will be useful, | |
|
20 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
|
21 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
|
22 | # GNU General Public License for more details. | |
|
23 | # | |
|
24 | # You should have received a copy of the GNU General Public License | |
|
25 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
|
26 | from __future__ import with_statement | |
|
27 | ||
|
28 | import os | |
|
29 | import sys | |
|
30 | import logging | |
|
31 | ||
|
32 | from os.path import dirname as dn, join as jn | |
|
33 | #to get the rhodecode import | |
|
34 | rc_path = dn(dn(dn(os.path.realpath(__file__)))) | |
|
35 | sys.path.append(rc_path) | |
|
36 | from rhodecode.lib.utils import BasePasterCommand | |
|
37 | ||
|
38 | ||
|
39 | log = logging.getLogger(__name__) | |
|
40 | ||
|
41 | ||
|
42 | class Command(BasePasterCommand): | |
|
43 | ||
|
44 | max_args = 1 | |
|
45 | min_args = 1 | |
|
46 | ||
|
47 | usage = "CONFIG_FILE" | |
|
48 | group_name = "RhodeCode" | |
|
49 | takes_config_file = -1 | |
|
50 | parser = BasePasterCommand.standard_parser(verbose=True) | |
|
51 | summary = "Interactive shell" | |
|
52 | ||
|
53 | def command(self): | |
|
54 | #get SqlAlchemy session | |
|
55 | self._init_session() | |
|
56 | ||
|
57 | # imports, used in ipython shell | |
|
58 | import os | |
|
59 | import sys | |
|
60 | import time | |
|
61 | import shutil | |
|
62 | import datetime | |
|
63 | from rhodecode.model.db import * | |
|
64 | ||
|
65 | try: | |
|
66 | from IPython import embed | |
|
67 | from IPython.config.loader import Config | |
|
68 | cfg = Config() | |
|
69 | cfg.InteractiveShellEmbed.confirm_exit = False | |
|
70 | embed(config=cfg, banner1="RhodeCode IShell.") | |
|
71 | except ImportError: | |
|
72 | print 'ipython installation required for ishell' | |
|
73 | sys.exit(-1) | |
|
74 | ||
|
75 | def update_parser(self): | |
|
76 | pass |
@@ -165,6 +165,7 b' setup(' | |||
|
165 | 165 | make-rcext=rhodecode.lib.paster_commands.make_rcextensions:Command |
|
166 | 166 | repo-scan=rhodecode.lib.paster_commands.repo_scan:Command |
|
167 | 167 | cache-keys=rhodecode.lib.paster_commands.cache_keys:Command |
|
168 | ishell=rhodecode.lib.paster_commands.ishell:Command | |
|
168 | 169 | make-index=rhodecode.lib.indexers:MakeIndex |
|
169 | 170 | upgrade-db=rhodecode.lib.dbmigrate:UpgradeDb |
|
170 | 171 | celeryd=rhodecode.lib.celerypylons.commands:CeleryDaemonCommand |
General Comments 0
You need to be logged in to leave comments.
Login now