This repository has been archived by the owner on Aug 31, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
88 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
web-ext-artifacts/ | ||
web-ext-artifacts/ | ||
manifest.json | ||
__pycache__/ |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import subprocess | ||
import argparse | ||
import settings | ||
import json | ||
|
||
|
||
def create_manifest_file(target): | ||
data = settings.MANIFEST_FILE | ||
|
||
if target == 'firefox': | ||
data['browser_specific_settings'] = { | ||
'gecko': { | ||
'id': 'gmrle@epoc.fr', | ||
'strict_min_version': '57.0' | ||
} | ||
} | ||
|
||
with open('manifest.json', 'w', encoding='utf-8') as f: | ||
json.dump(data, f, indent=2) | ||
|
||
|
||
def switch(target): | ||
create_manifest_file(target) | ||
|
||
|
||
def build(target): | ||
switch(target) | ||
|
||
arguments = [ | ||
'web-ext', | ||
'build', | ||
'--overwrite-dest', | ||
'--ignore-files', | ||
] | ||
|
||
arguments.extend(settings.FILES_AND_DIRECTORIES_TO_IGNORE_WHEN_BUILDING) | ||
|
||
subprocess.run(arguments, shell=True) | ||
|
||
|
||
def run(): | ||
arg_parser = argparse.ArgumentParser() | ||
arg_parser.add_argument('action', choices=['build', 'switch']) | ||
arg_parser.add_argument('target', choices=['firefox', 'chrome']) | ||
|
||
args = arg_parser.parse_args() | ||
|
||
if args.action == 'build': | ||
build(args.target) | ||
elif args.action == 'switch': | ||
switch(args.target) | ||
|
||
if __name__ == '__main__': | ||
run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
MANIFEST_FILE = { | ||
'manifest_version': 2, | ||
'name': 'GitLab Merge Requests lists enhancer', | ||
'version': '1.0.0', | ||
'description': 'An extension that enhance all Merge Requests lists on any instance of Gitlab and GitLab.com', | ||
'homepage_url': 'https://github.com/EpocDotFr/gitlab-merge-requests-lists-enhancer', | ||
'author': 'Maxime \'Epoc\' G.', | ||
'icons': { | ||
'16': 'images/logo_16.png', | ||
'48': 'images/logo_48.png', | ||
'96': 'images/logo_96.png', | ||
'128': 'images/logo_128.png' | ||
}, | ||
'content_scripts': [ | ||
{ | ||
'matches': ['*://*/*/*/-/merge_requests', '*://*/*/*/-/merge_requests?*'], | ||
'js': ['js/content.js'] | ||
} | ||
], | ||
'permissions': [ | ||
'*://*/*/*/-/merge_requests', '*://*/*/*/-/merge_requests?*' | ||
] | ||
} | ||
|
||
FILES_AND_DIRECTORIES_TO_IGNORE_WHEN_BUILDING = [ | ||
'scripts', | ||
'web-ext-artifacts', | ||
'LICENSE.md', | ||
'README.md', | ||
'screenshot.png', | ||
] |