def run(self): # PUT YOUR POST-INSTALL SCRIPT HERE or CALL A FUNCTION install.run(self) from rogue.commands import init from rogue.utilities import console console.info("Prepare rogue environnement") init.init(".")
def init(glob, local): """Add rogue configuration""" console.info("Read rogue environment") if glob: path = DEFAULT_CONFIG_FILE elif local: path = '.' else: path = '.' path = os.path.join(path, ".rogue.cfg") api_config.controler.initialize(path)
def show(glob, local): """Add rogue configuration""" console.info("Read rogue environment") if glob: path = DEFAULT_CONFIG_FILE elif local: path = '.' else: path = '.' path = os.path.join(path, ".rogue.cfg") cfg = api_config.controler.read(path) console.show_config(cfg)
def add(options, glob, local): """Add rogue configuration""" console.info("Add rogue environment") if glob: path = DEFAULT_CONFIG_FILE elif local: path = '.' else: path = '.' path = os.path.join(path, ".rogue.cfg") api_config.add.add(path, options) print("ici")
def remove(project, config): console.info("Your projects:") context = api_config.read(config.name) default = dict(context['default_project']) basedir = default['basedir'] if not os.path.isdir(basedir): console.error("Configuration basedir not defined") console.error( "rogue-config add default_project.basedir <yourdir> --global") return choice = os.path.join(basedir, project) console.info("remove {}".format(choice)) shutil.rmtree(choice)
def open(project, config): console.info("Your projects:") context = api_config.read(config.name) default = dict(context['default_project']) basedir = default['basedir'] if not os.path.isdir(basedir): console.error("Configuration basedir not defined") console.error( "rogue-config add default_project.basedir <yourdir> --global") return choice = os.path.join(basedir, project) console.info("open {}".format(choice)) os.chdir(choice) print(os.getcwd())
def list(config, realtime, timer): console.info("Your projects:") context = api_config.read(config.name) default = dict(context['default_project']) basedir = default['basedir'] if not os.path.isdir(basedir): console.error("Configuration basedir not defined") console.error( "rogue-config add default_project.basedir <yourdir> --global") return if realtime: while True: click.clear() display_list(basedir) console.info("refresh every {}s".format(timer)) time.sleep(timer) display_list(basedir)
def init(path): """Initialize rogue environment""" console.info("Initialize rogue environment") path = os.path.join(path, '.rogue.cfg') config.initialize(path)