Skip to content

Commit

Permalink
Update of repository structure && Launch test
Browse files Browse the repository at this point in the history
Please note that this patch fix the issues which has been introduced by the latest PyFunceble-dev version.
  • Loading branch information
funilrys committed Mar 28, 2018
1 parent 06b8e0a commit 11a2c23
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 32 deletions.
8 changes: 1 addition & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,11 @@ cache:
sudo: required

before_install:
- sudo apt-get -y install python3-pip
- sudo apt-get -y install python3-pip python3-yaml
- sudo apt-get -y install dos2unix
- pip3 install colorama

script:
- export TRAVIS_BUILD_DIR=${TRAVIS_BUILD_DIR}
- export GH_TOKEN=${GH_TOKEN}
- export TRAVIS_REPO_SLUG=${TRAVIS_REPO_SLUG}
- export GIT_BRANCH=${GIT_BRANCH}
- export GIT_EMAIL=${GIT_EMAIL}
- export GIT_NAME=${GIT_NAME}
- python3 ./update.py

notifications:
Expand Down
14 changes: 2 additions & 12 deletions info.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,12 @@
{
"arguments": [
"--travis",
"-a",
"-ex",
"--plain",
"--split",
"-t 2",
"--share-logs"
],
"autosave_minutes": "10",
"arguments": [],
"clean_list_file": "clean.list",
"clean_original": "1",
"commit_autosave_message": "Testing for Ultimate Hosts Blacklist",
"currently_under_test": "1",
"days_until_next_test": "2",
"last_test": "1522179897",
"list_name": "domains.list",
"name": "Domain Status Testing for Ultimate Hosts Blacklist",
"raw_link": "https://sysctl.org/cameleon/hosts",
"stable": "0"
}
}
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
requests==2.18.4
colorama==0.3.9
PyYAML==3.12
29 changes: 16 additions & 13 deletions update.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,11 @@ class Settings(object): # pylint: disable=too-few-public-methods
# Note: DO NOT TOUCH UNLESS YOU KNOW WHAT IT MEANS!
permanent_license_link = 'https://raw.githubusercontent.com/Ultimate-Hosts-Blacklist/repository-structure/master/LICENSE' # pylint: disable=line-too-long

# This variable is used to set the permanant config links
#
# Note: DO NOT TOUCH UNLESS YOU KNOW WHAT IT MEANS!
permanent_config_link = 'https://raw.githubusercontent.com/Ultimate-Hosts-Blacklist/repository-structure/master/config_production.yaml' # pylint: disable=line-too-long

# This variable is used to set the arguments when executing PyFunceble.py
#
# Note: DO NOT TOUCH UNLESS YOU KNOW WHAT IT MEANS!
Expand Down Expand Up @@ -162,6 +167,7 @@ class Initiate(object):
"""

def __init__(self): # pylint: disable=too-many-branches
self.config_update = 'wget %s -O config.yaml' % Settings.permanent_config_link
self.travis()
self.travis_permissions()
self.structure()
Expand Down Expand Up @@ -372,9 +378,11 @@ def list_file(self):
'Unable to download the the file. Please check the link.')

if path.isdir(Settings.current_directory + 'output'):
Helpers.Command(self.config_update, False).execute()

Helpers.Command(
Settings.current_directory +
'tool.py -c',
'PyFunceble.py --clean',
False).execute()

self.travis_permissions()
Expand Down Expand Up @@ -521,7 +529,6 @@ def PyFunceble(self): # pylint: disable=invalid-name
Install and run PyFunceble.
"""

tool_path = Settings.current_directory + 'tool.py'
# pylint: disable=invalid-name
PyFunceble_path = Settings.current_directory + \
'PyFunceble.py'
Expand All @@ -531,14 +538,10 @@ def PyFunceble(self): # pylint: disable=invalid-name
else:
status = '--dev'

command_to_execute = 'sudo python3 %s --dev -u && ' % (tool_path)
command_to_execute += 'python3 %s -v && ' % (tool_path)
command_to_execute += 'export TRAVIS_BUILD_DIR=%s && ' % environ['TRAVIS_BUILD_DIR']
command_to_execute += 'python3 %s -q --directory-structure && ' % (
tool_path)
command_to_execute += 'sudo python3 %s %s --autosave-minutes %s --commit-autosave-message "[Autosave] %s" --commit-results-message "[Results] %s" -i && ' % ( # pylint: disable=line-too-long
tool_path, status, Settings.autosave_minutes, Settings.commit_autosave_message, Settings.commit_autosave_message) # pylint: disable=line-too-long
command_to_execute = 'sudo python3 %s %s -u && ' % (
PyFunceble_path, status)
command_to_execute += 'python3 %s -v && ' % (PyFunceble_path)
command_to_execute += 'export TRAVIS_BUILD_DIR=%s && ' % environ['TRAVIS_BUILD_DIR']
command_to_execute += 'sudo python3 %s %s -f %s' % (
PyFunceble_path, self._construct_arguments(), Settings.file_to_test)

Expand All @@ -549,11 +552,12 @@ def PyFunceble(self): # pylint: disable=invalid-name
'LICENSE').link()

Settings.informations['last_test'] = strftime('%s')

Helpers.Dict(
Settings.informations).to_json(
Settings.repository_info)
self.travis_permissions()

Helpers.Command(self.config_update, False).execute()
print(Helpers.Command(command_to_execute, True).execute())

commit_message = 'Update of info.json'
Expand All @@ -566,15 +570,14 @@ def PyFunceble(self): # pylint: disable=invalid-name
return_data=False,
escape=True).match():
Settings.informations['currently_under_test'] = str(int(False))
commit_message = "[Results] " + \
commit_message + \
commit_message = "[Results] " + commit_message + \
' && input source file [ci skip]'

self._clean_original()
else:
Settings.informations['currently_under_test'] = str(int(True))
commit_message = "[Autosave] " + \
commit_message + ' && launch next test part'
commit_message

Helpers.Dict(
Settings.informations).to_json(
Expand Down

0 comments on commit 11a2c23

Please sign in to comment.