Skip to content
This repository has been archived by the owner on Oct 7, 2024. It is now read-only.

Commit

Permalink
Automate test (microsoft#704)
Browse files Browse the repository at this point in the history
* test automation

* accept PR comments and update the script.

* upgrade the auto script

* update the script comment.

* tackle all comments.
  • Loading branch information
buptkang authored Feb 21, 2017
1 parent 0c2aa44 commit 6d878bc
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 7 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -186,3 +186,6 @@ ipch/
[Dd]ebug*/
[Rr]elease*/
Ankh.NoLoad

# RN New Version App Generation
Examples/testapp_rn
17 changes: 10 additions & 7 deletions Examples/CodePushDemoApp/demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@ import {

import CodePush from "react-native-code-push";

/**
* Configured with a MANUAL check frequency for easy testing. For production apps, it is recommended to configure a
* different check frequency, such as ON_APP_START, for a 'hands-off' approach where CodePush.sync() does not
* need to be explicitly called. All options of CodePush.sync() are also available in this decorator.
*/
@CodePush({ checkFrequency: CodePush.CheckFrequency.MANUAL })
class CodePushDemoApp extends Component {
constructor() {
super();
Expand Down Expand Up @@ -156,4 +150,13 @@ const styles = StyleSheet.create({
},
});

AppRegistry.registerComponent("CodePushDemoApp", () => CodePushDemoApp);
/**
* Configured with a MANUAL check frequency for easy testing. For production apps, it is recommended to configure a
* different check frequency, such as ON_APP_START, for a 'hands-off' approach where CodePush.sync() does not
* need to be explicitly called. All options of CodePush.sync() are also available in this decorator.
*/
let codePushOptions = { checkFrequency: CodePush.CheckFrequency.MANUAL };

CodePushDemoApp = CodePush(codePushOptions)(CodePushDemoApp);

AppRegistry.registerComponent("CodePushDemoApp", () => CodePushDemoApp);
63 changes: 63 additions & 0 deletions Examples/generate-app.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#!/bin/bash

# Copyright (c) 2015-present, Microsoft Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.

echo 'CodePush + RN sample app generation script';
echo

rm -rf testapp_rn

echo '************************ Configuration ***********************************';

#################### Configure versions #################################################

read -p "Enter React Native version (default: latest):" react_native_version
read -p "Enter CodePush version (default: latest): " react_native_code_push_version

echo

if [ ! $react_native_version]; then
react_native_version=`npm view react-native version`
fi
echo 'React Native version: ' + $react_native_version

if [ ! $react_native_code_push_version ]; then
react_native_code_push_version=`npm view react-native-code-push version`
fi
echo 'React Native Code Push version: ' + $react_native_code_push_version
echo

#################### Create app #########################################################

echo '********************* Creating app ***************************************';

current_dir=`pwd`;
echo 'Current directory: ' + $current_dir;

echo 'Create testapp_rn app';
rninit init testapp_rn --source react-native@$react_native_version

cd testapp_rn

echo 'Install React Native Code Push Version $react_native_code_push_version'
npm install --save react-native-code-push@$react_native_code_push_version

echo 'react native link to react native code push'
react-native link react-native-code-push

rm index.android.js
rm index.ios.js
cp ../CodePushDemoApp/*js .
mkdir images
cp ../CodePushDemoApp/images/* images

# Make changes required to test CodePush in debug mode (see OneNote)
sed -ie '162s/AppRegistry.registerComponent("CodePushDemoApp", () => CodePushDemoApp);/AppRegistry.registerComponent("testapp_rn", () => CodePushDemoApp);/' demo.js
perl -i -p0e 's/#ifdef DEBUG.*?#endif/jsCodeLocation = [CodePush bundleURL];/s' ios/testapp_rn/AppDelegate.m
sed -ie '17,20d' node_modules/react-native/packager/react-native-xcode.sh
sed -ie '90s/targetName.toLowerCase().contains("release")/true/' node_modules/react-native/react.gradle

0 comments on commit 6d878bc

Please sign in to comment.