Cake スクリプトを使用して git リポジトリのクローンを作成することは可能ですか? もしそうなら、どうすればこれを行うことができますか?
1544 次
1 に答える
6
Cake.Git Addinを使用して、多数の git 操作を実行できます。通常、このアドインによって提供されるエイリアスの使用方法に関する例は、ここで見つけることができますが、これらの例はまだ存在しません。
とりあえず、4 つの GitClone エイリアスのそれぞれを使用する方法の例を以下に示します。
注:この回答では、GitHubのCake Git リポジトリを使用します。
GitClone(string, DirectoryPath) </h3>
#addin nuget:?package=Cake.Git
Task("Git-Clone")
.Does(() =>
{
GitClone("https://github.com/cake-build/cake.git", "c:/temp/cake");
});
RunTarget("Git-Clone");
#addin nuget:?package=Cake.Git
Task("Git-Clone")
.Does(() =>
{
GitClone("https://github.com/cake-build/cake.git", "c:/temp/cake");
});
RunTarget("Git-Clone");
GitClone(string, DirectoryPath, GitCloneSettings) </a>
#addin nuget:?package=Cake.Git
Task("Git-Clone")
.Does(() =>
{
GitClone("https://github.com/cake-build/cake.git", "c:/temp/cake",
new GitCloneSettings{ BranchName = "main" });
});
RunTarget("Git-Clone");
GitClone(string, DirectoryPath, string, string) </a>
注:このエイリアスは、出力ディレクトリを作成していないようです。その結果、EnsureDirectoryExistsエイリアスを使用して、それが存在することを確認します。
#addin nuget:?package=Cake.Git
Task("Git-Clone")
.Does(() =>
{
EnsureDirectoryExists("c:/temp/cake");
GitClone("https://github.com/cake-build/cake.git",
"c:/temp/cake",
"username",
"password");
});
RunTarget("Git-Clone");
GitClone(string, DirectoryPath, string, string, GitCloneSettings) </a>
注:このエイリアスは、出力ディレクトリを作成していないようです。その結果、EnsureDirectoryExistsエイリアスを使用して、それが存在することを確認します。
#addin nuget:?package=Cake.Git
Task("Git-Clone")
.Does(() =>
{
EnsureDirectoryExists("c:/temp/cake");
GitClone("https://github.com/cake-build/cake.git",
"c:/temp/cake",
"username",
"password",
new GitCloneSettings{ BranchName = "main" });
});
RunTarget("Git-Clone");
于 2016-12-08T20:13:40.537 に答える