-
Notifications
You must be signed in to change notification settings - Fork 0
/
DevOps.ps1
112 lines (102 loc) · 3.53 KB
/
DevOps.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<#
Copyright 2019 Xeno Innovations, Inc.
xProject DevOps dependency sync system
Date: 2019-02-27
Version: 0.1
TODO:
[ ] Place all framework templates in their own folders vs flat
[/] Make it work
Sample:
DevOps -GetFramework - Refresh all project rules (same as, get all)
DevOps -get all - Refresh all items
DevOps -get stylecop - Only refresh stylecop files
DevOps -get editorcfg
DevOps -get git - GitIgnore
DevOps -get MSBuild - MSBuild proj files
#>
param(
[parameter(Mandatory=$false)][string] $help ="",
[parameter(Mandatory=$false)][string] $get = ""
# , [parameter(Mandatory=$false)][bool] $GetFramework
# # ,[parameter(Mandatory=$false)][switch] $track = $false
);
# Include Files --------
. "$PSScriptRoot/lib/DevOpsHelpers.ps1";
### Write-Output $("path " + GetSourceFolder);
##$srcFolder = GetSourceFolder;
##if ($srcFolder -eq [String]::Empty)
##{
## Write-Output "Missing 'source' or 'src' folder. Make sure you're in project root.";
## exit;
##}
function DisplayHelp()
{
# Write-Output "Current Path: '$pwd'";
# Write-Output "Script Root: '$PSScriptRoot'";
Write-Output "";
Write-Output "Usage:";
Write-Output " DevOps /help - Help documentation";
Write-Output " DevOps -get <OPTION> - Imports core project file(s) for option";
Write-Output "";
Write-Output "Sample:";
Write-Output " DevOps -get gitignore - Imports .GitIgnore file to current directory";
Write-Output "";
Write-Output "Options:";
Write-Output " ALL - Updates all files except GitIgnore";
Write-Output " CodeMaid";
Write-Output " EditorConfig";
Write-Output " GitIgnore";
Write-Output " LicenseHeader - License Header specifications";
Write-Output " MD - Markdown Lint";
Write-Output " SpellChecker";
Write-Output " StyleCop";
Write-Output " XamlStyler";
}
if ($PSBoundParameters.ContainsKey('help') -eq $true)
{
DisplayHelp;
exit;
}
# Parse commands
$get = $get.Trim();
switch -Exact ($get.ToLower())
{
# "StyleCop".ToLower() { GetStyleCop; break; }
"all".ToLower()
{
Write-Output "** Updating All **";
CopyTemplate("CodeMaid/CodeMaid.config")($pwd);
CopyTemplate("EditorConfig/.editorconfig")($pwd);
CopyTemplate("LicenseHeader/.licenseheader")($pwd);
CopyTemplate("Markdown/.markdownlint.json")($pwd);
CopyTemplate("SpellChecker/SpellChecker.ruleset")($pwd);
CopyTemplate("SpellChecker/.vsspell")($pwd);
CopyTemplate("StyleCop/StyleCop.Analyzers.ruleset")($pwd);
CopyTemplate("StyleCop/stylecop.json")($pwd);
CopyTemplate("XamlStyler/Settings.XamlStyler")($pwd);
break;
}
"CodeMaid".ToLower() { CopyTemplate("CodeMaid/CodeMaid.config")($pwd); break; }
"EditorConfig".ToLower() { CopyTemplate("EditorConfig/.editorconfig")($pwd); break; }
"GitIgnore".ToLower() { CopyTemplate("Git/.gitignore")($pwd); break; }
"LicenseHeader".ToLower() { CopyTemplate("LicenseHeader/.licenseheader")($pwd); break; }
"MD".ToLower() { CopyTemplate("Markdown/.markdownlint.json")($pwd); break; }
"SpellChecker".ToLower()
{
CopyTemplate("SpellChecker/SpellChecker.ruleset")($pwd);
CopyTemplate("SpellChecker/.vsspell")($pwd);
break;
}
"StyleCop".ToLower()
{
CopyTemplate("StyleCop/StyleCop.Analyzers.ruleset")($pwd);
CopyTemplate("StyleCop/stylecop.json")($pwd);
break;
}
"XamlStyler".ToLower() { CopyTemplate("XamlStyler/Settings.XamlStyler")($pwd); break; }
default
{
Write-Output "Invalid DevOps -get command, '$get'";
DisplayHelp;
}
}