Skip to content

Commit

Permalink
Merge pull request #62 from QAInsights/feature/mac-version
Browse files Browse the repository at this point in the history
Fix: Version conflicts
  • Loading branch information
QAInsights authored Nov 29, 2023
2 parents e89b49b + b5e1f0d commit 0d4c1ce
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 59 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/release-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 2 additions & 0 deletions hamster/__version__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
__version_info__ = (0, 1, 0)
__version__ = '.'.join(map(str, __version_info__))
39 changes: 39 additions & 0 deletions hamster/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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()
Expand Down
23 changes: 17 additions & 6 deletions hamster/menu.py
Original file line number Diff line number Diff line change
@@ -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):
Expand All @@ -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)
Expand Down Expand Up @@ -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, _):
"""
Expand All @@ -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)
2 changes: 1 addition & 1 deletion windows/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__VERSION__ = "0.0.1"
__VERSION__ = "0.1.0"
2 changes: 1 addition & 1 deletion windows/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
50 changes: 0 additions & 50 deletions windows/config.py~

This file was deleted.

0 comments on commit 0d4c1ce

Please sign in to comment.