@@ -7,10 +7,19 @@ namespace GitVersion.Configuration.Init.BuildServer
77 using GitVersion . Configuration . Init . Wizard ;
88 using GitVersion . Helpers ;
99
10+ enum ProjectVisibility
11+ {
12+ Public = 0 ,
13+ Private = 1
14+ }
15+
1016 class AppVeyorSetup : ConfigInitWizardStep
1117 {
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 )
1321 {
22+ _projectVisibility = visibility ;
1423 }
1524
1625 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
3241 return StepResult . InvalidResponseSelected ( ) ;
3342 }
3443
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+
3557 void GenerateBasicConfig ( string workingDirectory )
3658 {
37- WriteConfig ( workingDirectory , FileSystem , @"install:
59+ WriteConfig ( workingDirectory , FileSystem , String . Format ( @"install:
3860 - choco install gitversion.portable -pre -y
3961
4062before_build:
4163 - nuget restore
42- - ps: gitversion /l console /output buildserver /updateAssemblyInfo
64+ {0}
4365
4466build:
45- project: <your sln file>" ) ;
67+ project: <your sln file>" ,
68+ GetGVCommand ( _projectVisibility )
69+ ) ) ;
4670 }
4771
4872 void GenerateNuGetConfig ( string workingDirectory )
4973 {
50- WriteConfig ( workingDirectory , FileSystem , @"install:
74+ WriteConfig ( workingDirectory , FileSystem , String . Format ( @"install:
5175 - choco install gitversion.portable -pre -y
5276
5377assembly_info:
5478 patch: false
5579
5680before_build:
5781 - nuget restore
58- - ps: gitversion /l console /output buildserver /updateAssemblyInfo
82+ {0}
5983
6084build:
6185 project: <your sln file>
6286
6387after_build:
6488 - cmd: ECHO nuget pack <Project>\<NuSpec>.nuspec -version ""%GitVersion_NuGetVersion%"" -prop ""target=%CONFIGURATION%""
6589 - 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+ ) ) ;
6793 }
6894
6995 void WriteConfig ( string workingDirectory , IFileSystem fileSystem , string configContents )
0 commit comments