Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Automação e Deploy com Phing

Automação e Deploy com Phing

Perdemos muito tempo com tarefas repetitivas e cansativas durante o desenvolvimento de uma aplicação.
Nesta palestra irei apresentar o Phing, uma ferramenta que auxiliará você na automação de tarefas.

Avatar for Hussani Oliveira

Hussani Oliveira

July 13, 2013
Tweet

More Decks by Hussani Oliveira

Other Decks in Programming

Transcript

  1. PHING: O QUE É? PHing Is Not GNU Make É

    uma ferramenta de Build Baseada no Apache Ant Multi Plataforma
  2. BUILD? "Build" é o ato de criação de scripts ou

    automatização de uma grande variedade de tarefas que os desenvolvedores de software realizam em suas atividades do dia-a-dia.
  3. INSTALAÇÃO p e a r c h a n n

    e l - d i s c o v e r p e a r . p h i n g . i n f o p e a r i n s t a l l p h i n g / p h i n g { " r e q u i r e " : { " p h i n g / p h i n g " : " d e v - m a s t e r " } }
  4. ARQUIVO DE BUILD Task: pedaço de código para um função

    específica Target: grupo de tasks para uma determinada função. Pode depender de outros targets Project: nó raiz que contém um ou mais targets Por padrão build.xml
  5. EXEMPLO < ! - - h e l l o

    . x m l - - > < p r o j e c t n a m e = " E x e m p l o " d e f a u l t = " w o r l d " > < t a r g e t n a m e = " h e l l o " > < e c h o > H e l l o < / e c h o > < / t a r g e t > < t a r g e t n a m e = " w o r l d " d e p e n d s = " h e l l o " > < e c h o > W o r l d ! < / e c h o > < / t a r g e t > < / p r o j e c t >
  6. EXEMPLO p h i n g - f h e

    l l o . x m l B u i l d f i l e : / h o m e / h u s s a n i / g i t h u b / t a l k s / p h i n g / e x e m p l o s / h e l l o . x m l E x e m p l o > h e l l o : [ e c h o ] H e l l o E x e m p l o > w o r l d : [ e c h o ] W o r l d ! B U I L D F I N I S H E D
  7. BUILD.PROPERTIES s s h . h o s t =

    1 2 7 . 0 . 0 . 1 s s h . u s e r = m y u s e r s s h . p a s s w d = m y p 4 s $ s s h . b a s e d i r = r e m o t e D i r
  8. BUILD.XML < ! - - ? x m l v

    e r s i o n = " 1 . 0 " ? - - > < p r o j e c t n a m e = " D e p l o y m y A p p " b a s e d i r = " . " d e f a u l t = " d e p l o y " > < ! - - P a r a m e t r o s d o s e r v i d o r - - > < p r o p e r t y f i l e = " b u i l d . p r o p e r t i e s " > < / p r o p e r t y > . . . < / p r o j e c t >
  9. BUILD.XML < ! - - D e f i n

    i ç ã o d e g r u p o s d e a r q u i v o - - > < f i l e s e t i d = " 3 p a r t y - f i l e s " d i r = " . " > < i n c l u d e n a m e = " v e n d o r / * * " > < e x c l u d e n a m e = " v e n d o r / b i n / p h i n g " > < e x c l u d e n a m e = " v e n d o r / p h i n g / * * " > < / e x c l u d e > < / e x c l u d e > < / i n c l u d e > < / f i l e s e t >
  10. BUILD.XML < ! - - A ç ã o d

    e d e p l o y - - > < t a r g e t n a m e = " c o p y " > < e c h o m e s s a g e = " C o p i a n d o g r u p o d e a r q u i v o s $ { d e p l o y . f i l e s e t } p a r a $ { s s h . u s e r } @ $ { s s h . h o s t } : $ { s s h . b a s e d i r } / " > < s c p u s e r n a m e = " $ { s s h . u s e r } " p a s s w o r d = " $ { s s h . p a s s w d } " h o s t = " $ { s s h . h o s t } " t o d i r = " $ { s s h . b a s e d i r } " > < f i l e s e t r e f i d = " $ { d e p l o y . f i l e s e t } " > < / f i l e s e t > < / s c p > < / e c h o > < / t a r g e t >
  11. BUILD.XML < ! - - D e p l o

    y d o v e n d o r - - > < t a r g e t n a m e = " d e p l o y - 3 p a r t y " > < p h i n g c a l l t a r g e t = " c o p y " > < p r o p e r t y n a m e = " d e p l o y . f i l e s e t " v a l u e = " 3 p a r t y - f i l e s " > < / p r o p e r t y > < / p h i n g c a l l > < / t a r g e t >
  12. BUILD.XML < ! - - D e p l o

    y c o m p l e t o - - > < t a r g e t n a m e = " d e p l o y " > < p h i n g c a l l t a r g e t = " d e p l o y - 3 p a r t y " > < p h i n g c a l l t a r g e t = " d e p l o y - s o u r c e " > < p h i n g c a l l t a r g e t = " d e p l o y - w e b " > < / p h i n g c a l l > < / p h i n g c a l l > < / p h i n g c a l l > < / t a r g e t >
  13. EXECUTANDO p h i n g B u i l

    d f i l e : / h o m e / h u s s a n i / g i t h u b / t a l k s / p h i n g / e x e m p l o s / s i m p l e _ d e p l o y / b u i l d . x m l [ p r o p e r t y ] L o a d i n g / h o m e / h u s s a n i / g i t h u b / t a l k s / p h i n g / e x e m p l o s / s i m p l e _ d e p l o y / b u i l d . p D e p l o y m y A p p > d e p l o y : D e p l o y m y A p p > d e p l o y - 3 p a r t y : D e p l o y m y A p p > c o p y : [ e c h o ] C o p y i n g 3 p a r t y - f i l e s t o h u s s a n i @ 1 2 7 . 0 . 0 . 1 : p h i n g [ s c p ] C o p i e d 6 8 f i l e ( s ) t o ' 1 2 7 . 0 . 0 . 1 ' [ p h i n g c a l l ] C a l l i n g B u i l d f i l e ' / h o m e / h u s s a n i / g i t h u b / t a l k s / p h i n g / e x e m p l o s / s i m p l e _ d e p [ p r o p e r t y ] L o a d i n g / h o m e / h u s s a n i / g i t h u b / t a l k s / p h i n g / e x e m p l o s / s i m p l e _ d e p l o y / b u i l d . p