Skip to content

refactor: DRY version#75

Open
wazaundtechnik wants to merge 1 commit into
tulul:masterfrom
wazaundtechnik:feature/standalone-version
Open

refactor: DRY version#75
wazaundtechnik wants to merge 1 commit into
tulul:masterfrom
wazaundtechnik:feature/standalone-version

Conversation

@wazaundtechnik

Copy link
Copy Markdown
Contributor

Do not hard code version into commands. Put it into separate file and let another module calls that command to retrieve version information.

@wazaundtechnik wazaundtechnik requested review from fushar and kmkurn July 19, 2017 23:35
@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+1.1%) to 93.493% when pulling accbf7e on wazaundtechnik:feature/standalone-version into 4b8f011 on tulul:master.

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+1.1%) to 93.493% when pulling 472dd13 on wazaundtechnik:feature/standalone-version into 4b8f011 on tulul:master.

Comment thread tululbot/commands.py Outdated
app.logger.debug('Detected who command {!r}'.format(message.text))
about_text = (
'TululBot v1.11.2\n\n'
'TululBot {!r}\n\n'

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The !r is not needed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

Comment thread tests/test_commands.py Outdated

expected_text = (
'TululBot v1.11.2\n\n'
'TululBot {!r}\n\n'

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The !r is not needed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

Comment thread tululbot/version.py Outdated
VERSION = '1.11.3'


def version_formatted():

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you can import VERSION directly, this function is not really needed isn't it? At this point, the function only preprends v to the version number. Also, this variable might be best put under tululbot/__init__.py file so that it can be imported like from tululbot import VERSION.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't know we can import a constant. Thanks

@wazaundtechnik

wazaundtechnik commented Jul 23, 2017

Copy link
Copy Markdown
Contributor Author

Hey team i tried to change to what @kmkurn suggest, but the build was failed https://travis-ci.org/tulul/tululbot/builds/256555060. Can somebody help me and point out where is the mistake?

Previous build worked (when use standalone VERSION file).

@kmkurn

kmkurn commented Jul 23, 2017

Copy link
Copy Markdown

@wazaundtechnik Sorry I think that's probably because of circular import or sth. I'm not sure either because I don't check myself. What if you put VERSION under tululbot/constants.py file, for instance?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants