mirror of
https://github.com/appium/appium.git
synced 2026-05-06 19:09:35 -05:00
move sample code and apps out of main repo
and add a grunt task that brings them in for use in dev
This commit is contained in:
@@ -5,6 +5,7 @@ npm*.log
|
||||
node_modules
|
||||
*.trace
|
||||
xcuserdata
|
||||
sample-code/examples
|
||||
sample-code/apps/TestApp/build
|
||||
sample-code/apps/WebViewApp/build
|
||||
sample-code/apps/WebViewApp/WebViewApp.xcodeproj/project.xcworkspace/xcshareddata
|
||||
|
||||
@@ -52,3 +52,6 @@
|
||||
[submodule "submodules/io.appium.settings"]
|
||||
path = submodules/io.appium.settings
|
||||
url = https://github.com/appium/io.appium.settings.git
|
||||
[submodule "submodules/sample-code"]
|
||||
path = submodules/sample-code
|
||||
url = https://github.com/appium/sample-code
|
||||
|
||||
@@ -19,6 +19,7 @@ var path = require('path')
|
||||
, generateAppiumIo = gruntHelpers.generateAppiumIo
|
||||
, setDeviceConfigVer = gruntHelpers.setDeviceConfigVer
|
||||
, setBuildTime = gruntHelpers.setBuildTime
|
||||
, getSampleCode = gruntHelpers.getSampleCode
|
||||
, setGitRev = gruntHelpers.setGitRev
|
||||
, getGitRev = require('./lib/helpers').getGitRev;
|
||||
|
||||
@@ -155,6 +156,12 @@ module.exports = function (grunt) {
|
||||
grunt.registerTask('setBuildTime', function () {
|
||||
setBuildTime(grunt, this.async());
|
||||
});
|
||||
grunt.registerTask('getSampleCode', function (hardcore) {
|
||||
if (typeof hardcore !== "undefined" && hardcore === "hardcore") {
|
||||
hardcore = true;
|
||||
}
|
||||
getSampleCode(grunt, hardcore, this.async());
|
||||
});
|
||||
grunt.registerTask('setGitRev', function (rev) {
|
||||
var done = this.async();
|
||||
if (typeof rev === "undefined") {
|
||||
|
||||
@@ -8,6 +8,7 @@ kinds of appium dev tasks. Here's what you can do:
|
||||
|grunt lint|Run JSLint|
|
||||
|grunt test|Run the unit tests|
|
||||
|grunt unit|Run the unit tests|
|
||||
|grunt getSampleCode|Download sample code and apps. Accepts `:hardcore` parameter|
|
||||
|grunt buildApp:<AppName>:<SDK>|Build an iOS app for the iPhone Simulator. Expects there to be a .app at `sample-code/apps/<AppName>/build/Release-iphonesimulator/<AppName>.app`. Default SDK is 'iphonesimulator7.1'|
|
||||
|grunt signApp:<certName>|Signs the test app with an absolute path to an iOS dev certificate|
|
||||
|grunt authorize|Authorize your simulator to run without prompting|
|
||||
|
||||
@@ -23,7 +23,7 @@ want to zip it up, you can.
|
||||
|
||||
The best way to see what to do currently is to look at the example tests:
|
||||
|
||||
[Node.js](/sample-code/examples/node) | [Python](/sample-code/examples/python) | [PHP](/sample-code/examples/php) | [Ruby](/sample-code/examples/ruby) | [Java](/sample-code/examples/java)
|
||||
[Node.js](https://github.com/appium/sample-code/sample-code/examples/node) | [Python](https://github.com/appium/sample-code/sample-code/examples/python) | [PHP](https://github.com/appium/sample-code/sample-code/examples/php) | [Ruby](https://github.com/appium/sample-code/sample-code/examples/ruby) | [Java](https://github.com/appium/sample-code/sample-code/examples/java)
|
||||
|
||||
Basically, first make sure Appium is running:
|
||||
|
||||
|
||||
@@ -55,6 +55,52 @@ module.exports.startAppium = function (appName, verbose, readyCb, doneCb) {
|
||||
);
|
||||
};
|
||||
|
||||
var execWithOutput = function (cmd, cb) {
|
||||
exec(cmd, function (err, stdout, stderr) {
|
||||
if (err) {
|
||||
console.error("Command failed");
|
||||
console.error("stdout:");
|
||||
console.error(stdout);
|
||||
console.error("stderr:");
|
||||
console.error(stderr);
|
||||
}
|
||||
cb(err, stdout, stderr);
|
||||
});
|
||||
};
|
||||
|
||||
module.exports.getSampleCode = function (grunt, hardcore, cb) {
|
||||
var submodulesDir = path.resolve(__dirname, "submodules");
|
||||
var sampleCodeGit = path.resolve(submodulesDir, "sample-code");
|
||||
var sampleCodeDir = path.resolve(__dirname, "sample-code");
|
||||
var sampleCodeExists = fs.existsSync(sampleCodeDir);
|
||||
var updateCmd = "git submodule update --init " + sampleCodeGit;
|
||||
console.log("Cloning/updating Appium sample-code submodule");
|
||||
execWithOutput(updateCmd, function (err, stdout, stderr) {
|
||||
if (err) return cb(err);
|
||||
var updated = false;
|
||||
if (stdout + stderr !== "") {
|
||||
// there were submodule updates
|
||||
console.log("There were updates to the submodule");
|
||||
updated = true;
|
||||
}
|
||||
if (hardcore || updated) {
|
||||
console.log("Removing old sample-code");
|
||||
console.log("Please remember to rebuild test apps");
|
||||
rimraf.sync(sampleCodeDir);
|
||||
}
|
||||
if (hardcore || updated || !sampleCodeExists) {
|
||||
console.log("Copying sample-code out for use");
|
||||
ncp(path.resolve(sampleCodeGit, "sample-code"), sampleCodeDir, function (err) {
|
||||
if (err) return cb(err);
|
||||
console.log("Test apps are ready for building");
|
||||
cb();
|
||||
});
|
||||
} else {
|
||||
console.log("Sample code was not updated, doing nothing");
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
module.exports.runTestsWithServer = function (grunt, appName, testType, deviceType, verbose, cb) {
|
||||
if (typeof verbose === "undefined") {
|
||||
verbose = false;
|
||||
|
||||
@@ -53,6 +53,11 @@ if %doDev% == 1 (
|
||||
ECHO.
|
||||
)
|
||||
|
||||
:: Install Sample Code
|
||||
if %doDev% == 1 (
|
||||
CALL :runCmd "node_modules\.bin\grunt getSampleCode"
|
||||
)
|
||||
|
||||
:: Reset Android
|
||||
if %doAndroid% == 1 (
|
||||
ECHO.
|
||||
|
||||
@@ -138,6 +138,15 @@ reset_general() {
|
||||
fi
|
||||
}
|
||||
|
||||
reset_sample_code() {
|
||||
echo "* Initializing sample code and test apps"
|
||||
if $hardcore ; then
|
||||
run_cmd "$grunt" getSampleCode:hardcore
|
||||
else
|
||||
run_cmd "$grunt" getSampleCode
|
||||
fi
|
||||
}
|
||||
|
||||
reset_ios() {
|
||||
echo "RESETTING IOS"
|
||||
set +e
|
||||
@@ -563,6 +572,9 @@ main() {
|
||||
fi
|
||||
reset_npm
|
||||
reset_general
|
||||
if $include_dev ; then
|
||||
reset_sample_code
|
||||
fi
|
||||
if $should_reset_ios ; then
|
||||
reset_ios
|
||||
fi
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
The sample code has moved to [appium/sample-code](https://github.com/appium/sample-code)
|
||||
Submodule
+1
Submodule submodules/sample-code added at 54281146b1
Reference in New Issue
Block a user