Exemplo n.º 1
0
def register_cli_app():
    ios_name = config.CODE_PUSH_IOS_APP_NAME
    if ios_name == '':
        ios_name = config.PROJECT_NAME + '_IOS'

    print '\n\n\n'
    input = raw_input(
        'enter your CODE_PUSH_IOS_APP_NAME. enter to skip and use default ({0}): '
        .format(ios_name))
    if input != '':
        ios_name = input

    config.set_code_push_ios_name(ios_name)

    android_name = config.CODE_PUSH_ANDROID_APP_NAME
    if android_name == '':
        android_name = config.PROJECT_NAME + '_ANDROID'

    input = raw_input(
        'enter your CODE_PUSH_ANDROID_APP_NAME. enter to skip and use default ({0}): '
        .format(android_name))
    if input != '':
        android_name = input

    config.set_code_push_android_name(android_name)

    call([
        'code-push', 'app', 'add', config.CODE_PUSH_IOS_APP_NAME, 'ios',
        'react-native'
    ])
    call([
        'code-push', 'app', 'add', config.CODE_PUSH_ANDROID_APP_NAME,
        'android', 'react-native'
    ])
Exemplo n.º 2
0
def install_cli_package():
    print '\n\n\n'
    enable_install_cli = yes_question(
        'do you want to install code-push-cli? enter to skip if you have installed it.'
    )
    if enable_install_cli:
        call(['yarn', 'global', 'add', 'code-push-cli'])
Exemplo n.º 3
0
def signed_android_apk():
    call([
        'keytool', '-genkey', '-v', '-keystore', 'my-release-key.keystore',
        '-alias', 'my-key-alias', '-keyalg', 'RSA', '-keysize', '2048',
        '-validity', '10000'
    ])
    call([
        'mv', 'my-release-key.keystore',
        '{0}/android/app'.format(config.PROJECT_NAME)
    ])

    print '\n\n\n'
    STORE_RELEASE_PASSWORD = raw_input(
        're-enter your keystore password (for auto config project): ')
    KEY_RELEASE_PASSWORD = raw_input(
        're-enter your key password (for auto config project): ')

    gen_gradle_properties(STORE_RELEASE_PASSWORD, KEY_RELEASE_PASSWORD)
    call([
        'cp', 'resource/gradle.properties',
        '{0}/android/gradle.properties'.format(config.PROJECT_NAME)
    ])

    gen_app_build_gradle()
    call([
        'cp', 'resource/android/build.gradle',
        '{0}/android/app/build.gradle'.format(config.PROJECT_NAME)
    ])

    print '\n\n'
    print '*note: if you want to test code push, please config your app to build release, or you can find it by this link: https://github.com/trustcircleglobal/documents/tree/master/technical/client/code-push#build-your-release-app*'
    print 'press enter to continue...'
    raw_input()
Exemplo n.º 4
0
def fix_code_push_issue():
    global CODE_PUSH_IOS_STAGING
    global CODE_PUSH_ANDROID_STAGING

    gen_main_application()
    call([
        'cp', 'resource/MainApplication.java',
        '{0}/android/app/src/main/java/com/{1}/MainApplication.java'.format(
            config.PROJECT_NAME, config.PROJECT_NAME)
    ])

    gen_strings_xml(CODE_PUSH_ANDROID_STAGING)
    call([
        'cp', 'resource/strings.xml',
        '{0}/android/app/src/main/res/values/strings.xml'.format(
            config.PROJECT_NAME)
    ])

    gen_info_plist(CODE_PUSH_IOS_STAGING)
    call([
        'cp', 'resource/Info.plist',
        '{0}/ios/{1}/Info.plist'.format(config.PROJECT_NAME,
                                        config.PROJECT_NAME)
    ])

    gen_index_js()
    call(['cp', 'resource/index.js', config.PROJECT_NAME])
Exemplo n.º 5
0
def init_fastlane_ios():
  call_cd('{0}/ios'.format(config.PROJECT_NAME))
  call(['fastlane', 'init'])
  call(['touch', 'Gemfile.lock'])
  call_cd('../..')
  
  if config.IOS_BUNDLE_ID == '':
    bundle_id = raw_input('enter your IOS_BUNDLE_ID (com.trustcircle.example): ')
    config.set_ios_bundle_id(bundle_id)
  else:
    bundle_id = config.IOS_BUNDLE_ID
  
  if config.IOS_APPLE_ID == '':
    apple_id = raw_input('enter your IOS_APPLE_ID ([email protected]): ')
    config.set_ios_apple_id(apple_id)
  else:
    apple_id = config.IOS_APPLE_ID
  
  if config.IOS_TEAM_ID == '':
    team_id = raw_input('enter your IOS_TEAM_ID if have (example: L34ETLS***). if no press enter to skip: ')
    config.set_ios_team_id(team_id)
  else:
    team_id = config.IOS_TEAM_ID
  
  gen_ios_appfile(bundle_id, apple_id, team_id)
  call(['cp', 'resource/ios/fastlane/Appfile', '{0}/ios/fastlane/Appfile'.format(config.PROJECT_NAME)])
  call(['cp', 'resource/ios/Gemfile', '{0}/ios/Gemfile'.format(config.PROJECT_NAME)])
Exemplo n.º 6
0
def config_sdk_android():
    local_file = '{0}/android/local.properties'.format(config.PROJECT_NAME)
    user = getpass.getuser()
    sdk_dir = '/Users/{0}/Library/Android/sdk'.format(user)

    print '\n\n\n'
    print 'enter your android sdk location or press enter for default: {0}\n'.format(
        sdk_dir)
    new_dir = raw_input()
    if new_dir != '':
        sdk_dir = new_dir

    call(['touch', local_file])
    write_line(local_file, 'sdk.dir = {0}'.format(sdk_dir))
Exemplo n.º 7
0
def get_cli_staging_key():
    global CODE_PUSH_IOS_STAGING
    global CODE_PUSH_ANDROID_STAGING

    call(
        ['code-push', 'deployment', 'ls', config.CODE_PUSH_IOS_APP_NAME, '-k'])
    call([
        'code-push', 'deployment', 'ls', config.CODE_PUSH_ANDROID_APP_NAME,
        '-k'
    ])

    print '\n\n\n'
    CODE_PUSH_IOS_STAGING = raw_input('enter ios staging key you get above: ')
    CODE_PUSH_ANDROID_STAGING = raw_input(
        'enter android staging key you get above: ')
Exemplo n.º 8
0
def integrate_ios_beta_crashlytic():
  print 'goto Beta Crashlytics Console https://fabric.io/home and get your organization api token and build secrect'
  
  if config.CRASHLYTIC_ORGANIZATION_API_TOKEN == '':
    api_token = raw_input('enter your CRASHLYTIC_ORGANIZATION_API_TOKEN: ')
    config.set_crashlytic_api_token(api_token)
  else:
    api_token = config.CRASHLYTIC_ORGANIZATION_API_TOKEN
  
  if config.CRASHLYTIC_ORGANIZATION_BUILD_SECRECT == '':
    build_secrect = raw_input('enter your CRASHLYTIC_ORGANIZATION_BUILD_SECRECT: ')
    config.set_crashlytic_build_secrect(build_secrect)
  else:
    build_secrect = config.CRASHLYTIC_ORGANIZATION_BUILD_SECRECT
  
  print 'go to Beta Crashlytics Console > see the left menu > select Manage Group (hidden until select Beta tab) > select New Group and create a group with some tester'
  if config.CRASHLYTIC_TESTER_GROUP == '':
    tester_group = raw_input('enter your CRASHLYTIC_TESTER_GROUP: ')
    config.set_crashlytic_tester_group(tester_group)
  else:
    tester_group = config.CRASHLYTIC_TESTER_GROUP
  
  call_cd('{0}/ios'.format(config.PROJECT_NAME))
  call(['pod', 'init'])
  call_cd('../..')
  
  gen_podfile()
  call(['cp', 'resource/ios/Podfile', '{0}/ios/Podfile'.format(config.PROJECT_NAME)])
  
  call_cd('{0}/ios'.format(config.PROJECT_NAME))
  call(['pod', 'install'])
  call_cd('../..')
  
  gen_crashlytic_info_plist(api_token)
  call(['cp', 'resource/Info.plist', '{0}/ios/{1}/Info.plist'.format(config.PROJECT_NAME, config.PROJECT_NAME)])
  
  print '\n\n\n'
  print 'open your xcode target, navigate to build phases and add a new run script'
  print '"${PODS_ROOT}' + '/Fabric/run" {0} {1}'.format(api_token, build_secrect)
  print 'press enter to continue..'
  raw_input()
  
  gen_app_delegate()
  call(['cp', 'resource/ios/AppDelegate.m', '{0}/ios/{1}/AppDelegate.m'.format(config.PROJECT_NAME, config.PROJECT_NAME)])
def setup_deploy_firebase():
    print '\n\n\n'
    enable_install_firebase = yes_question(
        'do you want to install firebase-tools? enter to skip if you have installed it.'
    )
    if enable_install_firebase:
        call(['npm', 'install', '-g', 'firebase-tools'])

    call_cd(config.PROJECT_NAME)
    call(['firebase', 'login'])
    print '\n\n\n'
    print 'now, go to your Firebase console and create your own project. https://console.firebase.google.com/.\npress enter to continue..'
    raw_input()
    project_id = raw_input(
        'enter your project id (find in your app setting.): ')
    call(['firebase', 'init'])
    call_cd('..')

    call(['cp', 'resource/firebase.json', config.PROJECT_NAME])
    gen_firebaserc(project_id)
    call(['cp', 'resource/.firebaserc', config.PROJECT_NAME])
Exemplo n.º 10
0
def init_project():
    if PROJECT_NAME == '':
        name = raw_input('enter the project name (no space): ')
        set_project_name(name)
    else:
        name = PROJECT_NAME

    if REACT_NATIVE_VERSION == '':
        version = ''
    else:
        version = '--version={0}'.format(REACT_NATIVE_VERSION)

    call(['react-native', 'init', name, version])
    call(['cp', 'resource/.gitignore', config.PROJECT_NAME])

    print '\n\n\n'
    print 'now, open your project and replace all com.{0} by your android package-name'.format(
        config.PROJECT_NAME.lower())
    print 'open your xcode project and replace your bundle id'
    print 'enter to continue...'
    raw_input()
Exemplo n.º 11
0
def integrate_code_signing():
  print '\n\n\n'
  print 'note: make sure you have full access right to create and manage new certificate and provision for your team. if no, please ask team leader for getting the github repository.'
  print 'note: you can find more about code signing at https://codesigning.guide/'
  print 'open github and create new repository (for your certificate and provision), if you have skip this step. press enter to continue...'
  raw_input()
  # has_provision = yes_no_question('did your team have any certificate and provision for code signing?')
  
  if config.IOS_PROVISION_TYPE == '':
    provision_type = raw_input('enter your IOS_PROVISION_TYPE (development, adhoc, enterprise, appstore): ')
    config.set_ios_provision_type(provision_type)
  else:
    provision_type = config.IOS_PROVISION_TYPE
  
  call_cd('{0}/ios/fastlane'.format(config.PROJECT_NAME))
  call(['fastlane', 'match', 'init'])
  call(['fastlane', 'match', provision_type])
  call_cd('../../..')
  
  print '\n\n\n'
  print 'go to xcode and setup bundle id, Provisioning Profile in both Signing (Debug) and Signing (Release) corresponds the Provision you just create or load from fastlane match'
  print 'note: if you can find the provision in XCode, there are some failure with code signing, please visit this docs to check https://github.com/trustcircleglobal/documents/tree/master/technical/client/fastlane#code-signing'
  print 'enter to continue...'
  raw_input()
def install_package():
    call_cd(config.PROJECT_NAME)
    call(['yarn', 'add', 'react-dom', 'react-native-web'])
    call(['yarn', 'add', '--dev', 'babel-plugin-react-native-web'])
    call([
        'yarn', 'add', '--dev', 'babel-loader', 'url-loader', 'webpack',
        'webpack-dev-server', 'webpack-cli'
    ])

    # print '\n\n\n'
    #   enable_install_webpack_cli = yes_question('do you want to install webpack-cli? enter to skip if you have installed it.')
    #   if enable_install_webpack_cli:
    #     call(['npm', 'install', '-g', 'webpack-cli'])
    call_cd('..')
Exemplo n.º 13
0
def init_fastlane_android():
  call_cd('{0}/android'.format(config.PROJECT_NAME))
  call(['fastlane', 'init'])
  call(['touch', 'Gemfile.lock'])
  call_cd('../..')
  
  if config.ANDROID_PACKAGE_NAME == '':
    package_name = raw_input('enter your ANDROID_PACKAGE_NAME (com.trustcircle.example): ')
    config.set_android_package_name(package_name)
  else:
    package_name = config.ANDROID_PACKAGE_NAME
  
  if config.ANDROID_JSON_PATH == '':
    json_path = raw_input('enter your ANDROID_JSON_PATH, enter to skip: ')
    config.set_android_json_path(json_path)
  else:
    json_path = config.ANDROID_JSON_PATH
  
  gen_android_appfile(json_path, package_name)
  call(['cp', 'resource/android/fastlane/Appfile', '{0}/android/fastlane/Appfile'.format(config.PROJECT_NAME)])
Exemplo n.º 14
0
def install_react_native_code_push():
    call_cd(config.PROJECT_NAME)
    call(['npm', 'install'])
    call(['npm', 'install', '--save', 'react-native-code-push@latest'])
    call(['react-native', 'link', 'react-native-code-push'])
    call_cd('..')
Exemplo n.º 15
0
def config_android_fastfile():
  gen_android_fastfile()
  call(['cp', 'resource/android/fastlane/Fastfile', '{0}/android/fastlane/Fastfile'.format(config.PROJECT_NAME)])
Exemplo n.º 16
0
def integrate_android_beta_crashlytic():
  gen_android_manifest()
  call(['cp', 'resource/android/AndroidManifest.xml', '{0}/android/app/src/main/AndroidManifest.xml'.format(config.PROJECT_NAME)])
Exemplo n.º 17
0
def register_cli_acount():
    call(['code-push', 'log-out'])
    call(['code-push', 'register'])
def import_new_file():
    call(['mkdir', '-p', '{0}/src'.format(config.PROJECT_NAME)])
    call([
        'mv', '{0}/App.js'.format(config.PROJECT_NAME),
        '{0}/src'.format(config.PROJECT_NAME)
    ])

    gen_index_web_js()
    call(['cp', 'resource/index.web.js', config.PROJECT_NAME])
    call(['mkdir', '-p', '{0}/web'.format(config.PROJECT_NAME)])
    call(['mkdir', '-p', '{0}/web/dist'.format(config.PROJECT_NAME)])
    call([
        'cp', 'resource/web/dist/index.html',
        '{0}/web/dist/index.html'.format(config.PROJECT_NAME)
    ])
    call([
        'cp', 'resource/webpack.config.js',
        '{0}/web/webpack.config.js'.format(config.PROJECT_NAME)
    ])
    call([
        'cp', 'resource/webpack.config.js',
        '{0}/web/webpack.prod.config.js'.format(config.PROJECT_NAME)
    ])

    gen_package_json()
    call([
        'cp', 'resource/package.json',
        '{0}/package.json'.format(config.PROJECT_NAME)
    ])
Exemplo n.º 19
0
def install_fastlane():
  print '\n\n\n'
  enable_install_fastlane = yes_question('do you want to install fastlane-tools from gem? enter to skip if you have installed it.')
  if enable_install_fastlane:
    call(['gem', 'install', 'fastlane', '-NV'])
def integrate_circle_ci():
    call(['mkdir', '{0}/.circleci'.format(config.PROJECT_NAME)])
    call([
        'cp', 'resource/config.yml',
        '{0}/.circleci/config.yml'.format(config.PROJECT_NAME)
    ])

    print '\n\n\n'
    print 'now, go to Github and create your react-native project repository'
    print 'enter to continue..'
    raw_input()

    git_project = raw_input('enter your github link: ')

    call_cd(config.PROJECT_NAME)
    call(['git', 'init'])
    call(['git', 'add', '.'])
    call(['git', 'commit', '-m', '"create react-native by python script"'])
    call(['git', 'remote', 'add', 'origin', git_project])
    call(['git', 'push', '-u', 'origin', 'master'])
    call(['firebase', 'login:ci'])
    call_cd('..')

    print 'now, go to Circle CI Console https://circleci.com/dashboard > `ADD PROJECTS` in the left menu > `Set Up Project` in the right of your app name > macOS > Objective-C > Start building'
    print 'enter to continue...'
    raw_input()

    print 'in the left, find your project and click setting button > `Enviroment Variables` in the left > `Add Variable`'
    print 'add variable name `MATCH_PASSWORD` and value is your cerificate keychain password (if have)'
    print 'add variable name `FASTLANE_PASSWORD` and value is your apple id password'
    print 'add variable name `FIREBASE_DEPLOY_TOKEN` and value is your firebase token you get in last step'
    print 'enter to finish...'
    raw_input()
Exemplo n.º 21
0
def config_ios_fastfile():
  gen_ios_fastfile()
  call(['cp', 'resource/ios/fastlane/Fastfile', '{0}/ios/fastlane/Fastfile'.format(config.PROJECT_NAME)])