Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'master' of github.com:wallybh/psScripts

  • Loading branch information...
commit 5e567d5ab7e11d74ad6e10d798160438dc01de16 2 parents 9c59031 + 9c420ca
@wallybh authored
View
17 deploy/LoadConfig.ps1
@@ -0,0 +1,17 @@
+param($path = $(throw "You must specify a config file"))
+$global:appSettings = @{}
+$config = [xml](get-content $path)
+foreach ($addNode in $config.configuration.appsettings.add) {
+ if ($addNode.Value.Contains(,)) {
+ # Array case
+ $value = $addNode.Value.Split(,)
+ for ($i = 0; $i -lt $value.length; $i++) {
+ $value[$i] = $value[$i].Trim()
+ }
+ }
+ else {
+ # Scalar case
+ $value = $addNode.Value
+ }
+ $global:appSettings[$addNode.Key] = $value
+}
View
11 deploy/app.config
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<configuration>
+ <appSettings>
+ <add key="CREDITO-SERVICE-DEPLOY" value="PATH-CREDITO-SERVICE-DEPLOY" />
+ <add key="CREDITO-SERVICE-DSV" value="PATH-CREDITO-SERVICE-DSV" />
+ <add key="CREDITO-SERVICE-HML" value="PATH-CREDITO-SERVICE-HML" />
+ <add key="CREDITO-APP-DEPLOY" value="PATH-CREDITO-APP-DEPLOY" />
+ <add key="CREDITO-APP-DSV" value="PATH-CREDITO-APP-DSV" />
+ <add key="CREDITO-APP-HML" value="PATH-CREDITO-APP-HML" />
+ </appSettings>
+</configuration>
View
30 deploy/executeDeployInterno.ps1
@@ -0,0 +1,30 @@
+#!/bin/bash
+
+if($args.Length -eq 0)
+{
+ "Faltam argumentos"
+ write-host
+ return
+}
+
+if(! (Test-Path $args[0]))
+{
+ Write-Output "Caminho de origem não existe."
+ return
+}
+
+if(! (Test-Path $args[1]))
+{
+ Write-Output "Caminho de destino não existe."
+ return
+}
+
+Get-ChildItem $args[1] -recurse -exclude *.config | Remove-Item -recurse -Confirm
+
+$from = $args[0] + "\*"
+
+Copy-Item $from $args[1] -exclude *.config -recurse
+
+
+
+
View
35 deploy/tests.ps1
@@ -0,0 +1,35 @@
+ Param($sistema = $(throw "Parâmetro $($sistema) deve ser informado"),
+ $From,
+ $To
+ )
+ If (-not ($From -eq $null) -and ("DEPLOY","HML","DSV" -NotContains $From))
+ {
+ Throw "`$From is not a valid param! Please use DEPLOY, HML, DSV"
+ }
+ If (-not ($To -eq $null) -and ("DEPLOY","HML","DSV" -NotContains $To))
+ {
+ Throw "`$To is not a valid param! Please use DEPLOY, HML, DSV"
+ }
+ If (-not ($To -eq $null) -and (-not ($From -eq $null)) -and $From -eq $To )
+ {
+ Throw "Parametros `$From e `$To não pode ser iguais"
+ }
+
+ ./LoadConfig app.config
+
+ $appServiceKeyFrom = "";
+ $appServiceKeyTo = "";
+
+ if($From -eq $null -or $To -eq $null)
+ {
+ $appServiceKeyFrom = $sistema + "-SERVICE-DEPLOY";
+ $appServiceKeyTo = $sistema + "-SERVICE-HML";
+ }
+
+if($appSettings[$appServiceKeyTO] -eq $null -or $appSettings[$appServiceKeyFrom] -eq $null)
+{
+ Write-Output "Configuração $appServiceKeyTo $appServiceKeyFrom não encontrada ";
+}
+
+# ./executeDeployInterno $appServiceKeyFrom $appServiceKeyTo
+
Please sign in to comment.
Something went wrong with that request. Please try again.