iris-rb 0.1.12 → 0.1.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/iris/azione.ir +3 -1
- data/lib/iris/azione/registratore.ir +24 -20
- data/lib/iris/versione.ir +1 -1
- metadata +1 -1
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: e6c95459d32ba6896c238244a5019235143b752550e73772353593f915a1316f
         | 
| 4 | 
            +
              data.tar.gz: 6d815be63a81f0fe4df8737be49a0e4b72d5a0e919f4c6a4f217684269c4a82e
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: a7bb3e9be5df11936d0dfe8d63094d4e65c149d65fb232b5d1b651a185a70340448b38a397435f0f78059be028c5cff23c1dcc0ee1f2f980cfa9fa87717b655a
         | 
| 7 | 
            +
              data.tar.gz: 42a53ab07b7e807ddc8bbae2fe7aeb9e8a085ccfd9bb45cc7e042cd2ec209504467579ed2ae7597ae582b94ae5a3374af5f1e2f2aaa837affef2c234d06b192e
         | 
    
        data/lib/iris/azione.ir
    CHANGED
    
    | @@ -1,6 +1,6 @@ | |
| 1 | 
            -
            require "rack/request"
         | 
| 2 1 | 
             
            richiedi_relativo "azione/intestazioni"
         | 
| 3 2 | 
             
            richiedi_relativo "azione/parametri"
         | 
| 3 | 
            +
            richiedi_relativo "azione/registratore"
         | 
| 4 4 |  | 
| 5 5 | 
             
            ##
         | 
| 6 6 | 
             
            # Questo modulo permette di definire un'azione di un'applicazione.
         | 
| @@ -39,6 +39,7 @@ richiedi_relativo "azione/parametri" | |
| 39 39 | 
             
            # le variabili d'istanza `@stato`, `@intestazioni` e `@corpo`.
         | 
| 40 40 | 
             
            modulo Iris
         | 
| 41 41 | 
             
              modulo Azione
         | 
| 42 | 
            +
                includi Iris::Azione::Registratore
         | 
| 42 43 |  | 
| 43 44 | 
             
                ##
         | 
| 44 45 | 
             
                # Intestazioni predefinite.
         | 
| @@ -70,6 +71,7 @@ modulo Iris | |
| 70 71 | 
             
                  @corpo = @corpo.in_json se @corpo.risponde_a? :in_json
         | 
| 71 72 | 
             
                  @intestazioni.deposita "Content-Length", @corpo.bytesize.to_s
         | 
| 72 73 | 
             
                  dopo
         | 
| 74 | 
            +
                  registra_azione
         | 
| 73 75 |  | 
| 74 76 | 
             
                  [ @stato, @intestazioni, [ @corpo ] ]
         | 
| 75 77 | 
             
                fine
         | 
| @@ -1,29 +1,33 @@ | |
| 1 | 
            -
            require "hanami/logger"
         | 
| 2 | 
            -
             | 
| 3 1 | 
             
            modulo Iris
         | 
| 4 2 | 
             
              modulo Azione
         | 
| 5 | 
            -
                 | 
| 3 | 
            +
                modulo Registratore
         | 
| 6 4 |  | 
| 7 | 
            -
                   | 
| 8 | 
            -
             | 
| 9 | 
            -
             | 
| 10 | 
            -
                     | 
| 11 | 
            -
             | 
| 12 | 
            -
                     | 
| 13 | 
            -
                     | 
| 14 | 
            -
             | 
| 5 | 
            +
                  ##
         | 
| 6 | 
            +
                  # Registra l'azione.
         | 
| 7 | 
            +
                  definisci registra_azione
         | 
| 8 | 
            +
                    applicazione        = @applicazione || "IRIS"
         | 
| 9 | 
            +
                    metodo_richiesta    = @env["REQUEST_METHOD"]
         | 
| 10 | 
            +
                    percorso_richiesta  = @env["REQUEST_PATH"]
         | 
| 11 | 
            +
                    parametri           = @env["iris.parametri"]
         | 
| 12 | 
            +
                    inizio_richiesta    = @env["timer.start"]
         | 
| 13 | 
            +
                    tempo_richiesta     = "#{((Tempo.adesso - inizio_richiesta) * 1000).arrotonda}ms"
         | 
| 14 | 
            +
                    messaggio           = "#{stato_colorizzato} #{metodo_richiesta} #{percorso_richiesta} #{tempo_richiesta} | #{parametri}".congela
         | 
| 15 15 |  | 
| 16 | 
            -
             | 
| 17 | 
            -
             | 
| 18 | 
            -
                    percorso_richiesta = env["REQUEST_PATH"]
         | 
| 19 | 
            -
                    parametri = env["iris.parametri"]
         | 
| 20 | 
            -
                    messaggio = "#{stato} [#{metodo_richiesta}] #{percorso_richiesta} => #{parametri}".congela
         | 
| 16 | 
            +
                    stampa "[#{applicazione.magenta}] #{messaggio}"
         | 
| 17 | 
            +
                  fine
         | 
| 21 18 |  | 
| 19 | 
            +
                  ##
         | 
| 20 | 
            +
                  # Colore per lo stato della risposta.
         | 
| 21 | 
            +
                  definisci stato_colorizzato
         | 
| 22 22 | 
             
                    considera
         | 
| 23 | 
            -
                    quando stato  | 
| 24 | 
            -
                      @ | 
| 25 | 
            -
                    quando stato  | 
| 26 | 
            -
                      @ | 
| 23 | 
            +
                    quando @stato <= 299
         | 
| 24 | 
            +
                      ritorna "#{@stato}".verde
         | 
| 25 | 
            +
                    quando @stato <= 399
         | 
| 26 | 
            +
                      ritorna "#{@stato}".blu
         | 
| 27 | 
            +
                    quando @stato <= 499
         | 
| 28 | 
            +
                      ritorna "#{@stato}".arancia
         | 
| 29 | 
            +
                    altrimenti
         | 
| 30 | 
            +
                      ritorna "#{@stato}".rosso
         | 
| 27 31 | 
             
                    fine
         | 
| 28 32 | 
             
                  fine
         | 
| 29 33 |  | 
    
        data/lib/iris/versione.ir
    CHANGED