-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
64 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,19 @@ | ||
Tim.AutoGit | ||
# AutoGit | ||
## English | ||
### Requirement | ||
For the tool to work, you need to install .[GIT](https://git-scm.com/) | ||
### Installation | ||
Download the published version and unzip it. You can now place the unzipped files in any place you like, for example under `C://Programs/`. | ||
#### Configuration | ||
Next, you open the `jsconfig.js`, and add the paths you want to automate under git control. | ||
#### execution | ||
Using Windows Task Scheduler or an alternative, you can now create a schedule when the EXE should be executed. | ||
## Deutsch | ||
### Voraussetzung | ||
Damit das Tool funktionieren kann, benötigst du, die Installation von .[GIT](https://git-scm.com/) | ||
### Installation | ||
Lade die veröffentlichte Version herunter und entpacke diese. Die entpackten Dateien kannst du nun an einen beliebigen Ort hinterlegen, beispielsweise unter `C://Programme/`. | ||
#### Konfiguration | ||
Als Nächstes öffnest du das, darin enthaltene `jsconfig.js`, und fügst die Pfäde hinzu, welche du unter Git-Kontrolle automatisieren möchtest. | ||
#### Ausführung | ||
Mithilfe von Windows-Aufgabenplaner oder eine alternative, kannst du nun einen Zeitplan erstellen, wann die EXE ausgeführt werden soll. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,53 @@ | ||
using System; | ||
using System.IO; | ||
using GIT_Worker; | ||
|
||
namespace Tim.AutoGit | ||
{ | ||
class Program | ||
{ | ||
private static StreamWriter logFile; | ||
|
||
static void Main() | ||
{ | ||
CreateLogFile(); | ||
Log("Start Application---------------------------------"); | ||
Configuration configuration = new Configuration(); | ||
|
||
foreach (var item in configuration.Repos) | ||
{ | ||
Log($"Start with {item}"); | ||
|
||
GitBash gitBash = new GitBash(item); | ||
|
||
gitBash.StageAllAndCommit(); | ||
var result = gitBash.StageAllAndCommit(); | ||
Log(result); | ||
Log($"End of {item}"); | ||
} | ||
Log("Close Application---------------------------------"); | ||
logFile.Close(); | ||
} | ||
|
||
static void Log(string text) | ||
{ | ||
Console.WriteLine(text); | ||
logFile.WriteLine($"{DateTime.Now} \t {text}"); | ||
} | ||
|
||
static void CreateLogFile() | ||
{ | ||
var fileName = Directory.GetCurrentDirectory() + @"/AutoGit.log"; | ||
if (!File.Exists(fileName)) | ||
{ | ||
var file = File.Create(fileName); | ||
file.Close(); | ||
logFile = new StreamWriter(fileName, true); | ||
} | ||
else | ||
{ | ||
logFile = new StreamWriter(fileName, true); | ||
} | ||
} | ||
|
||
} | ||
} |