Skip to content

Commit

Permalink
Merge pull request #6 from tablexi/updates
Browse files Browse the repository at this point in the history
Updates to clean and setup scripts
  • Loading branch information
edwardlafoy authored Feb 25, 2019
2 parents f8737b5 + 4420d04 commit 703f3bf
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 58 deletions.
17 changes: 9 additions & 8 deletions bin/clean
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,17 @@ run "watchman watch-del-all"
run "rm -rf $TMPDIR/react-*"
run "rm ~/.babel.json"
run "rm -rf ~/.rncache"

run "rm -rf ios/build"
run "rm -rf ios/Pods"
run "rm -rf ios/*.xcworkspace"

run "cd android ./gradlew clean && cd .."
run "rm -rf android/build"
run "rm -rf android/app/build"

run "rm -rf node_modules/"
run "yarn cache clean"
run "npm cache clean --force"
run "npm install"

#this is important - the cache needs to be reloaded manually
puts "Manually refreshing packages..."
pid = Process.spawn "npm run start -- --reset-cache"
sleep(10)
run "curl --output /dev/null --silent http://localhost:8081/index.bundle?platform=ios&dev=true"
puts "Clean finished 🚀".green

puts "Clean finished 🚀 run:\n npm install or yarn".green
4 changes: 2 additions & 2 deletions bin/setup
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ puts "Installing platforms: #{args}"

args.each do |p|
cmd = "#{bin_dir}/setup-#{p} #{bin_dir}"
puts system "#{cmd}"
abort "Setup failed".red if !system "#{cmd}"
end
puts "Setup finished 🚀".green
puts "Setup finished 🚀".green
27 changes: 17 additions & 10 deletions bin/setup-android
Original file line number Diff line number Diff line change
@@ -1,27 +1,34 @@
#!/usr/bin/env bash

set -o
set -eo

set INSTALLED="$(brew cask list | grep -w java)"
echo "== Installing android"
if [ -n "$INSTALLED" ]
then
echo -e "The wrong version of java is installed, please uninstall java: brew cask uninstall java"
exit 1
fi

brew tap caskroom/cask
brew cask install java8
brew cask install android-sdk

echo "== Updating Android Packages"
yes | sdkmanager --update
touch ~/.android/repositories.cfg
mkdir ~/.android || true
touch ~/.android/repositories.cfg || true
yes | sdkmanager $(cat $1/../lib/android_packages)

echo "== Creating virtual device"
echo 'n' | avdmanager create avd -n Api26 --package "system-images;android-26;google_apis;x86_64" --force --device "Nexus 5"

echo "Add the following to your environment file:
echo 'Add the following to your environment file:
--------------------------------------------
export ANDROID_SDK_ROOT=/usr/local/share/android-sdk
export ANDROID_HOME=\$ANDROID_SDK_ROOT
export ANDROID_NDK_HOME=\$ANDROID_SDK_ROOT/ndk-bundle
export ANDROID_SDK_ROOT="/usr/local/share/android-sdk"
export PATH="$ANDROID_SDK_ROOT/platform-tools:$PATH"
export PATH="$ANDROID_SDK_ROOT/emulator:$PATH"
export PATH=\$PATH:\$ANDROID_SDK_ROOT/emulator
export PATH=\$PATH:\$ANDROID_SDK_ROOT/tools
export PATH=\$PATH:\$ANDROID_SDK_ROOT/platform-tools
--------------------------------------------"
export ANDROID_HOME=$ANDROID_SDK_ROOT
export ANDROID_NDK_HOME="$ANDROID_SDK_ROOT/ndk-bundle"
--------------------------------------------'
2 changes: 1 addition & 1 deletion bin/setup-react-native
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env bash

brew install watchman
brew install watchman nvm
31 changes: 0 additions & 31 deletions bin/start-dev

This file was deleted.

8 changes: 4 additions & 4 deletions lib/android_packages
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
system-images;android-26;google_apis;x86_64
platforms;android-26
build-tools;26.0.2
system-images;android-28;google_apis;x86_64
platforms;android-28
build-tools;28.0.3
ndk-bundle
emulator
emulator
3 changes: 1 addition & 2 deletions mobile_scripts.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ Gem::Specification.new do |spec|
spec.add_runtime_dependency 'colorize'
spec.executables = [
'clean',
'setup',
'start-dev'
'setup'
]
end

0 comments on commit 703f3bf

Please sign in to comment.