Example #1
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()
Example #2
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()
Example #3
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()
Example #4
0
def start():
    if check_for_setup() is False:
        return
    print("START")
    cbpi = CraftBeerPi()
    cbpi.start()
Example #5
0
 def start(self):
     if self.config.check_for_setup() is False:
         return
     print("START")
     cbpi = CraftBeerPi(self.config)
     cbpi.start()
Example #6
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()