Skip to content

Instantly share code, notes, and snippets.

@robdmoore
Last active September 9, 2024 21:54
Show Gist options
  • Save robdmoore/af6ec893c85364a97dc4 to your computer and use it in GitHub Desktop.
Save robdmoore/af6ec893c85364a97dc4 to your computer and use it in GitHub Desktop.

Revisions

  1. robdmoore revised this gist Jul 23, 2014. 1 changed file with 1 addition and 2 deletions.
    3 changes: 1 addition & 2 deletions setup-cordova-phonegap.ps1
    Original file line number Diff line number Diff line change
    @@ -67,6 +67,5 @@ phonegap # Check this works
    # Check everything works
    phonegap create helloworld2
    cd helloworld2
    phonegap add android
    phonegap build
    phonegap build android
    cd ..
  2. robdmoore renamed this gist Jul 23, 2014. 1 changed file with 13 additions and 1 deletion.
    14 changes: 13 additions & 1 deletion setup-cordova.ps1 → setup-cordova-phonegap.ps1
    Original file line number Diff line number Diff line change
    @@ -57,4 +57,16 @@ cordova # Check this works
    cordova create helloworld
    cd helloworld
    cordova platform add android
    cordova build
    cordova build
    cd ..

    # Install Phonegap (optional)
    npm install -g phonegap
    phonegap # Check this works

    # Check everything works
    phonegap create helloworld2
    cd helloworld2
    phonegap add android
    phonegap build
    cd ..
  3. robdmoore revised this gist Jul 23, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion setup-cordova.ps1
    Original file line number Diff line number Diff line change
    @@ -56,5 +56,5 @@ cordova # Check this works
    # Check everything works
    cordova create helloworld
    cd helloworld
    cordova platform install android
    cordova platform add android
    cordova build
  4. robdmoore revised this gist Jul 23, 2014. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions setup-cordova.ps1
    Original file line number Diff line number Diff line change
    @@ -51,6 +51,7 @@ npm # Check this works

    # Install Cordova
    npm install -g cordova
    cordova # Check this works

    # Check everything works
    cordova create helloworld
  5. robdmoore renamed this gist Jul 23, 2014. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  6. robdmoore renamed this gist Jul 23, 2014. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  7. robdmoore revised this gist Jul 23, 2014. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions gistfile1.ps1
    Original file line number Diff line number Diff line change
    @@ -14,19 +14,19 @@ iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.p
    choco # Check this works

    # Install Java JDK
    cinst java.jdk -version 7.0.60.1
    cinst java.jdk
    # Set Java bin dir as first thing on path to override java.exe in Windows
    [System.Environment]::SetEnvironmentVariable("PATH", [System.Environment]::GetEnvironmentVariable("JAVA_HOME","Machine") + "\bin;" + [System.Environment]::GetEnvironmentVariable("Path","Machine"), "Machine")
    $env:PATH = [System.Environment]::GetEnvironmentVariable("PATH", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("PATH", "User")
    javac # Check this works

    # Install ant
    cinst apache.ant -version 1.8.4
    cinst apache.ant
    $env:PATH = [System.Environment]::GetEnvironmentVariable("PATH", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("PATH", "User")
    ant # Check this works

    # Install Android SDK
    cinst android-sdk -version 22.6.2
    cinst android-sdk
    [System.Environment]::SetEnvironmentVariable("PATH", [System.Environment]::GetEnvironmentVariable("PATH", "Machine") + ";$env:LOCALAPPDATA\android\android-sdk\tools;$env:LOCALAPPDATA\android\android-sdk\platform-tools", "Machine")
    $env:PATH = [System.Environment]::GetEnvironmentVariable("PATH", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("PATH", "User")

  8. robdmoore revised this gist Jul 23, 2014. 1 changed file with 9 additions and 2 deletions.
    11 changes: 9 additions & 2 deletions gistfile1.ps1
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,13 @@
    # Run this in an elevated PowerShell prompt
    # I recommend you run these commands one-by-one since some of these programs seem a bit fragile to install, but feel free to yolo and script it all :)
    # You can drop the -version parameters to get latest - I just know this combination works :)
    <# This script worked on a fresh Windows Server 2012 VM in Azure and the following were the latest versions of each package at the time:
    * Chocolatey 0.9.8.27
    * java.jdk 7.0.60.1
    * apache.ant 1.8.4
    * android-sdk 22.6.2
    * cordova 3.5.0-0.2.6
    * nodejs.install 0.10.29
    #>
    # Note: there is one bit that requires user input (accepting the Android SDK license terms)

    # Install Chocolatey
    iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))
  9. robdmoore revised this gist Jul 23, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.ps1
    Original file line number Diff line number Diff line change
    @@ -8,10 +8,10 @@ choco # Check this works

    # Install Java JDK
    cinst java.jdk -version 7.0.60.1
    javac # Check this works
    # Set Java bin dir as first thing on path to override java.exe in Windows
    [System.Environment]::SetEnvironmentVariable("PATH", [System.Environment]::GetEnvironmentVariable("JAVA_HOME","Machine") + "\bin;" + [System.Environment]::GetEnvironmentVariable("Path","Machine"), "Machine")
    $env:PATH = [System.Environment]::GetEnvironmentVariable("PATH", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("PATH", "User")
    javac # Check this works

    # Install ant
    cinst apache.ant -version 1.8.4
  10. robdmoore revised this gist Jul 23, 2014. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions gistfile1.ps1
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,5 @@
    # Run this in an elevated PowerShell prompt
    # I recommend you run these commands one-by-one since some of these programs seem a bit fragile to install, but feel free to yolo and script it all :)
    # You can drop the -version parameters to get latest - I just know this combination works :)

    # Install Chocolatey
  11. robdmoore created this gist Jul 23, 2014.
    50 changes: 50 additions & 0 deletions gistfile1.ps1
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,50 @@
    # You can drop the -version parameters to get latest - I just know this combination works :)

    # Install Chocolatey
    iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))
    choco # Check this works

    # Install Java JDK
    cinst java.jdk -version 7.0.60.1
    javac # Check this works
    # Set Java bin dir as first thing on path to override java.exe in Windows
    [System.Environment]::SetEnvironmentVariable("PATH", [System.Environment]::GetEnvironmentVariable("JAVA_HOME","Machine") + "\bin;" + [System.Environment]::GetEnvironmentVariable("Path","Machine"), "Machine")
    $env:PATH = [System.Environment]::GetEnvironmentVariable("PATH", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("PATH", "User")

    # Install ant
    cinst apache.ant -version 1.8.4
    $env:PATH = [System.Environment]::GetEnvironmentVariable("PATH", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("PATH", "User")
    ant # Check this works

    # Install Android SDK
    cinst android-sdk -version 22.6.2
    [System.Environment]::SetEnvironmentVariable("PATH", [System.Environment]::GetEnvironmentVariable("PATH", "Machine") + ";$env:LOCALAPPDATA\android\android-sdk\tools;$env:LOCALAPPDATA\android\android-sdk\platform-tools", "Machine")
    $env:PATH = [System.Environment]::GetEnvironmentVariable("PATH", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("PATH", "User")

    # Update Android SDK bits
    android list sdk <# This lists out all the things to install.
    You want to choose the marked items (x) next to the following for the next command:
    x1- Android SDK Tools, revision 23
    x2- Android SDK Platform-tools, revision 20
    x3- Android SDK Build-tools, revision 19.1
    4- Documentation for Android SDK, API 19, revision 2
    x5- SDK Platform Android 4.4.2, API 19, revision 3
    ...
    Alternatively, you can just run "android" and use the GUI :)
    #>
    android update sdk --no-ui --filter "1,2,3,5" # You will need to enter "y[enter]" to accept the license terms
    adb # Check this works

    # Install nodejs
    cinst nodejs.install
    $env:PATH = [System.Environment]::GetEnvironmentVariable("PATH", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("PATH", "User")
    npm # Check this works

    # Install Cordova
    npm install -g cordova

    # Check everything works
    cordova create helloworld
    cd helloworld
    cordova platform install android
    cordova build