From b5e1f0d6cffb565965f95bea4c52aa8b59dad4c2 Mon Sep 17 00:00:00 2001 From: NaveenKumar Namachivayam Date: Tue, 28 Nov 2023 19:15:14 -0500 Subject: [PATCH] Fix: Version conflicts Signed-off-by: NaveenKumar Namachivayam --- .github/workflows/release-workflow.yml | 4 ++- hamster/__version__.py | 2 ++ hamster/config.py | 39 ++++++++++++++++++++ hamster/menu.py | 23 ++++++++---- windows/__init__.py | 2 +- windows/config.py | 2 +- windows/config.py~ | 50 -------------------------- 7 files changed, 63 insertions(+), 59 deletions(-) create mode 100644 hamster/__version__.py delete mode 100644 windows/config.py~ diff --git a/.github/workflows/release-workflow.yml b/.github/workflows/release-workflow.yml index 1d65bb3..aa7d042 100644 --- a/.github/workflows/release-workflow.yml +++ b/.github/workflows/release-workflow.yml @@ -8,13 +8,15 @@ on: branches: [ "main" ] paths-ignore: - '**/**.md' +env: + HAMSTER_APP_VERSION: 0.1.0 jobs: build: runs-on: ${{ matrix.os }} env: - RELEASE_TAG: v0.0.${{ github.run_number }} + RELEASE_TAG: v${{ HAMSTER_APP_VERSION }} INTEL_DMG: Hamster-x86-64-intel.dmg ARM64_DMG: Hamster-arm64-silicon.dmg diff --git a/hamster/__version__.py b/hamster/__version__.py new file mode 100644 index 0000000..40e09a2 --- /dev/null +++ b/hamster/__version__.py @@ -0,0 +1,2 @@ +__version_info__ = (0, 1, 0) +__version__ = '.'.join(map(str, __version_info__)) diff --git a/hamster/config.py b/hamster/config.py index 8944182..86f03a5 100644 --- a/hamster/config.py +++ b/hamster/config.py @@ -4,6 +4,43 @@ import getpass import re import shutil +from __version__ import __version__ + + +class AppConfig: + def __init__(self): + self.app_title = 'Hamster' + self.app_title_emoji = f'🐹 {self.app_title}' + self.app_caption = 'Instantly Launch JMeter Test Plans' + self.app_caption_emoji = f'{self.app_caption} 🚀' + self.app_version = __version__ + self.buy_me_a_coffee_url = 'https://www.buymeacoffee.com/QAInsights' + self.authors = ['NaveenKumar Namachivayam', 'Leela Prasad Vadla'] + self.about_website = 'https://QAInsights.com' + + @property + def authors_str(self): + return '\n'.join(self.authors) + + @property + def about_text(self): + return f'''{self.app_title_emoji} - {self.app_caption_emoji}\n\n + Authors:\n{self.authors_str}\n\n{self.about_website} + ''' + + @property + def help_text(self): + return ''' +Hamster is a menu bar app to instantly launch JMeter test plans.\n\n +1. Configure `JMETER_HOME` by launching `Hamster > Edit JMETER_HOME`\n +2. To launch JMeter, click on `Hamster > Launch JMeter`\n +3. To launch JMeter test plans, click on `Hamster > Recent Test Plans > select the test plan`.\n +4. To view the configuration, click on `Hamster > View Config`\n +5. To restart Hamster, click on `Hamster > Refresh`\n +6. To know more about Hamster, click on `Hamster > About`\n +7. To quit Hamster, click on `Hamster > Quit`\n +''' + # Hamster's template properties file app_properties_template = ".hamster_app.properties" @@ -30,6 +67,8 @@ jmeter_plist = f"/Users/{username}/Library/Preferences/org.apache.jmeter.plist" +app_config = AppConfig() + def jmeter_path(): jmeter_home = config_parser.get('JMETER', 'HOME').strip() diff --git a/hamster/menu.py b/hamster/menu.py index 68829ef..8f7c1e8 100644 --- a/hamster/menu.py +++ b/hamster/menu.py @@ -1,7 +1,10 @@ +import webbrowser + import rumps import subprocess from utils import update_properties, show_splash_screen, prechecks, get_recent_jmeter_test_plans, sleep from config import jmeter_path, icon_path, properties_file_path, config_parser, jmeter_plist +from config import app_config class DynamicMenuApp(rumps.App): @@ -21,10 +24,11 @@ class DynamicMenuApp(rumps.App): just_jmeter(self, _): Launches JMeter without any test plan. about(self, _): Displays information about the application. """ + def __init__(self, title): super(DynamicMenuApp, self).__init__(title, icon=icon_path, quit_button='Quit') self.menu = ['Launch JMeter', 'Recent Test Plans', None, 'View Config', 'Edit JMETER_HOME', None, - 'Refresh', 'Help', 'About'] + 'Refresh', 'Buy me a Coffee', 'Help', 'About'] self.jmeter_home, self.jmeter_bin = jmeter_path() prechecks(jmeter_plist, self.jmeter_home, self.jmeter_bin) self.refresh_test_plans(delay=1) @@ -103,11 +107,12 @@ def menu_callback(self, sender): Callback function for menu items. """ try: - subprocess.Popen([self.jmeter_bin, '-t', sender.title], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) + subprocess.Popen([self.jmeter_bin, '-t', sender.title], stdout=subprocess.DEVNULL, + stderr=subprocess.DEVNULL) self.refresh_test_plans() except Exception as e: rumps.alert("Error", e) - + @rumps.clicked("Launch JMeter") def just_jmeter(self, _): """ @@ -117,11 +122,17 @@ def just_jmeter(self, _): subprocess.Popen([self.jmeter_bin], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) except Exception as e: rumps.alert("Error", e) - + + @rumps.clicked("Buy me a Coffee") + def sponsor(self, _): + """ + Displays information about the application. + """ + webbrowser.open_new_tab(app_config.buy_me_a_coffee_url) + @rumps.clicked("About") def about(self, _): """ Displays information about the application. """ - rumps.alert("Hamster - instantly launch JMeter test plans 🚀", \ - "Version 0.1\n\nAuthor: NaveenKumar Namachivayam\n\nhttps://qainsights.com", icon_path=icon_path) + rumps.alert("About", f"{app_config.about_text}\n\n v{app_config.app_version}", icon_path=icon_path) diff --git a/windows/__init__.py b/windows/__init__.py index b77b1f2..43b2be7 100644 --- a/windows/__init__.py +++ b/windows/__init__.py @@ -1 +1 @@ -__VERSION__ = "0.0.1" +__VERSION__ = "0.1.0" diff --git a/windows/config.py b/windows/config.py index cccd249..e25efb5 100644 --- a/windows/config.py +++ b/windows/config.py @@ -17,7 +17,7 @@ def __init__(self): self.menu_items_dict = OrderedDict() self.jmeter_recent_files_pattern = re.compile("recent_file_.*") - self.app_version = "0.0.1" + self.app_version = "0.1.0" self.buy_me_a_coffee_url = 'https://www.buymeacoffee.com/QAInsights' self.authors = ['NaveenKumar Namachivayam', 'Leela Prasad Vadla'] self.about_website = 'https://QAInsights.com' diff --git a/windows/config.py~ b/windows/config.py~ deleted file mode 100644 index c25bdab..0000000 --- a/windows/config.py~ +++ /dev/null @@ -1,50 +0,0 @@ -import re - -from collections import OrderedDict -from pathlib import Path -from windows import __VERSION__ - - -class AppConfig: - def __init__(self): - self.app_title = 'Hamster' - self.app_title_emoji = f'🐹 {self.app_title}' - self.app_caption = 'Instantly Launch JMeter Test Plans' - self.app_caption_emoji = f'{self.app_caption} 🚀' - self.app_properties_template = "hamster_app.properties" - self.win_app_properties = self.app_properties_template.replace(".properties", ".ini") - self.home_dir = Path.home() - self.menu_items_dict = OrderedDict() - - self.jmeter_recent_files_pattern = re.compile("recent_file_.*") - self.app_version = __VERSION__ - self.buy_me_a_coffee_url = 'https://www.buymeacoffee.com/QAInsights' - self.authors = ['NaveenKumar Namachivayam', 'Leela Prasad Vadla'] - self.about_website = 'https://QAInsights.com' - - @property - def authors_str(self): - return '\n'.join(self.authors) - - @property - def about_text(self): - return f'''{self.app_title_emoji} - {self.app_caption_emoji}\n\n -Authors:\n{self.authors_str}\n\n{self.about_website} - ''' - - @property - def help_text(self): - return ''' -Hamster is a menu bar app to instantly launch JMeter test plans.\n\n -1. Configure `JMETER_HOME` by launching `Hamster > Edit JMETER_HOME`\n -2. To launch JMeter, click on `Hamster > Launch JMeter`\n -3. To launch JMeter test plans, click on `Hamster > Recent Test Plans > select the test plan`.\n -4. To view the configuration, click on `Hamster > View Config`\n -5. To restart Hamster, click on `Hamster > Refresh`\n -6. To know more about Hamster, click on `Hamster > About`\n -7. To refresh the recent test plans, click on `Hamster > Restart`\n -8. To quit Hamster, click on `Hamster > Quit`\n - ''' - - -app_config = AppConfig()