Automazione quotidiana in php

30
Automazione quotidiana in PHP Il centro benessere del programmatore

Transcript of Automazione quotidiana in php

Page 1: Automazione quotidiana in php

Automazione quotidiana in PHP

Il centro benessere del programmatore

Page 2: Automazione quotidiana in php

http://phpday.it #phpday @k3aAutomazione

Page 3: Automazione quotidiana in php

Qualità predicibile

Page 4: Automazione quotidiana in php

Risparmio di tempo

Page 5: Automazione quotidiana in php

Pace interiore

Page 6: Automazione quotidiana in php

Deploy Backup Lavare la macchina Trasformare immagini Test del codice

Creazione documentazione Aggiornamento librerie Verifica

perfomance Alalisi dei log Lavare i denti Minimizzare JS e CSS Pulire cache

Inizializzare progetti Creare macchine virtuali Lanciare servizi Applicare patch ...

Page 7: Automazione quotidiana in php

http://phpday.it #phpday @k3aGNU make

Page 8: Automazione quotidiana in php

bmakebuildcake

Clearmakedistcc

distmakeDmakeJMakeJMK

kbuildmake

makeLibmakeme

MakeModulesMake:NGmakeplusmakepp

make utilitiesmk

mk-configuremmm

Mosmake

MPW MakenmakeOMake

Opus MakeParadigm

Visual Make

Prime MoverPrototype Makefiles

PVM Gmake

qmakeRakeSire

smakeSupermake

SMKtmkYabu

Page 9: Automazione quotidiana in php

Apache AntApache Buildr

Apache IvyApache Maven

A-A-PBoost.Build

brasbuilditis

BuildtoolCabalCakecakecook

dev-envFlowtracer

GantGconfigure

Gradlehmake

Hyper BuildInvmakeIstrice

leiningenMeique

microbuildMSBuild

mxx-ruNAntninja

ocamlbuildOdinOSEpake

Perforce JamPerlBuildSystem

PhingProjectBuilder

pyntRant

SchmantSimple Build Tool

SConsShake

Source 2 BinarySweet Build

tupTweaker

Visual BuildWaf

XMakeXMAKEYruba

Page 10: Automazione quotidiana in php

• immagine di GITHUB

Page 11: Automazione quotidiana in php

phing

pake[la versione php non python]

idephix

Page 12: Automazione quotidiana in php

Defining task [phing]<?xml version="1.0" encoding="UTF-8"?>

<project name="Foo" default="foo">

<target name="foo"

description="Description of foo task">

<echo msg="I am the ‘foo’ task" />

</target>

</project>

Page 13: Automazione quotidiana in php

Run task [phing]$ phing -l

Buildfile: /Users/kea/build.xml

Default target:---------------------------------------------- foo Description of foo task

Subtargets:---------------------------------------------- foo Description of foo task

Page 14: Automazione quotidiana in php

Run task [phing]$ phing foo

Buildfile: /Users/kea/build.xml

Foo > foo:

[echo] I am the ‘foo’ task

BUILD FINISHED

Total time: 0,0563 seconds

Page 15: Automazione quotidiana in php

Defining task [pake]<?php

pake_desc('Description of foo task');

pake_task('foo');

function run_foo()

{

pake_echo('I am the "foo" task');

}

Page 16: Automazione quotidiana in php

Run task [pake]$ pake -T

available pake tasks:

foo > Description of foo task

$ pake foo

I am the "foo" task

Page 17: Automazione quotidiana in php

Defining task [idephix]<?php$idx = new Idephix();/** @Description Description of foo task */$idx->add('foo', function () {

echo "'I am the \"foo\" task'”;}$idx->run();

Page 18: Automazione quotidiana in php

Defining task [idephix]<?php$idx = new Idephix();/** @Description Description of foo task */$idx->add('foo', function () use ($idx) {

$idx->output->writeln( "'I am the \"foo\" task'");

}$idx->run();

Page 19: Automazione quotidiana in php

Run task [idephix]$ idx ___ _ _ _ |_ _|__| | ___ _ __ | |__ (_)_ __ | |/ _` |/ _ \ '_ \| '_ \| \ \/ / | | (_| | __/ |_) | | | | |> < |___\__,_|\___| .__/|_| |_|_/_/\_\ |_|Usage: [options] command [arguments]

Options: --help -h Display this help message.... --env Set remote environment.

Available commands: foo Description of foo task help Displays help for a command list Lists commands

Page 20: Automazione quotidiana in php

Run task [idephix]

$ idx foo

I am the "foo" task

Page 21: Automazione quotidiana in php

local - remote [idephix]$targets = array( 'test' => array( 'hosts' => array('server1.com', 'server2.com'), 'ssh_params' => array('user' => 'kea') ),);

$idx = new Idephix($targets);

$idx-> add('myTask:touchMe', function ($name, $go = false) use ($idx) { $idx->local('touch /tmp/'.$name); $idx->remote('touch /tmp/'.$name.'_remote'); });

Page 22: Automazione quotidiana in php

Quali sono le differenze?

Page 23: Automazione quotidiana in php

Pro

Phing

general purpose# task built-in

documentazionelarga diffusione

php in-task

Pake

general purpose# task built-inscrittura conf.file conf. PHP

Idephix

general purposemulti server

scrittura conf.file conf. PHP

Page 24: Automazione quotidiana in php

Contro

Phing

grandi file conf. poco leggibili e

mantenibiliphp in-task

Pake

documentazionescarsamente

diffuso

Idephix

alphascarsamente

diffuso (per ora)

Page 25: Automazione quotidiana in php

... altro?

Page 26: Automazione quotidiana in php

PhpUnit

SSH

rsync

...

Perchè ho bisogno di un tool che “wrappa” X?

{X =

Page 27: Automazione quotidiana in php

Ego slide

• Manuel “Kea” Baldassarri

• COO in

• Webdev dal 1992 e PHP dev dal 1998

• Coautore di “Pro PHP: best practices”

• Marito e bi-padre

[email protected] twitter: k3a

• flickr: kea42 slideshare: kea42

Page 28: Automazione quotidiana in php

Grazie!

Page 29: Automazione quotidiana in php

?twitter: k3a slideshare: kea42

Page 30: Automazione quotidiana in php

Copyright

• Tempi moderni [Charles Chaplin 1936]

• Harry Potter e il prigioniero di Azkaban [Warner Bros. Pictures 2004]

• In time [20th Century Fox 2011]

• Kung fu panda 2 [DreamWorks Animation 2011]