Tous les articles par adminAlex

Tutoriel Facebook Buck avec React Native

Nous allons détailler la procédure pour développer avec React Native et compiler efficacement avec Buck sous Linux.

Prérequis

  • Node.js en v5.5 de préférence installer avec NVM
  • android studio ou intellij (sous ubuntu, utilisez umake android)
  • android sdk + platform + API 23 et votre environnement bien paramétré, par exemple dans votre .bashrc:
export ANDROID_HOME="/opt/softs/androidSdk"
export PATH="$PATH:/opt/softs/androidSdk/platform-tools"

Installation

React Native

Documentation

npm install -g react-native-cli

watchman

Documentation

git clone https://github.com/facebook/watchman.git
cd watchman
git checkout v4.7.0  # the latest stable release
./autogen.sh
./configure
make
sudo make install

Buck

git clone https://github.com/facebook/buck.git
cd buck
ant
#./bin/buck --help
ln -s ${PWD}/bin/buck ${HOME}/bin/buck

Création du projet

dans un de vos répertoires, par exemple ~/dev

react-native init AwesomeProject 
cd AwesomeProject 
react-native run-android

Si vous avez correctement configurer votre sdk pour android vous devriez voir votre application déployée et executée sur votre émulateur.

Maintenant SUPPRIMER l’application de votre émulateur afin d’éviter les conflits entre les signatures gradle et buck.

ajout et configuration de BUCK

cd android`
keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"
./gradlew :app:copyDownloadableDepsToLibs

la commande gradle rend les dépendances Gradle disponible pour Buck

Lancement

dans un terminal lancez le packager à la racine du projet:

npm start

compilez, installez et lancez avec buck:

cd android
buck install -r android/app

Golang tutoriel GVM et go IRIS

Install Golang

In this article we will use GVM to manage multiple Golang version.

bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer)
. .bashrc
gvm install go1.4.3
gvm use go1.4.3
gvm install go1.6.2
gvm use go1.6.2 --default

If you have some trouble to compile go1.4.3, you can use binary version

gvm install go1.6.2 --binary

Prepare your environment

mkdir -p dev/go/my-project/{src,pkg,bin}
cd dev/go/my-project
gvm pkgset create --local
gvm pkgset use --local

create a basic Iris project

Fix Iris 3rc GOPATH bug

export GOPATH=$PWD

create it

go get -u -v github.com/iris-contrib/middleware/logger
go get -u -v github.com/kataras/iris/iris
iris create 

Go Unit Test

any files ended by « _test.go » will be consider as a test.
to execute it:

go test

in verbose mode

go test -test.v

to have teardown / setup in your unit test you can add a TestMain function to your test like

func TestMain(m *testing.M) {
        // setup test
	setup()
        // run tests	
        code := m.Run()
        // clear env
	shutdown()
	os.Exit(code)
}

Links

50 Shades of Go