Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

Commit

Permalink
Add build script
Browse files Browse the repository at this point in the history
  • Loading branch information
EpocDotFr committed Mar 21, 2020
1 parent d32c549 commit 35d5306
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 30 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
web-ext-artifacts/
web-ext-artifacts/
manifest.json
__pycache__/
29 changes: 0 additions & 29 deletions manifest.json

This file was deleted.

54 changes: 54 additions & 0 deletions scripts/manage.py
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()
31 changes: 31 additions & 0 deletions scripts/settings.py
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',
]

0 comments on commit 35d5306

Please sign in to comment.