Skip to content

Commit

Permalink
Update of the way we fix branch informations
Browse files Browse the repository at this point in the history
  • Loading branch information
funilrys committed Jun 16, 2018
1 parent 1eb13cb commit e55b4a2
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 12 deletions.
4 changes: 2 additions & 2 deletions PyFunceble/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
from PyFunceble.production import Production

CURRENT_DIRECTORY = getcwd() + directory_separator
VERSION = "0.81.5.dev-beta"
VERSION = "0.81.6.dev-beta"

CONFIGURATION_FILENAME = ".PyFunceble.yaml"

Expand Down Expand Up @@ -136,7 +136,7 @@ def command_line(): # pragma: no cover # pylint: disable=too-many-branches,too
initiate(autoreset=True)

PARSER = argparse.ArgumentParser(
description='The tool to check domain or IP availability.',
description="The tool to check domain or IP availability.",
epilog="Crafted with %s by %s"
% (
Fore.RED + "♥" + Fore.RESET,
Expand Down
25 changes: 17 additions & 8 deletions PyFunceble/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
# pylint: enable=line-too-long

import PyFunceble
from PyFunceble import Fore, Style
from PyFunceble import Fore, Style, directory_separator
from PyFunceble.clean import Clean
from PyFunceble.config import Version
from PyFunceble.directory_structure import DirectoryStructure
Expand Down Expand Up @@ -123,7 +123,14 @@ def __init__(self, extern=False):
PyFunceble.CURRENT_DIRECTORY + "version.yaml"
)

self._update_readme_md()
self._update_docs(PyFunceble.CURRENT_DIRECTORY + "README.md")
self._update_docs(
PyFunceble.CURRENT_DIRECTORY
+ directory_separator
+ "docs"
+ directory_separator
+ "index.rst"
)
self._update_setup_py()

message = Fore.GREEN + Style.BRIGHT + "We are ready to ship!! \n"
Expand Down Expand Up @@ -215,13 +222,15 @@ def _does_require_force_update(self):

return False

def _update_readme_md(self):
def _update_docs(self, file_to_update):
"""
This method update README.md so that it's always giving branch related bases.
Note: This only apply to dev and master
"""
Note: This only apply to `dev` and `master` branch.
readme_path = PyFunceble.CURRENT_DIRECTORY + "README.md"
Argument:
- file_to_update: str
The file to update.
"""

if self._is_dev_version():
regexes = {"/dev/": r"\/master\/", "=dev": "=master"}
Expand All @@ -230,12 +239,12 @@ def _update_readme_md(self):
else:
raise Exception("Please switch to `dev` or `master` branch.")

to_update = File(readme_path).read()
to_update = File(file_to_update).read()

for replacement, regex in regexes.items():
to_update = Regex(to_update, regex, replace_with=replacement).replace()

File(readme_path).write(to_update, overwrite=True)
File(file_to_update).write(to_update, overwrite=True)

def _update_setup_py(self):
"""
Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.. image:: https://github.com/funilrys/PyFunceble/raw/master/.assets/logo/RM.png
.. image:: https://github.com/funilrys/PyFunceble/raw/dev/.assets/logo/RM.png
:alt: PyFunceble Logic representation

The tool to check domain or IP availability
Expand Down
2 changes: 1 addition & 1 deletion version.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
current_version: 0.81.5.dev-beta
current_version: 0.81.6.dev-beta
deprecated: [0.0.0, 0.0.1, 0.65.0, 0.67.1, 0.68.0, 0.69.3, 0.69.5, 0.70.4, 0.71.2,
0.72.7, 0.73.1, 0.74.5, 0.75.1, 0.76.2, 0.77.0, 0.78.0, 0.79.1, 0.80.9]
force_update:
Expand Down

0 comments on commit e55b4a2

Please sign in to comment.