From 00fe5df5b8f38c0184e84c8831f41d32998f6068 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Fri, 28 Aug 2015 14:05:59 +0100 Subject: [PATCH] package and manifest are dynamically generated now! --- .gitignore | 4 ++++ chrome/build-manifest.py | 12 ++++++++---- chrome/manifest.json | 28 ---------------------------- firefox/build-package.py | 19 +++++++++++++++---- firefox/package.json | 14 -------------- 5 files changed, 27 insertions(+), 50 deletions(-) delete mode 100644 chrome/manifest.json delete mode 100644 firefox/package.json diff --git a/.gitignore b/.gitignore index 141839d..8b75efd 100644 --- a/.gitignore +++ b/.gitignore @@ -2,10 +2,14 @@ chrome/key.pem chrome/data chrome/*.crx +chrome/manifest.json + # Firefox extension files firefox/data firefox/*.xpi +firefox/package.json + # Source build/ diff --git a/chrome/build-manifest.py b/chrome/build-manifest.py index 860caf0..ed717dc 100644 --- a/chrome/build-manifest.py +++ b/chrome/build-manifest.py @@ -5,10 +5,12 @@ current_dir = os.path.dirname(os.path.realpath(__file__)) + "/" with open(current_dir + "../package.json") as json_file: project_package = json.load(json_file) - -with open(current_dir + "manifest.json") as json_file: - manifest = json.load(json_file) - +manifest = {} +try: + with open(current_dir + "manifest.json") as json_file: + manifest = json.load(json_file) +except: + manifest = {} switcher = { 'name': 'name', @@ -36,6 +38,8 @@ for site in site_decoder: manifest['content_scripts'] = content_scripts +# Hard coded things +manifest['mannifest_version'] = 2 with open(current_dir + 'manifest.json', 'w') as file: json.dump(manifest, file, indent=2, sort_keys=True) diff --git a/chrome/manifest.json b/chrome/manifest.json deleted file mode 100644 index de1959c..0000000 --- a/chrome/manifest.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "content_scripts": [ - { - "js": [ - "data/lib/jquery.js", - "data/injector.js", - "data/injections/facebook.js" - ], - "matches": [ - "*://facebook.com/*" - ] - }, - { - "js": [ - "data/lib/jquery.js", - "data/injector.js", - "data/injections/github.js" - ], - "matches": [ - "*://github.com/*" - ] - } - ], - "description": "Use hipchat emoticons on other websites. Some sites may require this plugin in order to see the emoticons.", - "manifest_version": 2, - "name": "Hipchat-Emoticons-for-all", - "version": "0.0.0" -} \ No newline at end of file diff --git a/firefox/build-package.py b/firefox/build-package.py index c546b89..d7621fd 100644 --- a/firefox/build-package.py +++ b/firefox/build-package.py @@ -5,8 +5,12 @@ current_dir = os.path.dirname(os.path.realpath(__file__)) + "/" with open(current_dir + "../package.json") as json_file: project_package = json.load(json_file) -with open(current_dir + "package.json") as json_file: - ext_package = json.load(json_file) +package = {} +try: + with open(current_dir + "package.json") as json_file: + package = json.load(json_file) +except: + package = {} switcher = { 'name': 'title', @@ -17,7 +21,14 @@ switcher = { } for key, value in switcher.items(): - ext_package[value] = project_package[key] + package[value] = project_package[key] + + +#Hard coded values +package['name'] = package['title'].replace(' ', '-') +package['id'] = package['name'] + "@jetpack" +package['engines'] = {'fennec': ">=38.01a", 'firefox': ">=38.0a1"} +package['main'] = 'index.js' with open(current_dir + 'package.json', 'w') as file: - json.dump(ext_package, file, indent=2, sort_keys=True) + json.dump(package, file, indent=2, sort_keys=True) diff --git a/firefox/package.json b/firefox/package.json deleted file mode 100644 index fb5172b..0000000 --- a/firefox/package.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "author": "TheOrangeOne", - "description": "Use hipchat emoticons on other websites. Some sites may require this plugin in order to see the emoticons.", - "engines": { - "fennec": ">=38.0a1", - "firefox": ">=38.0a1" - }, - "id": "Hipchat-Emoticons-for-all@jetpack", - "license": "MIT", - "main": "index.js", - "name": "hipchat emoticons for all", - "title": "Hipchat-Emoticons-for-all", - "version": "0.0.0" -} \ No newline at end of file