1
Fork 0

Fixed python build scripts

This commit is contained in:
Jake Howard 2015-08-20 19:28:20 +01:00
parent 25f1f5aac4
commit 0ef155b7f8
8 changed files with 59 additions and 53 deletions

4
.gitignore vendored
View File

@ -1,11 +1,11 @@
# Chrome extension files # Chrome extension files
chrome/key.pem chrome/key.pem
chrome/data chrome/data
*.crx chrome/*.crx
# Firefox extension files # Firefox extension files
firefox/data firefox/data
*.xpi firefox/*.xpi
# Source # Source
build/ build/

View File

@ -1,18 +1,16 @@
# Hipchat Emoticons for all! # # Hipchat Emoticons for all! #
## Building for yourself ## ## Building for yourself ##
Whilst I recommend that you use the plugins that are on the add-on stores of the respective browsers, building the apps yourself is perfectly possible. I build the apps on ubuntu, so have made sure that the build scripts work for me, use on other platforms may vary. Whilst I recommend that you use the plugins that are on the add-on stores of the respective browsers, building the apps yourself is perfectly possible. I build the apps on ubuntu, so have made sure that the build scripts work for me, use on other platforms may vary.
### Commands: ### ### Commands: ###
npm clean
npm install npm install
npm run build npm run build
npm run build-extensions
### To-Do ### ### To-Do ###
* Create chrome version
* Create script to copy files from common to platform directories
* Add other sites support (currently facebook messages popup only) * Add other sites support (currently facebook messages popup only)

View File

@ -1,11 +1,12 @@
import json import json
import os
current_dir = os.path.dirname(os.path.realpath(__file__)) + "/"
with open(current_dir + "../package.json") as json_file:
with open("../package.json") as json_file:
project_package = json.load(json_file) project_package = json.load(json_file)
with open("manifest.json") as json_file: with open(current_dir + "manifest.json") as json_file:
manifest = json.load(json_file) manifest = json.load(json_file)
@ -16,24 +17,25 @@ switcher = {
} }
for key, value in enumerate(switcher): for key, value in switcher.items():
manifest[value] = project_package[key] manifest[value] = project_package[key]
with open("data/site-decoder.json") as json_file: with open(current_dir + "data/site-decoder.json") as json_file:
site_decoder = json.load(json_file) site_decoder = json.load(json_file)['sites']
content_scripts = [] content_scripts = []
for ident, script in enumerate(site_decoder): for site in site_decoder:
site = list(site.items())[0]
temp = {} temp = {}
temp['matches'] = [ident] temp['matches'] = [site[0]]
temp['js'] = ['data/lib/jquery.js', 'data/image_lookup.js', 'data/injections/' + script] temp['js'] = ['data/lib/jquery.js', 'data/image_lookup.js', 'data/injections/' + site[1]]
content_scripts.append(temp) content_scripts.append(temp)
manifest['content_scripts'] = content_scripts manifest['content_scripts'] = content_scripts
with open('package.json', 'w') as file: with open(current_dir + 'manifest.json', 'w') as file:
json.dump(manifest, file) json.dump(manifest, file, indent=2, sort_keys=True)

View File

@ -1,14 +1,18 @@
{ {
"manifest_version": 2,
"name": "Hipchat Emoticons for all",
"description": "Allows use of hipchat emoticons on other websites",
"version": "ALPHA",
"content_scripts": [ "content_scripts": [
{ {
"matches": ["http://www.google.com/*"], "js": [
"js": ["jquery.js", "myscript.js"] "data/lib/jquery.js",
"data/image_lookup.js",
"data/injections/facebook.js"
],
"matches": [
"*.facebook.com"
]
} }
], ],
"description": "Use hipchat emoticons on other sites",
"manifest_version": 2,
"name": "Hipchat-Emoticons-for-all",
"version": "0.0.0"
} }

View File

@ -1,22 +1,23 @@
import json import json
import os
current_dir = os.path.dirname(os.path.realpath(__file__)) + "/"
with open("../package.json") as json_file: with open(current_dir + "../package.json") as json_file:
project_package = json.load(json_file) project_package = json.load(json_file)
with open("package.json") as json_file: with open(current_dir + "package.json") as json_file:
ext_package = json.load(json_file) ext_package = json.load(json_file)
switcher = { switcher = {
'name': 'title', 'name': 'title',
'name': 'name',
'version': 'version', 'version': 'version',
'description': 'description', 'description': 'description',
'author': 'author', 'author': 'author',
'license': 'license' 'license': 'license'
} }
for key, value in enumerate(switcher): for key, value in switcher.items():
ext_package[value] = project_package[key] ext_package[value] = project_package[key]
with open('package.json', 'w') as file: with open(current_dir + 'package.json', 'w') as file:
json.dump(ext_package, file) json.dump(ext_package, file, indent=2, sort_keys=True)

View File

@ -1,13 +1,14 @@
{ {
"title": "Hipchat Emoticons for all", "author": "TheOrangeOne",
"name": "Hipchat emoticons for all", "description": "Use hipchat emoticons on other sites",
"version": "ALPHA",
"description": "Use Hipchat emoticons on other sites",
"main": "index.js",
"author": "TheOrangeOne",
"engines": { "engines": {
"firefox": ">=38.0a1", "fennec": ">=38.0a1",
"fennec": ">=38.0a1" "firefox": ">=38.0a1"
}, },
"license": "MIT" "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"
}

View File

@ -7,11 +7,11 @@
"create-dirs": "mkdir -p firefox/data chrome/data build/injections", "create-dirs": "mkdir -p firefox/data chrome/data build/injections",
"build-extensions": "npm run build-firefox && npm run build-chrome", "build-extensions": "npm run build-firefox && npm run build-chrome",
"build-firefox": "cd firefox/ && jpm xpi && cd -", "build-firefox": "cd firefox/ && jpm xpi && cd -",
"build-chrome": "crx pack chrome -o hipchat-emoticons-for-all.crx -p chrome/key.pem", "build-chrome": "crx pack chrome -o chrome/hipchat-emoticons-for-all.crx -p chrome/key.pem",
"build-js": "bash build-js.sh", "build-js": "bash build-js.sh",
"build-data-files": "python firefox/build-package.py && python chrome/build-manifest.py", "build-data-files": "python firefox/build-package.py && python chrome/build-manifest.py",
"distribute": "cp -r build/* firefox/data/ && cp -r build/* chrome/data/", "distribute": "cp -r build/* firefox/data/ && cp -r build/* chrome/data/",
"build": "npm run clean && npm run create-dirs && npm install && npm run build-js && npm run distribute && npm run build-data-files && npm run build-extensions", "build": "npm run clean && npm run create-dirs && npm run build-js && npm run distribute && npm run build-data-files && npm run build-extensions",
"clean": "rm -rf firefox/data chrome/data node_modules/" "clean": "rm -rf firefox/data chrome/data node_modules/"
}, },
"repository": { "repository": {
@ -30,12 +30,10 @@
"homepage": "https://bitbucket.org/theorangeone/hipchat-emoticons-for-all", "homepage": "https://bitbucket.org/theorangeone/hipchat-emoticons-for-all",
"dependencies": { "dependencies": {
"ionic-sdk": "=1.0.0", "ionic-sdk": "=1.0.0",
"less": "=2.4.0",
"jquery": "=2.1.4"
},
"devDependencies": {
"jpm":"=1.0.1", "jpm":"=1.0.1",
"uglify-js":"=2.4.24", "uglify-js":"=2.4.24",
"crx": "=3.0.3" "crx": "=3.0.3",
"less": "=2.4.0",
"jquery": "=2.1.4"
} }
} }

View File

@ -1,3 +1,5 @@
{ // Site Identifier : Injection JS {
"*.facebook.com":"facebook.js", "sites": [
{"*.facebook.com":"facebook.js"}
]
} }