Example #1
0
def run():
    sys.argv.insert(1, "serve")
    if len(sys.argv) <= 2:
        # set default file
        config_file_path = os.path.join(os.getcwd(), "config.py")
        sys.argv.append(config_file_path)
    from pecan.commands import CommandRunner
    CommandRunner.handle_command_line()
 def test_run(self):
     from pecan.commands import CommandRunner
     runner = CommandRunner()
     self.assertRaises(
         RuntimeError,
         runner.run,
         ['serve', 'missing_file.py']
     )
 def test_commands(self):
     from pecan.commands import (
         ServeCommand, ShellCommand, CreateCommand, CommandRunner
     )
     runner = CommandRunner()
     assert runner.commands['serve'] == ServeCommand
     assert runner.commands['shell'] == ShellCommand
     assert runner.commands['create'] == CreateCommand
Example #4
0
from pecan.commands import CommandRunner

runner = CommandRunner()
runner.run(['serve', 'config.py'])
Example #5
0
def main():
    dir_name = os.path.dirname(__file__)
    drive, path_and_file = os.path.splitdrive(dir_name)
    path, filename = os.path.split(path_and_file)
    runner = CommandRunner()
    runner.run(['serve', path + '/config.py'])
Example #6
0
from pecan.commands import CommandRunner

if __name__ == '__main__':
    CommandRunner.handle_command_line()
Example #7
0
#../bin/python2

# -*- coding: utf-8 -*-
import re
import sys

from pecan.commands import CommandRunner

if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
    sys.exit(CommandRunner.handle_command_line())