fetcher: move exclude rules to base class. Closes #564

This commit is contained in:
Hylke Bons 2012-01-31 21:30:23 +00:00
parent 284d712ac7
commit 5c32eb370f
3 changed files with 77 additions and 69 deletions

View file

@ -225,72 +225,8 @@ namespace SparkleLib {
string exclude_rules_file_path = Path.Combine (info.FullName, "exclude");
TextWriter writer = new StreamWriter (exclude_rules_file_path);
// gedit and emacs
writer.WriteLine ("*~");
// Firefox and Chromium temporary download files
writer.WriteLine ("*.part");
writer.WriteLine ("*.crdownload");
// vi(m)
writer.WriteLine (".*.sw[a-z]");
writer.WriteLine ("*.un~");
writer.WriteLine ("*.swp");
writer.WriteLine ("*.swo");
// KDE
writer.WriteLine (".directory");
// Mac OS X
writer.WriteLine (".DS_Store");
writer.WriteLine ("Icon?");
writer.WriteLine ("._*");
writer.WriteLine (".Spotlight-V100");
writer.WriteLine (".Trashes");
// Omnigraffle
writer.WriteLine ("*(Autosaved).graffle");
// Windows
writer.WriteLine ("Thumbs.db");
writer.WriteLine ("Desktop.ini");
// MS Office
writer.WriteLine ("~*.tmp");
writer.WriteLine ("~*.TMP");
writer.WriteLine ("*~*.tmp");
writer.WriteLine ("*~*.TMP");
writer.WriteLine ("~*.ppt");
writer.WriteLine ("~*.PPT");
writer.WriteLine ("~*.pptx");
writer.WriteLine ("~*.PPTX");
writer.WriteLine ("~*.xls");
writer.WriteLine ("~*.XLS");
writer.WriteLine ("~*.xlsx");
writer.WriteLine ("~*.XLSX");
writer.WriteLine ("~*.doc");
writer.WriteLine ("~*.DOC");
writer.WriteLine ("~*.docx");
writer.WriteLine ("~*.DOCX");
// CVS
writer.WriteLine ("*/CVS/*");
writer.WriteLine (".cvsignore");
writer.WriteLine ("*/.cvsignore");
// Subversion
writer.WriteLine ("/.svn/*");
writer.WriteLine ("*/.svn/*");
// Mercurial
writer.WriteLine ("/.hg/*");
writer.WriteLine ("*/.hg/*");
writer.WriteLine ("*/.hgignore");
// Bazaar
writer.WriteLine ("/.bzr/*");
writer.WriteLine ("*/.bzr/*");
writer.WriteLine ("*/.bzrignore");
foreach (string exclude_rule in ExcludeRules)
writer.WriteLine (exclude_rule);
writer.Close ();

View file

@ -3,13 +3,13 @@ TARGET = library
SOURCES = \
Defines.cs \
SparkleExtensions.cs \
Git/SparkleFetcherGit.cs \
Git/SparkleGit.cs \
Git/SparkleRepoGit.cs \
SparkleBackend.cs \
SparkleChangeSet.cs \
SparkleConfig.cs \
SparkleExtensions.cs \
SparkleFetcherBase.cs \
SparkleHelpers.cs \
SparkleListenerBase.cs \

View file

@ -16,8 +16,8 @@
using System;
using System.IO;
using System.Diagnostics;
using System.IO;
using System.Security.AccessControl;
using System.Text.RegularExpressions;
using System.Threading;
@ -37,22 +37,94 @@ namespace SparkleLib {
public event FailedEventHandler Failed;
public event ProgressChangedEventHandler ProgressChanged;
public string [] ExcludeRules;
protected string target_folder;
protected string remote_url;
private Thread thread;
public SparkleFetcherBase (string server, string remote_folder, string target_folder)
{
this.target_folder = target_folder;
this.remote_url = server + "/" + remote_folder;
ExcludeRules = new string [] {
// gedit and emacs
"*~",
// Firefox and Chromium temporary download files
"*.part",
"*.crdownload",
// vi(m)
".*.sw[a-z]",
"*.un~",
"*.swp",
"*.swo",
// KDE
".directory",
// Mac OS X
".DS_Store",
"Icon?",
"._*",
".Spotlight-V100",
".Trashes",
// Omnigraffle
"*(Autosaved).graffle",
// Windows
"Thumbs.db",
"Desktop.ini",
// MS Office
"~*.tmp",
"~*.TMP",
"*~*.tmp",
"*~*.TMP",
"~*.ppt",
"~*.PPT",
"~*.pptx",
"~*.PPTX",
"~*.xls",
"~*.XLS",
"~*.xlsx",
"~*.XLSX",
"~*.doc",
"~*.DOC",
"~*.docx",
"~*.DOCX",
// CVS
"*/CVS/*",
".cvsignore",
"*/.cvsignore",
// Subversion
"/.svn/*",
"*/.svn/*",
// Mercurial
"/.hg/*",
"*/.hg/*",
"*/.hgignore",
// Bazaar
"/.bzr/*",
"*/.bzr/*",
"*/.bzrignore"
};
}
public abstract bool Fetch ();
public abstract string [] Warnings { get; }
// Clones the remote repository
public void Start ()
{