Beispiel #1
0
class NotificationTestCase(AioHTTPTestCase):
    async def get_application(self):
        self.cbpi = CraftBeerPi()
        await self.cbpi.init_serivces()
        return self.cbpi.app

    @unittest_run_loop
    async def test_actor_switch(self):
        self.cbpi.notify("test", "test")
Beispiel #2
0
def main():
    #import sys
    #arg1, arg2 = sys.argv[1], sys.argv[2]


    create_home_folder_structure()
    create_plugin_file()
    create_config_file()

    #logging.basicConfig(level=logging.INFO, filename='./logs/app.log', filemode='a', format='%(asctime)s - %(levelname)s - %(name)s - %(message)s')
    logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(name)s - %(message)s')

    cbpi = CraftBeerPi()
    cbpi.start()
Beispiel #3
0
def main():

    parser = argparse.ArgumentParser(description='Welcome to CraftBeerPi 4')
    parser.add_argument("action",
                        type=str,
                        help="start,stop,restart,setup,plugins")
    parser.add_argument("--name", type=str, help="Plugin name")
    args = parser.parse_args()
    #logging.basicConfig(level=logging.INFO, filename='./logs/app.log', filemode='a', format='%(asctime)s - %(levelname)s - %(name)s - %(message)s')
    logging.basicConfig(
        level=logging.INFO,
        format='%(asctime)s - %(levelname)s - %(name)s - %(message)s')

    if args.action == "setup":
        print("Setting up CBPi")
        create_home_folder_structure()
        create_plugin_file()
        create_config_file()
        copy_splash()
        return

    if args.action == "cleardb":
        clear_db()
        return

    if args.action == "plugins":
        list_plugins()
        return

    if args.action == "add":

        add(args.name)
        return

    if args.action == "remove":
        remove(args.name)
        return

    if args.action == "start":
        if check_for_setup() is False:
            return

        cbpi = CraftBeerPi()
        cbpi.start()
        return

    parser.print_help()
Beispiel #4
0
def main():
    parser = argparse.ArgumentParser(description='Welcome to CraftBeerPi 4')
    parser.add_argument("action", type=str, help="start,stop,restart,setup")

    args = parser.parse_args()

    #logging.basicConfig(level=logging.INFO, filename='./logs/app.log', filemode='a', format='%(asctime)s - %(levelname)s - %(name)s - %(message)s')
    logging.basicConfig(
        level=logging.INFO,
        format='%(asctime)s - %(levelname)s - %(name)s - %(message)s')

    if args.action == "setup":
        create_home_folder_structure()
        create_plugin_file()
        create_config_file()
        copy_splash()

    if args.action == "start":

        cbpi = CraftBeerPi()
        cbpi.start()

    parser.print_help()
Beispiel #5
0
 async def get_application(self):
     self.cbpi = CraftBeerPi()
     await self.cbpi.init_serivces()
     return self.cbpi.app
Beispiel #6
0
def start():
    if check_for_setup() is False:
        return
    print("START")
    cbpi = CraftBeerPi()
    cbpi.start()
Beispiel #7
0
 def start(self):
     if self.config.check_for_setup() is False:
         return
     print("START")
     cbpi = CraftBeerPi(self.config)
     cbpi.start()
Beispiel #8
0
from cbpi.craftbeerpi import CraftBeerPi
import os

if __name__ == '__main__':
    if os.path.exists(os.path.join(".", "config", "config.yaml")) is False:
        print("***************************************************")
        print("CraftBeerPi Config File not found: %s" %
              os.path.join(".", "config", "config.yaml"))
        print("Please run 'cbpi setup' before starting the server ")
        print("***************************************************")
    else:
        with open("test.txt", 'w') as f:
            f.write("I ran and the curDir is: " + os.path.realpath(os.curdir))
        print("START")
        cbpi = CraftBeerPi()
        cbpi.start()
 async def get_application(self):
     self.config_folder = self.configuration()
     self.cbpi = CraftBeerPi(self.config_folder)
     await self.cbpi.init_serivces()
     return self.cbpi.app