コード例 #1
0
 async def init(self):
     """
     Load raw json config
     """
     phrase = Phrase()
     self.config = raw_config
     success_msg('config initialized')
コード例 #2
0
ファイル: init.py プロジェクト: SocialInfluenceToken/tron-cli
 async def move_jars(self):
     shutil.move(self.root_path + '/' + self.source_full_jar,
                 self.root_path + NODES_DIR + FULL_NODE_DIR + FULL_NODE_JAR)
     shutil.move(
         self.root_path + '/' + self.source_sol_jar,
         self.root_path + NODES_DIR + SOLIDITY_NODE_DIR + SOLIDITY_NODE_JAR)
     success_msg('initialization finished')
コード例 #3
0
 async def export(self):
     """
     Export properties config file
     """
     phrase = Phrase()
     _target_file_path = self.root_path + NODES_DIR + FULL_NODE_DIR + FULL_CONFIG
     phrase.store_json2properties_to_file(self.config, _target_file_path)
     success_msg('config file exported to: ' + _target_file_path)
コード例 #4
0
ファイル: virtualhost.py プロジェクト: nilBora/virtualhost
def do_create_httpd(options):
    config_path = options['system']['httpd_config_path']
    content = utils.get_config_content(config_path)
    content = get_prepared_content(content, options, 'httpd')

    httpd_path = options['system']['httpd_path']
    file_name = options['httpd']['site_name'] + '.conf'
    full_file_path = httpd_path + file_name

    utils.create_file(full_file_path, content)

    utils.success_msg("Httpd File was Created.")
コード例 #5
0
ファイル: init.py プロジェクト: SocialInfluenceToken/tron-cli
 def create_dirs(self):
     path = self.root_path
     try:
         os.mkdir(path + NODES_DIR)
         os.mkdir(path + NODES_DIR + FULL_NODE_DIR)
         os.mkdir(path + NODES_DIR + SOLIDITY_NODE_DIR)
     except OSError as err:
         warnning_msg('OSError -' + str(err))
     else:
         success_msg('Folders are created:')
         msg(path + '/ ')
         msg('└──' + NODES_DIR)
         msg('    |---' + FULL_NODE_DIR)
         msg('    └──--' + SOLIDITY_NODE_DIR)
コード例 #6
0
ファイル: virtualhost.py プロジェクト: nilBora/virtualhost
def do_create_nginx(options):
    if not utils.is_true('create_nginx', options['nginx']):
        return False

    config_path = options['system']['nginx_config_path']
    content = utils.get_config_content(config_path)
    content = get_prepared_content(content, options, 'nginx')

    httpd_path = options['system']['nginx_path']
    file_name = options['nginx']['site_name'] + '.conf'
    full_file_path = httpd_path + file_name

    utils.create_file(full_file_path, content)
    utils.success_msg("Nginx File was Created.")
コード例 #7
0
ファイル: virtualhost.py プロジェクト: nilBora/virtualhost
def do_create_hosts(options):
    if not utils.is_true('add_hosts', options['default']):
        return False

    file_hosts_path = options['system']['file_hosts_path']
    if not os.path.isfile(file_hosts_path):
        raise Exception('File Hosts Not Found')

    host_ip = options['system']['hosts_ip']
    string = "\n" + host_ip + " " + options['default']['site_name']
    #add conditions if record exists
    file = open(file_hosts_path, 'a')
    file.write(string)
    file.close()

    utils.success_msg("Record in Hosts was Added.")
コード例 #8
0
ファイル: init.py プロジェクト: SocialInfluenceToken/tron-cli
 async def fetch_jars(self, version):
     """
     get release url
     """
     url = JAVA_TRON_RELEASES_URL
     if (version == 'lastest'):
         url += 'Odyssey-v' + JAVA_TRON_LASTEST_VERSION
     elif ('3.1.3' <= version <= '3.1.3'):
         url += 'Odyssey-v' + version
     """
     download
     """
     msg('download fullnode jar might take a while')
     await download(self.source_full_jar, url)
     success_msg('.jar file of Fullnode is successfully downloaded')
     msg('download solidity jar might take a while')
     await download(self.source_sol_jar, url)
     success_msg('.jar file of Soliditynode is successfully downloaded')
コード例 #9
0
ファイル: virtualhost.py プロジェクト: nilBora/virtualhost
def do_create_site(options):
    if not utils.is_true('create_test_folder', options['default']):
        return False

    if not os.path.isdir(options['default']['site_path']):
        utils.error_msg('Path to Folder Site Not Found')
        return False

    site_folder_path = options['default']['site_path'] + options['default'][
        'site_name']

    if os.path.isdir(site_folder_path):
        utils.error_msg('Site Folder is Exist')
        return False

    os.makedirs(site_folder_path)

    template_path = options['system']['template_page_path']
    content = utils.get_config_content(template_path)

    site_folder_path = site_folder_path + "/index.html"
    utils.create_file(site_folder_path, content)

    utils.success_msg("Site Folder was Created.")