@@ -7,10 +7,19 @@ namespace GitVersion.Configuration.Init.BuildServer
7
7
using GitVersion . Configuration . Init . Wizard ;
8
8
using GitVersion . Helpers ;
9
9
10
+ enum ProjectVisibility
11
+ {
12
+ Public = 0 ,
13
+ Private = 1
14
+ }
15
+
10
16
class AppVeyorSetup : ConfigInitWizardStep
11
17
{
12
- public AppVeyorSetup ( IConsole console , IFileSystem fileSystem ) : base ( console , fileSystem )
18
+ private ProjectVisibility _projectVisibility ;
19
+
20
+ public AppVeyorSetup ( IConsole console , IFileSystem fileSystem , ProjectVisibility visibility ) : base ( console , fileSystem )
13
21
{
22
+ _projectVisibility = visibility ;
14
23
}
15
24
16
25
protected override StepResult HandleResult ( string result , Queue < ConfigInitWizardStep > steps , Config config , string workingDirectory )
@@ -32,38 +41,55 @@ protected override StepResult HandleResult(string result, Queue<ConfigInitWizard
32
41
return StepResult . InvalidResponseSelected ( ) ;
33
42
}
34
43
44
+ static private string GetGVCommand ( ProjectVisibility visibility )
45
+ {
46
+ switch ( visibility )
47
+ {
48
+ case ProjectVisibility . Public :
49
+ return " - ps: gitversion /l console /output buildserver /updateAssemblyInfo" ;
50
+ case ProjectVisibility . Private :
51
+ return " - ps: gitversion $env:APPVEYOR_BUILD_FOLDER /l console /output buildserver /updateAssemblyInfo /nofetch /b $env:APPVEYOR_REPO_BRANCH" ;
52
+ default :
53
+ return "" ;
54
+ }
55
+ }
56
+
35
57
void GenerateBasicConfig ( string workingDirectory )
36
58
{
37
- WriteConfig ( workingDirectory , FileSystem , @"install:
59
+ WriteConfig ( workingDirectory , FileSystem , String . Format ( @"install:
38
60
- choco install gitversion.portable -pre -y
39
61
40
62
before_build:
41
63
- nuget restore
42
- - ps: gitversion /l console /output buildserver /updateAssemblyInfo
64
+ {0}
43
65
44
66
build:
45
- project: <your sln file>" ) ;
67
+ project: <your sln file>" ,
68
+ GetGVCommand ( _projectVisibility )
69
+ ) ) ;
46
70
}
47
71
48
72
void GenerateNuGetConfig ( string workingDirectory )
49
73
{
50
- WriteConfig ( workingDirectory , FileSystem , @"install:
74
+ WriteConfig ( workingDirectory , FileSystem , String . Format ( @"install:
51
75
- choco install gitversion.portable -pre -y
52
76
53
77
assembly_info:
54
78
patch: false
55
79
56
80
before_build:
57
81
- nuget restore
58
- - ps: gitversion /l console /output buildserver /updateAssemblyInfo
82
+ {0}
59
83
60
84
build:
61
85
project: <your sln file>
62
86
63
87
after_build:
64
88
- cmd: ECHO nuget pack <Project>\<NuSpec>.nuspec -version ""%GitVersion_NuGetVersion%"" -prop ""target=%CONFIGURATION%""
65
89
- cmd: nuget pack <Project>\<NuSpec>.nuspec -version ""%GitVersion_NuGetVersion%"" -prop ""target=%CONFIGURATION%""
66
- - cmd: appveyor PushArtifact ""<NuSpec>.%GitVersion_NuGetVersion%.nupkg""" ) ;
90
+ - cmd: appveyor PushArtifact ""<NuSpec>.%GitVersion_NuGetVersion%.nupkg""" ,
91
+ GetGVCommand ( _projectVisibility )
92
+ ) ) ;
67
93
}
68
94
69
95
void WriteConfig ( string workingDirectory , IFileSystem fileSystem , string configContents )
0 commit comments