summaryrefslogtreecommitdiffstats
path: root/addon-sdk/source/bin
diff options
context:
space:
mode:
Diffstat (limited to 'addon-sdk/source/bin')
-rw-r--r--addon-sdk/source/bin/activate84
-rw-r--r--addon-sdk/source/bin/activate.bat134
-rw-r--r--addon-sdk/source/bin/activate.fish66
-rw-r--r--addon-sdk/source/bin/activate.ps199
-rwxr-xr-xaddon-sdk/source/bin/cfx33
-rw-r--r--addon-sdk/source/bin/cfx.bat6
-rw-r--r--addon-sdk/source/bin/deactivate.bat23
-rw-r--r--addon-sdk/source/bin/fx-download.sh7
-rwxr-xr-xaddon-sdk/source/bin/integration-scripts/buildbot-run-cfx-helper14
-rw-r--r--addon-sdk/source/bin/integration-scripts/integration-check364
-rw-r--r--addon-sdk/source/bin/jpm-test.js34
-rw-r--r--addon-sdk/source/bin/node-scripts/apply-patch.js64
-rw-r--r--addon-sdk/source/bin/node-scripts/test.addons.js57
-rw-r--r--addon-sdk/source/bin/node-scripts/test.docs.js145
-rw-r--r--addon-sdk/source/bin/node-scripts/test.examples.js45
-rw-r--r--addon-sdk/source/bin/node-scripts/test.firefox-bin.js37
-rw-r--r--addon-sdk/source/bin/node-scripts/test.ini.js68
-rw-r--r--addon-sdk/source/bin/node-scripts/test.modules.js28
-rw-r--r--addon-sdk/source/bin/node-scripts/update-ini.js141
-rw-r--r--addon-sdk/source/bin/node-scripts/utils.js104
-rw-r--r--addon-sdk/source/bin/node-scripts/words.txt11
21 files changed, 0 insertions, 1564 deletions
diff --git a/addon-sdk/source/bin/activate b/addon-sdk/source/bin/activate
deleted file mode 100644
index 0104f7d9d..000000000
--- a/addon-sdk/source/bin/activate
+++ /dev/null
@@ -1,84 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-# This file must be used with "source bin/activate" *from bash*
-# you cannot run it directly
-
-deactivate () {
- if [ -n "$_OLD_VIRTUAL_PATH" ] ; then
- PATH="$_OLD_VIRTUAL_PATH"
- export PATH
- unset _OLD_VIRTUAL_PATH
- fi
-
- # This should detect bash and zsh, which have a hash command that must
- # be called to get it to forget past commands. Without forgetting
- # past commands the $PATH changes we made may not be respected
- if [ -n "$BASH" -o -n "$ZSH_VERSION" ] ; then
- hash -r
- fi
-
- if [ -n "$_OLD_VIRTUAL_PS1" ] ; then
- PS1="$_OLD_VIRTUAL_PS1"
- export PS1
- unset _OLD_VIRTUAL_PS1
- fi
-
- PYTHONPATH="$_OLD_PYTHONPATH"
- export PYTHONPATH
- unset _OLD_PYTHONPATH
-
- unset CUDDLEFISH_ROOT
-
- unset VIRTUAL_ENV
- if [ ! "$1" = "nondestructive" ] ; then
- # Self destruct!
- unset deactivate
- fi
-}
-
-# unset irrelavent variables
-deactivate nondestructive
-
-_OLD_PYTHONPATH="$PYTHONPATH"
-_OLD_VIRTUAL_PATH="$PATH"
-
-VIRTUAL_ENV="`pwd`"
-
-if [ "x$OSTYPE" = "xmsys" ] ; then
- CUDDLEFISH_ROOT="`pwd -W | sed s,/,\\\\\\\\,g`"
- PATH="`pwd`/bin:$PATH"
- # msys will convert any env vars with PATH in it to use msys
- # form and will unconvert before launching
- PYTHONPATH="`pwd -W`/python-lib;$PYTHONPATH"
-else
- CUDDLEFISH_ROOT="$VIRTUAL_ENV"
- PYTHONPATH="$VIRTUAL_ENV/python-lib:$PYTHONPATH"
- PATH="$VIRTUAL_ENV/bin:$PATH"
-fi
-
-VIRTUAL_ENV="`pwd`"
-
-export CUDDLEFISH_ROOT
-export PYTHONPATH
-export PATH
-
-_OLD_VIRTUAL_PS1="$PS1"
-if [ "`basename \"$VIRTUAL_ENV\"`" = "__" ] ; then
- # special case for Aspen magic directories
- # see http://www.zetadev.com/software/aspen/
- PS1="[`basename \`dirname \"$VIRTUAL_ENV\"\``] $PS1"
-else
- PS1="(`basename \"$VIRTUAL_ENV\"`)$PS1"
-fi
-export PS1
-
-# This should detect bash and zsh, which have a hash command that must
-# be called to get it to forget past commands. Without forgetting
-# past commands the $PATH changes we made may not be respected
-if [ -n "$BASH" -o -n "$ZSH_VERSION" ] ; then
- hash -r
-fi
-
-python -c "from jetpack_sdk_env import welcome; welcome()"
diff --git a/addon-sdk/source/bin/activate.bat b/addon-sdk/source/bin/activate.bat
deleted file mode 100644
index 7d1f968a7..000000000
--- a/addon-sdk/source/bin/activate.bat
+++ /dev/null
@@ -1,134 +0,0 @@
-@echo off
-rem This Source Code Form is subject to the terms of the Mozilla Public
-rem License, v. 2.0. If a copy of the MPL was not distributed with this
-rem file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-set VIRTUAL_ENV=%~dp0
-set VIRTUAL_ENV=%VIRTUAL_ENV:~0,-5%
-set CUDDLEFISH_ROOT=%VIRTUAL_ENV%
-
-SET PYTHONKEY=SOFTWARE\Python\PythonCore
-
-rem look for 32-bit windows and python, or 64-bit windows and python
-
-SET PYTHONVERSION=2.7
-call:CheckPython PYTHONINSTALL %PYTHONKEY%\%PYTHONVERSION%\InstallPath
-if "%PYTHONINSTALL%" NEQ "" goto FoundPython
-
-SET PYTHONVERSION=2.6
-call:CheckPython PYTHONINSTALL %PYTHONKEY%\%PYTHONVERSION%\InstallPath
-if "%PYTHONINSTALL%" NEQ "" goto FoundPython
-
-SET PYTHONVERSION=2.5
-call:CheckPython PYTHONINSTALL %PYTHONKEY%\%PYTHONVERSION%\InstallPath
-if "%PYTHONINSTALL%" NEQ "" goto FoundPython
-
-if not defined ProgramFiles(x86) goto win32
-
-rem look for 32-bit python on 64-bit windows
-
-SET PYTHONKEY=SOFTWARE\Wow6432Node\Python\PythonCore
-
-SET PYTHONVERSION=2.7
-call:CheckPython PYTHONINSTALL %PYTHONKEY%\%PYTHONVERSION%\InstallPath
-if "%PYTHONINSTALL%" NEQ "" goto FoundPython
-
-SET PYTHONVERSION=2.6
-call:CheckPython PYTHONINSTALL %PYTHONKEY%\%PYTHONVERSION%\InstallPath
-if "%PYTHONINSTALL%" NEQ "" goto FoundPython
-
-SET PYTHONVERSION=2.5
-call:CheckPython PYTHONINSTALL %PYTHONKEY%\%PYTHONVERSION%\InstallPath
-if "%PYTHONINSTALL%" NEQ "" goto FoundPython
-
-:win32
-
-SET PYTHONVERSION=
-set PYTHONKEY=
-echo Warning: Failed to find Python installation directory
-goto :EOF
-
-:FoundPython
-
-if defined _OLD_PYTHONPATH (
- set PYTHONPATH=%_OLD_PYTHONPATH%
-)
-if not defined PYTHONPATH (
- set PYTHONPATH=;
-)
-set _OLD_PYTHONPATH=%PYTHONPATH%
-set PYTHONPATH=%VIRTUAL_ENV%\python-lib;%PYTHONPATH%
-
-if not defined PROMPT (
- set PROMPT=$P$G
-)
-
-if defined _OLD_VIRTUAL_PROMPT (
- set PROMPT=%_OLD_VIRTUAL_PROMPT%
-)
-
-set _OLD_VIRTUAL_PROMPT=%PROMPT%
-set PROMPT=(%VIRTUAL_ENV%) %PROMPT%
-
-if defined _OLD_VIRTUAL_PATH goto OLDPATH
-goto SKIPPATH
-:OLDPATH
-PATH %_OLD_VIRTUAL_PATH%
-
-:SKIPPATH
-set _OLD_VIRTUAL_PATH=%PATH%
-PATH %VIRTUAL_ENV%\bin;%PYTHONINSTALL%;%PATH%
-set PYTHONKEY=
-set PYTHONINSTALL=
-set PYTHONVERSION=
-set key=
-set reg=
-set _tokens=
-python -c "from jetpack_sdk_env import welcome; welcome()"
-GOTO :EOF
-
-:CheckPython
-::CheckPython(retVal, key)
-::Reads the registry at %2% and checks if a Python exists there.
-::Checks both HKLM and HKCU, then checks the executable actually exists.
-SET key=%2%
-SET "%~1="
-SET reg=reg
-if defined ProgramFiles(x86) (
- rem 32-bit cmd on 64-bit windows
- if exist %WINDIR%\sysnative\reg.exe SET reg=%WINDIR%\sysnative\reg.exe
-)
-rem On Vista+, the last line of output is:
-rem (default) REG_SZ the_value
-rem (but note the word "default" will be localized.
-rem On XP, the last line of output is:
-rem <NO NAME>\tREG_SZ\tthe_value
-rem (not sure if "NO NAME" is localized or not!)
-rem SO: we use ")>" as the tokens to split on, then nuke
-rem the REG_SZ and any tabs or spaces.
-FOR /F "usebackq tokens=2 delims=)>" %%A IN (`%reg% QUERY HKLM\%key% /ve 2^>NUL`) DO SET "%~1=%%A"
-rem Remove the REG_SZ
-set PYTHONINSTALL=%PYTHONINSTALL:REG_SZ=%
-rem Remove tabs (note the literal \t in the next line
-set PYTHONINSTALL=%PYTHONINSTALL: =%
-rem Remove spaces.
-set PYTHONINSTALL=%PYTHONINSTALL: =%
-if exist %PYTHONINSTALL%\python.exe goto :EOF
-rem It may be a 32bit Python directory built from source, in which case the
-rem executable is in the PCBuild directory.
-if exist %PYTHONINSTALL%\PCBuild\python.exe (set "PYTHONINSTALL=%PYTHONINSTALL%\PCBuild" & goto :EOF)
-rem Or maybe a 64bit build directory.
-if exist %PYTHONINSTALL%\PCBuild\amd64\python.exe (set "PYTHONINSTALL=%PYTHONINSTALL%\PCBuild\amd64" & goto :EOF)
-
-rem And try HKCU
-FOR /F "usebackq tokens=2 delims=)>" %%A IN (`%reg% QUERY HKCU\%key% /ve 2^>NUL`) DO SET "%~1=%%A"
-set PYTHONINSTALL=%PYTHONINSTALL:REG_SZ=%
-set PYTHONINSTALL=%PYTHONINSTALL: =%
-set PYTHONINSTALL=%PYTHONINSTALL: =%
-if exist %PYTHONINSTALL%\python.exe goto :EOF
-if exist %PYTHONINSTALL%\PCBuild\python.exe (set "PYTHONINSTALL=%PYTHONINSTALL%\PCBuild" & goto :EOF)
-if exist %PYTHONINSTALL%\PCBuild\amd64\python.exe (set "PYTHONINSTALL=%PYTHONINSTALL%\PCBuild\amd64" & goto :EOF)
-rem can't find it here, so arrange to try the next key
-set PYTHONINSTALL=
-
-GOTO :EOF
diff --git a/addon-sdk/source/bin/activate.fish b/addon-sdk/source/bin/activate.fish
deleted file mode 100644
index 1f728b69b..000000000
--- a/addon-sdk/source/bin/activate.fish
+++ /dev/null
@@ -1,66 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-# This file must be used with "source bin/activate.fish" *from fish*
-# you cannot run it directly
-
-# Much of this code is based off of the activate.fish file for the
-# virtualenv project. http://ur1.ca/ehmd6
-
-function deactivate -d "Exit addon-sdk and return to normal shell environment"
- if test -n "$_OLD_VIRTUAL_PATH"
- set -gx PATH $_OLD_VIRTUAL_PATH
- set -e _OLD_VIRTUAL_PATH
- end
-
- if test -n "$_OLD_PYTHONPATH"
- set -gx PYTHONPATH $_OLD_PYTHONPATH
- set -e _OLD_PYTHONPATH
- end
-
- if test -n "$_OLD_FISH_PROMPT_OVERRIDE"
- functions -e fish_prompt
- set -e _OLD_FISH_PROMPT_OVERRIDE
- . ( begin
- printf "function fish_prompt\n\t#"
- functions _old_fish_prompt
- end | psub )
-
- functions -e _old_fish_prompt
- end
-
- set -e CUDDLEFISH_ROOT
- set -e VIRTUAL_ENV
-
- if test "$argv[1]" != "nondestructive"
- functions -e deactivate
- end
-end
-
-# unset irrelavent variables
-deactivate nondestructive
-
-set -gx _OLD_PYTHONPATH $PYTHONPATH
-set -gx _OLD_VIRTUAL_PATH $PATH
-set -gx _OLD_FISH_PROMPT_OVERRIDE "true"
-
-set VIRTUAL_ENV (pwd)
-
-set -gx CUDDLEFISH_ROOT $VIRTUAL_ENV
-set -gx PYTHONPATH "$VIRTUAL_ENV/python-lib" $PYTHONPATH
-set -gx PATH "$VIRTUAL_ENV/bin" $PATH
-
-# save the current fish_prompt function as the function _old_fish_prompt
-. ( begin
- printf "function _old_fish_prompt\n\t#"
- functions fish_prompt
- end | psub )
-
-# with the original prompt function renamed, we can override with our own.
-function fish_prompt
- printf "(%s)%s%s" (basename "$VIRTUAL_ENV") (set_color normal) (_old_fish_prompt)
- return
-end
-
-python -c "from jetpack_sdk_env import welcome; welcome()"
diff --git a/addon-sdk/source/bin/activate.ps1 b/addon-sdk/source/bin/activate.ps1
deleted file mode 100644
index 5d939d468..000000000
--- a/addon-sdk/source/bin/activate.ps1
+++ /dev/null
@@ -1,99 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-$Env:VIRTUAL_ENV = (gl);
-$Env:CUDDLEFISH_ROOT = $Env:VIRTUAL_ENV;
-
-# http://stackoverflow.com/questions/5648931/powershell-test-if-registry-value-exists/5652674#5652674
-Function Test-RegistryValue {
- param(
- [Alias("PSPath")]
- [Parameter(Position = 0, Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)]
- [String]$Path
- ,
- [Parameter(Position = 1, Mandatory = $true)]
- [String]$Name
- ,
- [Switch]$PassThru
- )
-
- process {
- if (Test-Path $Path) {
- $Key = Get-Item -LiteralPath $Path
- if ($Key.GetValue($Name, $null) -ne $null) {
- if ($PassThru) {
- Get-ItemProperty $Path $Name
- } else {
- $true
- }
- } else {
- $false
- }
- } else {
- $false
- }
- }
-}
-
-$WINCURVERKEY = 'HKLM:SOFTWARE\Microsoft\Windows\CurrentVersion';
-$WIN64 = (Test-RegistryValue $WINCURVERKEY 'ProgramFilesDir (x86)');
-
-if($WIN64) {
- $PYTHONKEY='HKLM:SOFTWARE\Wow6432Node\Python\PythonCore';
-}
-else {
- $PYTHONKEY='HKLM:SOFTWARE\Python\PythonCore';
-}
-
-$Env:PYTHONVERSION = '';
-$Env:PYTHONINSTALL = '';
-
-foreach ($version in @('2.6', '2.5', '2.4')) {
- if (Test-RegistryValue "$PYTHONKEY\$version\InstallPath" '(default)') {
- $Env:PYTHONVERSION = $version;
- }
-}
-
-if ($Env:PYTHONVERSION) {
- $Env:PYTHONINSTALL = (Get-Item "$PYTHONKEY\$version\InstallPath)").'(default)';
-}
-
-if ($Env:PYTHONINSTALL) {
- $Env:Path += ";$Env:PYTHONINSTALL";
-}
-
-if (Test-Path Env:_OLD_PYTHONPATH) {
- $Env:PYTHONPATH = $Env:_OLD_PYTHONPATH;
-}
-else {
- $Env:PYTHONPATH = '';
-}
-
-$Env:_OLD_PYTHONPATH=$Env:PYTHONPATH;
-$Env:PYTHONPATH= "$Env:VIRTUAL_ENV\python-lib;$Env:PYTHONPATH";
-
-if (Test-Path Function:_OLD_VIRTUAL_PROMPT) {
- Set-Content Function:Prompt (Get-Content Function:_OLD_VIRTUAL_PROMPT);
-}
-else {
- function global:_OLD_VIRTUAL_PROMPT {}
-}
-
-Set-Content Function:_OLD_VIRTUAL_PROMPT (Get-Content Function:Prompt);
-
-function global:prompt { "($Env:VIRTUAL_ENV) $(_OLD_VIRTUAL_PROMPT)"; };
-
-if (Test-Path Env:_OLD_VIRTUAL_PATH) {
- $Env:PATH = $Env:_OLD_VIRTUAL_PATH;
-}
-else {
- $Env:_OLD_VIRTUAL_PATH = $Env:PATH;
-}
-
-$Env:Path="$Env:VIRTUAL_ENV\bin;$Env:Path"
-
-[System.Console]::WriteLine("Note: this PowerShell SDK activation script is experimental.")
-
-python -c "from jetpack_sdk_env import welcome; welcome()"
-
diff --git a/addon-sdk/source/bin/cfx b/addon-sdk/source/bin/cfx
deleted file mode 100755
index 3e781faf8..000000000
--- a/addon-sdk/source/bin/cfx
+++ /dev/null
@@ -1,33 +0,0 @@
-#! /usr/bin/env python
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-
-import os
-import sys
-
-# set the cuddlefish "root directory" for this process if it's not already
-# set in the environment
-cuddlefish_root = os.path.dirname(os.path.dirname(os.path.realpath(sys.argv[0])))
-
-if 'CUDDLEFISH_ROOT' not in os.environ:
- os.environ['CUDDLEFISH_ROOT'] = cuddlefish_root
-
-# add our own python-lib path to the python module search path.
-python_lib_dir = os.path.join(cuddlefish_root, "python-lib")
-if python_lib_dir not in sys.path:
- sys.path.insert(0, python_lib_dir)
-
-# now export to env so sub-processes get it too
-if 'PYTHONPATH' not in os.environ:
- os.environ['PYTHONPATH'] = python_lib_dir
-elif python_lib_dir not in os.environ['PYTHONPATH'].split(os.pathsep):
- paths = os.environ['PYTHONPATH'].split(os.pathsep)
- paths.insert(0, python_lib_dir)
- os.environ['PYTHONPATH'] = os.pathsep.join(paths)
-
-import cuddlefish
-
-if __name__ == '__main__':
- cuddlefish.run()
diff --git a/addon-sdk/source/bin/cfx.bat b/addon-sdk/source/bin/cfx.bat
deleted file mode 100644
index 215b034f5..000000000
--- a/addon-sdk/source/bin/cfx.bat
+++ /dev/null
@@ -1,6 +0,0 @@
-@echo off
-rem This Source Code Form is subject to the terms of the Mozilla Public
-rem License, v. 2.0. If a copy of the MPL was not distributed with this
-rem file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-python "%VIRTUAL_ENV%\bin\cfx" %*
diff --git a/addon-sdk/source/bin/deactivate.bat b/addon-sdk/source/bin/deactivate.bat
deleted file mode 100644
index e6bcd9293..000000000
--- a/addon-sdk/source/bin/deactivate.bat
+++ /dev/null
@@ -1,23 +0,0 @@
-@echo off
-rem This Source Code Form is subject to the terms of the Mozilla Public
-rem License, v. 2.0. If a copy of the MPL was not distributed with this
-rem file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-if defined _OLD_VIRTUAL_PROMPT (
- set "PROMPT=%_OLD_VIRTUAL_PROMPT%"
-)
-set _OLD_VIRTUAL_PROMPT=
-
-if defined _OLD_VIRTUAL_PATH (
- set "PATH=%_OLD_VIRTUAL_PATH%"
-)
-set _OLD_VIRTUAL_PATH=
-
-if defined _OLD_PYTHONPATH (
- set "PYTHONPATH=%_OLD_PYTHONPATH%"
-)
-set _OLD_PYTHONPATH=
-
-set CUDDLEFISH_ROOT=
-
-:END
diff --git a/addon-sdk/source/bin/fx-download.sh b/addon-sdk/source/bin/fx-download.sh
deleted file mode 100644
index 690208a38..000000000
--- a/addon-sdk/source/bin/fx-download.sh
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/sh
-
-if [ "$JPM_FX_DEBUG" = "1" ]; then
- fx-download --branch nightly -c prerelease --host ftp.mozilla.org ../firefox --debug
-else
- fx-download --branch nightly -c prerelease --host ftp.mozilla.org ../firefox
-fi
diff --git a/addon-sdk/source/bin/integration-scripts/buildbot-run-cfx-helper b/addon-sdk/source/bin/integration-scripts/buildbot-run-cfx-helper
deleted file mode 100755
index 56c76ad32..000000000
--- a/addon-sdk/source/bin/integration-scripts/buildbot-run-cfx-helper
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/bash
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-
-source ./bin/activate
-if [ type -P xvfb-run ]
-then
- xvfb-run cfx $*
-else
- cfx $*
-fi
-deactivate
diff --git a/addon-sdk/source/bin/integration-scripts/integration-check b/addon-sdk/source/bin/integration-scripts/integration-check
deleted file mode 100644
index 2505c15dc..000000000
--- a/addon-sdk/source/bin/integration-scripts/integration-check
+++ /dev/null
@@ -1,364 +0,0 @@
-#!/usr/bin/env python
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-import os
-import signal
-import threading
-import urllib2, urllib
-import zipfile
-import tarfile
-import subprocess
-import optparse
-import sys, re
-#import win32api
-
-
-class SDK:
- def __init__(self):
- try:
- # Take the current working directory
- self.default_path = os.getcwd()
- if sys.platform == "win32":
- self.mswindows = True
- else:
- self.mswindows = False
- # Take the default home path of the user.
- home = os.path.expanduser('~')
-
- # The following are the parameters that can be used to pass a dynamic URL, a specific path or a binry. The binary is not used yet. It will be used in version 2.0
- # If a dynamic path is to be mentioned, it should start with a '/'. For eg. "/Desktop"
- parser = optparse.OptionParser()
- parser.add_option('-u', '--url', dest = 'url', default = 'https://ftp.mozilla.org/pub/mozilla.org/labs/jetpack/addon-sdk-latest.zip')
- parser.add_option('-p', '--path', dest = 'path', default = self.default_path)
- parser.add_option('-b', '--binary', dest = 'binary')#, default='/Applications/Firefox.app')
- (options, args) = parser.parse_args()
-
- # Get the URL from the parameter
- self.link = options.url
- # Set the base path for the user. If the user supplies the path, use the home variable as well. Else, take the default path of this script as the installation directory.
- if options.path!=self.default_path:
- if self.mswindows:
- self.base_path = home + str(options.path).strip() + '\\'
- else:
- self.base_path = home + str(options.path).strip() + '/'
- else:
- if self.mswindows:
- self.base_path = str(options.path).strip() + '\\'
- else:
- self.base_path = str(options.path).strip() + '/'
- assert ' ' not in self.base_path, "You cannot have a space in your home path. Please remove the space before you continue."
- print('Your Base path is =' + self.base_path)
-
- # This assignment is not used in this program. It will be used in version 2 of this script.
- self.bin = options.binary
- # if app or bin is empty, dont pass anything
-
- # Search for the .zip file or tarball file in the URL.
- i = self.link.rfind('/')
-
- self.fname = self.link[i+1:]
- z = re.search('zip',self.fname,re.I)
- g = re.search('gz',self.fname,re.I)
- if z:
- print 'zip file present in the URL.'
- self.zip = True
- self.gz = False
- elif g:
- print 'gz file present in the URL'
- self.gz = True
- self.zip = False
- else:
- print 'zip/gz file not present. Check the URL.'
- return
- print("File name is =" + self.fname)
-
- # Join the base path and the zip/tar file name to crate a complete Local file path.
- self.fpath = self.base_path + self.fname
- print('Your local file path will be=' + self.fpath)
- except AssertionError, e:
- print e.args[0]
- sys.exit(1)
-
- # Download function - to download the SDK from the URL to the local machine.
- def download(self,url,fpath,fname):
- try:
- # Start the download
- print("Downloading...Please be patient!")
- urllib.urlretrieve(url,filename = fname)
- print('Download was successful.')
- except ValueError: # Handles broken URL errors.
- print 'The URL is ether broken or the file does not exist. Please enter the correct URL.'
- raise
- except urllib2.URLError: # Handles URL errors
- print '\nURL not correct. Check again!'
- raise
-
- # Function to extract the downloaded zipfile.
- def extract(self, zipfilepath, extfile):
- try:
- # Timeout is set to 30 seconds.
- timeout = 30
- # Change the directory to the location of the zip file.
- try:
- os.chdir(zipfilepath)
- except OSError:
- # Will reach here if zip file doesnt exist
- print 'O/S Error:' + zipfilepath + 'does not exist'
- raise
-
- # Get the folder name of Jetpack to get the exact version number.
- if self.zip:
- try:
- f = zipfile.ZipFile(extfile, "r")
- except IOError as (errno, strerror): # Handles file errors
- print "I/O error - Cannot perform extract operation: {1}".format(errno, strerror)
- raise
- list = f.namelist()[0]
- temp_name = list.split('/')
- print('Folder Name= ' +temp_name[0])
- self.folder_name = temp_name[0]
- elif self.gz:
- try:
- f = tarfile.open(extfile,'r')
- except IOError as (errno, strerror): # Handles file errors
- print "I/O error - Cannot perform extract operation: {1}".format(errno, strerror)
- raise
- list = f.getnames()[0]
- temp_name = list.split('/')
- print('Folder Name= ' +temp_name[0])
- self.folder_name = temp_name[0]
-
- print ('Starting to Extract...')
-
- # Timeout code. The subprocess.popen exeutes the command and the thread waits for a timeout. If the process does not finish within the mentioned-
- # timeout, the process is killed.
- kill_check = threading.Event()
-
- if self.zip:
- # Call the command to unzip the file.
- if self.mswindows:
- zipfile.ZipFile.extractall(f)
- else:
- p = subprocess.Popen('unzip '+extfile, stdout=subprocess.PIPE, shell=True)
- pid = p.pid
- elif self.gz:
- # Call the command to untar the file.
- if self.mswindows:
- tarfile.TarFile.extractall(f)
- else:
- p = subprocess.Popen('tar -xf '+extfile, stdout=subprocess.PIPE, shell=True)
- pid = p.pid
-
- #No need to handle for windows because windows automatically replaces old files with new files. It does not ask the user(as it does in Mac/Unix)
- if self.mswindows==False:
- watch = threading.Timer(timeout, kill_process, args=(pid, kill_check, self.mswindows ))
- watch.start()
- (stdout, stderr) = p.communicate()
- watch.cancel() # if it's still waiting to run
- success = not kill_check.isSet()
-
- # Abort process if process fails.
- if not success:
- raise RuntimeError
- kill_check.clear()
- print('Extraction Successful.')
- except RuntimeError:
- print "Ending the program"
- sys.exit(1)
- except:
- print "Error during file extraction: ", sys.exc_info()[0]
- raise
-
- # Function to run the cfx testall comands and to make sure the SDK is not broken.
- def run_testall(self, home_path, folder_name):
- try:
- timeout = 500
-
- self.new_dir = home_path + folder_name
- try:
- os.chdir(self.new_dir)
- except OSError:
- # Will reach here if the jetpack 0.X directory doesnt exist
- print 'O/S Error: Jetpack directory does not exist at ' + self.new_dir
- raise
- print '\nStarting tests...'
- # Timeout code. The subprocess.popen exeutes the command and the thread waits for a timeout. If the process does not finish within the mentioned-
- # timeout, the process is killed.
- kill_check = threading.Event()
-
- # Set the path for the logs. They will be in the parent directory of the Jetpack SDK.
- log_path = home_path + 'tests.log'
-
- # Subprocess call to set up the jetpack environment and to start the tests. Also sends the output to a log file.
- if self.bin != None:
- if self.mswindows:
- p = subprocess.Popen("bin\\activate && cfx testall -a firefox -b \"" + self.bin + "\"" , stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
- proc_handle = p._handle
- (stdout,stderr) = p.communicate()
- else:
- p = subprocess.Popen('. bin/activate; cfx testall -a firefox -b ' + self.bin , stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
- pid = p.pid
- (stdout,stderr) = p.communicate()
- elif self.bin == None:
- if self.mswindows:
- p=subprocess.Popen('bin\\activate && cfx testall -a firefox > '+log_path, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
- proc_handle = p._handle
- (stdout,stderr) = p.communicate()
- else:
- p = subprocess.Popen('. bin/activate; cfx testall -a firefox > '+log_path, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
- pid = p.pid
- (stdout,stderr) = p.communicate()
-
- #Write the output to log file
- f=open(log_path,"w")
- f.write(stdout+stderr)
- f.close()
-
- #Watchdog for timeout process
- if self.mswindows:
- watch = threading.Timer(timeout, kill_process, args=(proc_handle, kill_check, self.mswindows))
- else:
- watch = threading.Timer(timeout, kill_process, args=(pid, kill_check, self.mswindows))
- watch.start()
- watch.cancel() # if it's still waiting to run
- success = not kill_check.isSet()
- if not success:
- raise RuntimeError
- kill_check.clear()
-
- if p.returncode!=0:
- print('\nAll tests were not successful. Check the test-logs in the jetpack directory.')
- result_sdk(home_path)
- #sys.exit(1)
- raise RuntimeError
- else:
- ret_code=result_sdk(home_path)
- if ret_code==0:
- print('\nAll tests were successful. Yay \o/ . Running a sample package test now...')
- else:
- print ('\nThere were errors during the tests.Take a look at logs')
- raise RuntimeError
- except RuntimeError:
- print "Ending the program"
- sys.exit(1)
- except:
- print "Error during the testall command execution:", sys.exc_info()[0]
- raise
-
- def package(self, example_dir):
- try:
- timeout = 30
-
- print '\nNow Running packaging tests...'
-
- kill_check = threading.Event()
-
- # Set the path for the example logs. They will be in the parent directory of the Jetpack SDK.
- exlog_path = example_dir + 'test-example.log'
- # Subprocess call to test the sample example for packaging.
- if self.bin!=None:
- if self.mswindows:
- p = subprocess.Popen('bin\\activate && cfx run --pkgdir examples\\reading-data --static-args="{\\"quitWhenDone\\":true}" -b \"" + self.bin + "\"' , stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
- proc_handle = p._handle
- (stdout, stderr) = p.communicate()
- else:
- p = subprocess.Popen('. bin/activate; cfx run --pkgdir examples/reading-data --static-args=\'{\"quitWhenDone\":true}\' -b ' + self.bin , stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
- pid = p.pid
- (stdout, stderr) = p.communicate()
- elif self.bin==None:
- if self.mswindows:
- p = subprocess.Popen('bin\\activate && cfx run --pkgdir examples\\reading-data --static-args="{\\"quitWhenDone\\":true}"', stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
- proc_handle = p._handle
- (stdout, stderr) = p.communicate()
- else:
- p = subprocess.Popen('. bin/activate; cfx run --pkgdir examples/reading-data --static-args=\'{\"quitWhenDone\":true}\' ', stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
- pid = p.pid
- (stdout, stderr) = p.communicate()
-
- #Write the output to log file
- f=open(exlog_path,"w")
- f.write(stdout+stderr)
- f.close()
-
- #Watch dog for timeout process
- if self.mswindows:
- watch = threading.Timer(timeout, kill_process, args=(proc_handle, kill_check, self.mswindows))
- else:
- watch = threading.Timer(timeout, kill_process, args=(pid, kill_check, self.mswindows))
- watch.start()
- watch.cancel() # if it's still waiting to run
- success = not kill_check.isSet()
- if not success:
- raise RuntimeError
- kill_check.clear()
-
- if p.returncode != 0:
- print('\nSample tests were not executed correctly. Check the test-example log in jetpack diretory.')
- result_example(example_dir)
- raise RuntimeError
- else:
- ret_code=result_example(example_dir)
- if ret_code==0:
- print('\nAll tests pass. The SDK is working! Yay \o/')
- else:
- print ('\nTests passed with warning.Take a look at logs')
- sys.exit(1)
-
- except RuntimeError:
- print "Ending program"
- sys.exit(1)
- except:
- print "Error during running sample tests:", sys.exc_info()[0]
- raise
-
-def result_sdk(sdk_dir):
- log_path = sdk_dir + 'tests.log'
- print 'Results are logged at:' + log_path
- try:
- f = open(log_path,'r')
- # Handles file errors
- except IOError :
- print 'I/O error - Cannot open test log at ' + log_path
- raise
-
- for line in reversed(open(log_path).readlines()):
- if line.strip()=='FAIL':
- print ('\nOverall result - FAIL. Look at the test log at '+log_path)
- return 1
- return 0
-
-
-def result_example(sdk_dir):
- exlog_path = sdk_dir + 'test-example.log'
- print 'Sample test results are logged at:' + exlog_path
- try:
- f = open(exlog_path,'r')
- # Handles file errors
- except IOError :
- print 'I/O error - Cannot open sample test log at ' + exlog_path
- raise
-
- #Read the file in reverse and check for the keyword 'FAIL'.
- for line in reversed(open(exlog_path).readlines()):
- if line.strip()=='FAIL':
- print ('\nOverall result for Sample tests - FAIL. Look at the test log at '+exlog_path)
- return 1
- return 0
-
-def kill_process(process, kill_check, mswindows):
- print '\nProcess Timedout. Killing the process. Please Rerun this script.'
- if mswindows:
- win32api.TerminateProcess(process, -1)
- else:
- os.kill(process, signal.SIGKILL)
- kill_check.set()# tell the main routine to kill. Used SIGKILL to hard kill the process.
- return
-
-if __name__ == "__main__":
- obj = SDK()
- obj.download(obj.link,obj.fpath,obj.fname)
- obj.extract(obj.base_path,obj.fname)
- obj.run_testall(obj.base_path,obj.folder_name)
- obj.package(obj.base_path)
diff --git a/addon-sdk/source/bin/jpm-test.js b/addon-sdk/source/bin/jpm-test.js
deleted file mode 100644
index f22a552ea..000000000
--- a/addon-sdk/source/bin/jpm-test.js
+++ /dev/null
@@ -1,34 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-"use strict";
-
-var Promise = require("promise");
-var Mocha = require("mocha");
-var mocha = new Mocha({
- ui: "bdd",
- reporter: "spec",
- timeout: 900000
-});
-
-var isDebug = require("./node-scripts/utils").isDebug;
-
-exports.run = function(type) {
- return new Promise(function(resolve) {
- type = type || "";
- [
- (!isDebug && /^(firefox-bin)?$/.test(type)) && require.resolve("../bin/node-scripts/test.firefox-bin"),
- (!isDebug && /^(docs)?$/.test(type)) && require.resolve("../bin/node-scripts/test.docs"),
- (!isDebug && /^(ini)?$/.test(type)) && require.resolve("../bin/node-scripts/test.ini"),
- (/^(examples)?$/.test(type)) && require.resolve("../bin/node-scripts/test.examples"),
- (!isDebug && /^(addons)?$/.test(type)) && require.resolve("../bin/node-scripts/test.addons"),
- (!isDebug && /^(modules)?$/.test(type)) && require.resolve("../bin/node-scripts/test.modules"),
- ].forEach(function(filepath) {
- filepath && mocha.addFile(filepath);
- })
-
- mocha.run(function(failures) {
- resolve(failures);
- });
- });
-}
diff --git a/addon-sdk/source/bin/node-scripts/apply-patch.js b/addon-sdk/source/bin/node-scripts/apply-patch.js
deleted file mode 100644
index 31fbf7d31..000000000
--- a/addon-sdk/source/bin/node-scripts/apply-patch.js
+++ /dev/null
@@ -1,64 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-"use strict";
-
-var path = require("path");
-var cp = require("child_process");
-var fs = require("fs");
-var Promise = require("promise");
-var patcher = require("patch-editor");
-var readParam = require("./utils").readParam;
-
-var isKeeper = /\/addon-sdk\/source/;
-
-function apply(options) {
- return clean(options).then(function() {
- return new Promise(function(resolve) {
- var patch = path.resolve(readParam("patch"));
- var proc = cp.spawn("git", ["apply", patch]);
- proc.stdout.pipe(process.stdout);
- proc.stderr.pipe(process.stderr);
- proc.on("close", resolve);
- });
- });
-}
-exports.apply = apply;
-
-function clean(options) {
- return new Promise(function(resolve) {
- var patch = path.resolve(readParam("patch"));
- if (!patch) {
- throw new Error("no --patch was provided.");
- }
- console.log("Cleaning patch " + patch);
-
- patcher.getChunks({ patch: patch }).then(function(chunks) {
- var keepers = [];
-
- for (var i = chunks.length - 1; i >= 0; i--) {
- var chunk = chunks[i];
- var files = chunk.getFilesChanged();
-
- // check if the file changed is related to the addon-sdk/source directory
- var keepIt = files.map(function(file) {
- return (isKeeper.test(file));
- }).reduce(function(prev, curr) {
- return prev || curr;
- }, false);
-
- if (keepIt) {
- keepers.push(chunk);
- }
- }
-
- var contents = "\n" + keepers.join("\n") + "\n";
- contents = contents.replace(/\/addon-sdk\/source/g, "");
-
- fs.writeFileSync(patch, contents, { encoding: "utf8" });
-
- console.log("Done cleaning patch.");
- }).then(resolve).catch(console.error);
- });
-}
-exports.clean = clean;
diff --git a/addon-sdk/source/bin/node-scripts/test.addons.js b/addon-sdk/source/bin/node-scripts/test.addons.js
deleted file mode 100644
index dc7c6dfce..000000000
--- a/addon-sdk/source/bin/node-scripts/test.addons.js
+++ /dev/null
@@ -1,57 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-"use strict";
-
-var utils = require("./utils");
-var path = require("path");
-var fs = require("fs");
-var jpm = utils.run;
-var readParam = utils.readParam;
-var isDebug = utils.isDebug;
-
-var addonsPath = path.join(__dirname, "..", "..", "test", "addons");
-
-var binary = process.env.JPM_FIREFOX_BINARY || "nightly";
-var filterPattern = readParam("filter");
-
-describe("jpm test sdk addons", function () {
- fs.readdirSync(addonsPath)
- .filter(fileFilter.bind(null, addonsPath))
- .forEach(function (file) {
- it(file, function (done) {
- var addonPath = path.join(addonsPath, file);
- process.chdir(addonPath);
-
- var options = { cwd: addonPath, env: { JPM_FIREFOX_BINARY: binary }};
- if (process.env.DISPLAY) {
- options.env.DISPLAY = process.env.DISPLAY;
- }
- if (/^e10s/.test(file)) {
- options.e10s = true;
- }
-
- jpm("run", options).then(done).catch(done);
- });
- });
-});
-
-function fileFilter(root, file) {
- var matcher = filterPattern && new RegExp(filterPattern);
- if (/^(l10n-properties|simple-prefs|page-mod-debugger)/.test(file)) {
- return false;
- }
-
- // filter additional add-ons when using debug builds
- if (isDebug) {
- if (/^(chrome|e10s)/.test(file)) {
- return false;
- }
- }
-
- if (matcher && !matcher.test(file)) {
- return false;
- }
- var stat = fs.statSync(path.join(root, file))
- return (stat && stat.isDirectory());
-}
diff --git a/addon-sdk/source/bin/node-scripts/test.docs.js b/addon-sdk/source/bin/node-scripts/test.docs.js
deleted file mode 100644
index e6aef516d..000000000
--- a/addon-sdk/source/bin/node-scripts/test.docs.js
+++ /dev/null
@@ -1,145 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-"use strict";
-
-var createHash = require('crypto').createHash;
-var fs = require("fs");
-var fsExtra = require("fs-extra")
-var path = require("path");
-var Promise = require("promise");
-var chai = require("chai");
-var expect = chai.expect;
-var teacher = require("teacher");
-
-var rootURI = path.join(__dirname, "..", "..");
-
-// get a list of words that fail spell check but are still acceptable
-var NEW_WORDS = fs.readFileSync(path.join(__dirname, "words.txt")).toString().trim().split("\n");
-
-var CACHE_PATH = path.join(__dirname, "..", "..", "cache", "spellchecks.json");
-
-var CACHE = {};
-
-try {
- CACHE = JSON.parse(fs.readFileSync(CACHE_PATH).toString());
-}
-catch (e) {}
-
-function md5(str) {
- return createHash("md5").update(str).digest("utf8");
-}
-
-function addCacheHash(hash) {
- CACHE[hash] = true;
- fsExtra.ensureFileSync(CACHE_PATH);
- fsExtra.writeJSONSync(CACHE_PATH, CACHE);
-}
-
-describe("Spell Checking", function () {
- it("Spellcheck CONTRIBUTING.md", function (done) {
- var readme = path.join(rootURI, "CONTRIBUTING.md");
-
- fs.readFile(readme, function (err, data) {
- if (err) {
- throw err;
- }
- var text = data.toString();
- var hash = md5(text);
-
- // skip this test if we know we have done the
- // exact same test with positive results before
- if (CACHE[hash]) {
- expect(CACHE[hash]).to.be.equal(true);
- return done();
- }
-
- teacher.check(text, function(err, data) {
- expect(err).to.be.equal(null);
-
- var results = data || [];
- results = results.filter(function(result) {
- if (NEW_WORDS.indexOf(result.string.toLowerCase()) != -1) {
- return false;
- }
-
- // ignore anything that starts with a dash
- if (result.string[0] == "-") {
- return false;
- }
-
- if (!(new RegExp(result.string)).test(text)) {
- return false;
- }
-
- return true;
- })
-
- if (results.length > 0) {
- console.log(results);
- }
- else {
- addCacheHash(hash);
- }
-
- expect(results.length).to.be.equal(0);
-
- setTimeout(done, 500);
- });
- });
- });
-
- it("Spellcheck README.md", function (done) {
- var readme = path.join(rootURI, "README.md");
-
- fs.readFile(readme, function (err, data) {
- if (err) {
- throw err;
- }
- var text = data.toString();
- var hash = md5(text);
-
- // skip this test if we know we have done the
- // exact same test with positive results before
- if (CACHE[hash]) {
- expect(CACHE[hash]).to.be.equal(true);
- return done();
- }
-
- teacher.check(text, function(err, data) {
- expect(err).to.be.equal(null);
-
- var results = data || [];
- results = results.filter(function(result) {
- if (NEW_WORDS.indexOf(result.string.toLowerCase()) != -1) {
- return false;
- }
-
- // ignore anything that starts with a dash
- if (result.string[0] == "-") {
- return false;
- }
-
- // ignore anything that we don't find in the original text,
- // for some reason "bootstrap.js" becomes "bootstrapjs".
- if (!(new RegExp(result.string)).test(text)) {
- return false;
- }
-
- return true;
- })
-
- if (results.length > 0) {
- console.log(results);
- }
- else {
- addCacheHash(hash);
- }
-
- expect(results.length).to.be.equal(0);
-
- done();
- });
- });
- });
-});
diff --git a/addon-sdk/source/bin/node-scripts/test.examples.js b/addon-sdk/source/bin/node-scripts/test.examples.js
deleted file mode 100644
index 71f7ee43c..000000000
--- a/addon-sdk/source/bin/node-scripts/test.examples.js
+++ /dev/null
@@ -1,45 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-"use strict";
-
-var utils = require("./utils");
-var path = require("path");
-var fs = require("fs");
-var jpm = utils.run;
-var readParam = utils.readParam;
-
-var examplesPath = path.join(__dirname, "..", "..", "examples");
-
-var binary = process.env.JPM_FIREFOX_BINARY || "nightly";
-var filterPattern = readParam("filter");
-
-describe("jpm test sdk examples", function () {
- fs.readdirSync(examplesPath)
- .filter(fileFilter.bind(null, examplesPath))
- .forEach(function (file) {
- it(file, function (done) {
- var addonPath = path.join(examplesPath, file);
- process.chdir(addonPath);
-
- var options = { cwd: addonPath, env: { JPM_FIREFOX_BINARY: binary }};
- if (process.env.DISPLAY) {
- options.env.DISPLAY = process.env.DISPLAY;
- }
-
- jpm("test", options).then(done);
- });
- });
-});
-
-function fileFilter(root, file) {
- var matcher = filterPattern && new RegExp(filterPattern);
- if (/^(reading-data)/.test(file)) {
- return false;
- }
- if (matcher && !matcher.test(file)) {
- return false;
- }
- var stat = fs.statSync(path.join(root, file))
- return (stat && stat.isDirectory());
-}
diff --git a/addon-sdk/source/bin/node-scripts/test.firefox-bin.js b/addon-sdk/source/bin/node-scripts/test.firefox-bin.js
deleted file mode 100644
index 2570dae20..000000000
--- a/addon-sdk/source/bin/node-scripts/test.firefox-bin.js
+++ /dev/null
@@ -1,37 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-"use strict";
-
-var fs = require("fs");
-var Promise = require("promise");
-var chai = require("chai");
-var expect = chai.expect;
-var normalizeBinary = require("fx-runner/lib/utils").normalizeBinary;
-
-//var firefox_binary = process.env["JPM_FIREFOX_BINARY"] || normalizeBinary("nightly");
-
-describe("Checking Firefox binary", function () {
-
- it("using matching fx-runner version with jpm", function () {
- var sdkPackageJSON = require("../../package.json");
- var jpmPackageINI = require("jpm/package.json");
- expect(sdkPackageJSON.devDependencies["fx-runner"]).to.be.equal(jpmPackageINI.dependencies["fx-runner"]);
- });
-
- it("exists", function (done) {
- var useEnvVar = new Promise(function(resolve) {
- resolve(process.env["JPM_FIREFOX_BINARY"]);
- });
-
- var firefox_binary = process.env["JPM_FIREFOX_BINARY"] ? useEnvVar : normalizeBinary("nightly");
- firefox_binary.then(function(path) {
- expect(path).to.be.ok;
- fs.exists(path, function (exists) {
- expect(exists).to.be.ok;
- done();
- });
- })
- });
-
-});
diff --git a/addon-sdk/source/bin/node-scripts/test.ini.js b/addon-sdk/source/bin/node-scripts/test.ini.js
deleted file mode 100644
index 07bd15d1f..000000000
--- a/addon-sdk/source/bin/node-scripts/test.ini.js
+++ /dev/null
@@ -1,68 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-"use strict";
-
-var fs = require("fs");
-var path = require("path");
-var Promise = require("promise");
-var chai = require("chai");
-var expect = chai.expect;
-var ini = require("./update-ini");
-
-var addonINI = path.resolve("./test/addons/jetpack-addon.ini");
-var packageINI = path.resolve("./test/jetpack-package.ini");
-
-describe("Checking ini files", function () {
-
- it("Check test/addons/jetpack-addon.ini", function (done) {
-
- fs.readFile(addonINI, function (err, data) {
- if (err) {
- throw err;
- }
- // filter comments
- var text = data.toString().split("\n").filter(function(line) {
- return !/^\s*#/.test(line);
- }).join("\n");
- var expected = "";
-
- ini.makeAddonIniContent()
- .then(function(contents) {
- expected = contents;
-
- setTimeout(function end() {
- expect(text.trim()).to.be.equal(expected.trim());
- done();
- });
- });
- });
-
- });
-
- it("Check test/jetpack-package.ini", function (done) {
-
- fs.readFile(packageINI, function (err, data) {
- if (err) {
- throw err;
- }
- // filter comments
- var text = data.toString().split("\n").filter(function(line) {
- return !/^\s*#/.test(line);
- }).join("\n");
- var expected = "";
-
- ini.makePackageIniContent()
- .then(function(contents) {
- expected = contents;
-
- setTimeout(function end() {
- expect(text.trim()).to.be.equal(expected.trim());
- done();
- });
- });
- });
-
- });
-
-});
diff --git a/addon-sdk/source/bin/node-scripts/test.modules.js b/addon-sdk/source/bin/node-scripts/test.modules.js
deleted file mode 100644
index eb400a5f3..000000000
--- a/addon-sdk/source/bin/node-scripts/test.modules.js
+++ /dev/null
@@ -1,28 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-"use strict";
-
-var utils = require("./utils");
-var readParam = utils.readParam;
-var path = require("path");
-var fs = require("fs");
-var jpm = utils.run;
-var sdk = path.join(__dirname, "..", "..");
-var binary = process.env.JPM_FIREFOX_BINARY || "nightly";
-
-var filterPattern = readParam("filter");
-
-describe("jpm test sdk modules", function () {
- it("SDK Modules", function (done) {
- process.chdir(sdk);
-
- var options = { cwd: sdk, env: { JPM_FIREFOX_BINARY: binary } };
- if (process.env.DISPLAY) {
- options.env.DISPLAY = process.env.DISPLAY;
- }
- options.filter = filterPattern;
-
- jpm("test", options, process).then(done);
- });
-});
diff --git a/addon-sdk/source/bin/node-scripts/update-ini.js b/addon-sdk/source/bin/node-scripts/update-ini.js
deleted file mode 100644
index 634cbc1de..000000000
--- a/addon-sdk/source/bin/node-scripts/update-ini.js
+++ /dev/null
@@ -1,141 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-"use strict";
-
-var path = require("path");
-var cp = require("child_process");
-var fs = require("fs");
-var Promise = require("promise");
-var parser = require("ini-parser");
-
-var addonINI = path.resolve("./test/addons/jetpack-addon.ini");
-var addonsDir = path.resolve("./test/addons/");
-var packageINI = path.resolve("./test/jetpack-package.ini");
-var packageDir = path.resolve("./test/");
-var packageIgnorables = [ "addons", "preferences" ];
-var packageSupportFiles = [
- "fixtures.js",
- "test-context-menu.html",
- "util.js"
-]
-
-function updateAddonINI() {
- return new Promise(function(resolve) {
- console.log("Start updating " + addonINI);
-
- makeAddonIniContent().
- then(function(contents) {
- fs.writeFileSync(addonINI, contents, { encoding: "utf8" });
- console.log("Done updating " + addonINI);
- resolve();
- });
- })
-}
-exports.updateAddonINI = updateAddonINI;
-
-function makeAddonIniContent() {
- return new Promise(function(resolve) {
- var data = parser.parse(fs.readFileSync(addonINI, { encoding: "utf8" }).toString());
- var result = {};
-
- fs.readdir(addonsDir, function(err, files) {
- // get a list of folders
- var folders = files.filter(function(file) {
- return fs.statSync(path.resolve(addonsDir, file)).isDirectory();
- }).sort();
-
- // copy any related data from the existing ini
- folders.forEach(function(folder) {
- var oldData = data[folder + ".xpi"];
- result[folder] = oldData ? oldData : {};
- });
-
- // build a new ini file
- var contents = [];
- Object.keys(result).sort().forEach(function(key) {
- contents.push("[" + key + ".xpi]");
- Object.keys(result[key]).forEach(function(dataKey) {
- contents.push(dataKey + " = " + result[key][dataKey]);
- });
- });
- contents = contents.join("\n") + "\n";
-
- return resolve(contents);
- });
- });
-}
-exports.makeAddonIniContent = makeAddonIniContent;
-
-function makePackageIniContent() {
- return new Promise(function(resolve) {
- var data = parser.parse(fs.readFileSync(packageINI, { encoding: "utf8" }).toString());
- var result = {};
-
- fs.readdir(packageDir, function(err, files) {
- // get a list of folders
- var folders = files.filter(function(file) {
- var ignore = (packageIgnorables.indexOf(file) >= 0);
- var isDir = fs.statSync(path.resolve(packageDir, file)).isDirectory();
- return (isDir && !ignore);
- }).sort();
-
- // get a list of "test-"" files
- var files = files.filter(function(file) {
- var ignore = !/^test\-.*\.js$/i.test(file);
- var isDir = fs.statSync(path.resolve(packageDir, file)).isDirectory();
- return (!isDir && !ignore);
- }).sort();
-
- // get a list of the support files
- var support_files = packageSupportFiles.map(function(file) {
- return " " + file;
- });
- folders.forEach(function(folder) {
- support_files.push(" " + folder + "/**");
- });
- support_files = support_files.sort();
-
- // copy any related data from the existing ini
- files.forEach(function(file) {
- var oldData = data[file];
- result[file] = oldData ? oldData : {};
- });
-
- // build a new ini file
- var contents = [
- "[DEFAULT]",
- "support-files ="
- ];
- support_files.forEach(function(support_file) {
- contents.push(support_file);
- });
- contents.push("");
-
- Object.keys(result).sort().forEach(function(key) {
- contents.push("[" + key + "]");
- Object.keys(result[key]).forEach(function(dataKey) {
- contents.push(dataKey + " = " + result[key][dataKey]);
- });
- });
- contents = contents.join("\n") + "\n";
-
- return resolve(contents);
- });
- });
-}
-exports.makePackageIniContent = makePackageIniContent;
-
-function updatePackageINI() {
- return new Promise(function(resolve) {
- console.log("Start updating " + packageINI);
-
- makeAddonIniContent().
- then(function(contents) {
- fs.writeFileSync(packageINI, contents, { encoding: "utf8" });
- console.log("Done updating " + packageINI);
- resolve();
- });
- })
-}
-exports.updatePackageINI = updatePackageINI;
diff --git a/addon-sdk/source/bin/node-scripts/utils.js b/addon-sdk/source/bin/node-scripts/utils.js
deleted file mode 100644
index 1d7f94474..000000000
--- a/addon-sdk/source/bin/node-scripts/utils.js
+++ /dev/null
@@ -1,104 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-"use strict";
-
-var _ = require("lodash");
-var path = require("path");
-var child_process = require("child_process");
-var jpm = require.resolve("../../node_modules/jpm/bin/jpm");
-var Promise = require("promise");
-var chai = require("chai");
-var expect = chai.expect;
-var assert = chai.assert;
-var DEFAULT_PROCESS = process;
-
-var sdk = path.join(__dirname, "..", "..");
-var prefsPath = path.join(sdk, "test", "preferences", "test-preferences.js");
-var e10sPrefsPath = path.join(sdk, "test", "preferences", "test-e10s-preferences.js");
-
-var OUTPUT_FILTERS = [
- /[^\n\r]+WARNING\: NS_ENSURE_SUCCESS\(rv, rv\) failed[^\n]+\n\r?/
-];
-
-var isDebug = (process.env["JPM_FX_DEBUG"] == "1");
-exports.isDebug = isDebug;
-
-function spawn (cmd, options) {
- options = options || {};
- var env = _.extend({}, options.env, process.env);
-
- if (isDebug) {
- env["MOZ_QUIET"] = 1;
- }
-
- var e10s = options.e10s || false;
-
- return child_process.spawn("node", [
- jpm, cmd, "-v", "--tbpl",
- "--prefs", e10s ? e10sPrefsPath : prefsPath,
- "-o", sdk,
- "-f", options.filter || ""
- ], {
- cwd: options.cwd || tmpOutputDir,
- env: env
- });
-}
-exports.spawn = spawn;
-
-function run (cmd, options, p) {
- return new Promise(function(resolve) {
- var output = [];
-
- var proc = spawn(cmd, options);
- proc.stderr.pipe(process.stderr);
- proc.stdout.on("data", function (data) {
- for (var i = OUTPUT_FILTERS.length - 1; i >= 0; i--) {
- if (OUTPUT_FILTERS[i].test(data)) {
- return null;
- }
- }
- output.push(data);
- return null;
- });
-
- if (p) {
- proc.stdout.pipe(p.stdout);
- }
- else if (!isDebug) {
- proc.stdout.pipe(DEFAULT_PROCESS.stdout);
- }
- else {
- proc.stdout.on("data", function (data) {
- data = (data || "") + "";
- if (/TEST-/.test(data)) {
- DEFAULT_PROCESS.stdout.write(data.replace(/[\s\n]+$/, "") + "\n");
- }
- });
- }
-
- proc.on("close", function(code) {
- var out = output.join("");
- var buildDisplayed = /Build \d+/.test(out);
- var noTests = /No tests were run/.test(out);
- var hasSuccess = /All tests passed!/.test(out);
- var hasFailure = /There were test failures\.\.\./.test(out);
- if (noTests || hasFailure || !hasSuccess || code != 0) {
- DEFAULT_PROCESS.stdout.write(out);
- }
- expect(code).to.equal(hasFailure ? 1 : 0);
- expect(buildDisplayed).to.equal(true);
- expect(hasFailure).to.equal(false);
- expect(hasSuccess).to.equal(true);
- expect(noTests).to.equal(false);
- resolve();
- });
- });
-}
-exports.run = run;
-
-function readParam(name) {
- var index = process.argv.indexOf("--" + name)
- return index >= 0 && process.argv[index + 1]
-}
-exports.readParam = readParam;
diff --git a/addon-sdk/source/bin/node-scripts/words.txt b/addon-sdk/source/bin/node-scripts/words.txt
deleted file mode 100644
index b5b29f74b..000000000
--- a/addon-sdk/source/bin/node-scripts/words.txt
+++ /dev/null
@@ -1,11 +0,0 @@
-addon-sdk
-github
-stackoverflow
-bugzilla
-irc
-jsantell
-mossop
-gozala
-zer0
-autonome
-0c0w3