Skip to content

Commit

Permalink
Merge branch 'stable'
Browse files Browse the repository at this point in the history
* stable:
  (GH-332) Fixup example
  (GH-562) Download Cache is sha512
  (doc) updating the submitting issues section
  (maint) move readme template to top level
  (GH-476) Verbose log file operations / checksum

# Conflicts:
#	CONTRIBUTING.md
  • Loading branch information
ferventcoder committed Jan 24, 2016
2 parents 37fba78 + 940bd4f commit f9e0420
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 35 deletions.
17 changes: 7 additions & 10 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
Contributors
============
# Reporting an Issue?
![submitting isseus](https://cloud.githubusercontent.com/assets/63502/12534440/fc223b74-c21e-11e5-9a41-1ffc1c9af48f.png)

Submitting an Issue? See the [Submitting Issues](https://github.com/chocolatey/choco#submitting-issues) section in the [README](https://github.com/chocolatey/choco/blob/master/README.md#submitting-issues).
Submitting an Issue? See the **[Submitting Issues](https://github.com/chocolatey/choco#submitting-issues) section** in the [README](https://github.com/chocolatey/choco/blob/master/README.md#submitting-issues).

**NOTE**: Do not submit issues for missing `SolutionVersion.cs`. Please see [Compiling / Building Source](https://github.com/chocolatey/choco#compiling--building-source).

## Package Issue?
Please see [Request Package Fixes or Updates / Become a maintainer of an existing package](https://github.com/chocolatey/choco/wiki/PackageTriageProcess).

# Contributors
The process for contributions is roughly as follows:

## Prerequisites
Expand All @@ -16,8 +20,6 @@ The process for contributions is roughly as follows:
* You agree to follow the [etiquette regarding communication](https://github.com/chocolatey/choco#etiquette-regarding-communication).

### Definition of Trivial Contributions


It's hard to define what is a trivial contribution. Sometimes even a 1 character change can be considered significant. Unfortunately because it can be subjective, the decision on what is trivial comes from the committers of the project and not from folks contributing to the project. It is generally safe to assume that you may be subject to signing the [CLA](https://www.clahub.com/agreements/chocolatey/choco) and be prepared to do so. Ask in advance if you are not sure and for reasons are not able to sign the [CLA](https://www.clahub.com/agreements/chocolatey/choco).

What is generally considered trivial:
Expand All @@ -31,7 +33,6 @@ What is generally not considered trivial:
* Changes to any code that would be delivered as part of the final product. This includes any scripts that are delivered, such as PowerShell scripts. Yes, even 1 character changes could be considered non-trivial.

## Contributing Process

### Get Buyoff Or Find Open Community Issues/Features

* Through GitHub, or through the [mailing list](https://groups.google.com/forum/#!forum/chocolatey) (preferred), you talk about a feature you would like to see (or a bug), and why it should be in Chocolatey.
Expand All @@ -52,7 +53,6 @@ What is generally not considered trivial:
* Please do not update your branch from the master unless we ask you to. See the responding to feedback section below.

### Prepare Commits

This section serves to help you understand what makes a good commit.

A commit should observe the following:
Expand All @@ -74,7 +74,6 @@ A commit message should observe the following (based on ["A Note About Git Commi
* Explains more fully the reason(s) for the change and contrasts with previous behavior.
* Uses present tense. "Fix" versus "Fixed".


A good example of a commit message is as follows:

```
Expand All @@ -90,7 +89,6 @@ choco client properly.
```

### Submit Pull Request (PR)

Prerequisites:

* You are making commits in a feature branch.
Expand Down Expand Up @@ -126,7 +124,6 @@ The only reasons a pull request should be closed and resubmitted are as follows:
* When there are updates made to the original by someone other than the original contributor. Then the old branch is closed with a note on the newer branch this supersedes #github_number.

## Other General Information

The helpers/utility functions that are available to the packages are what we consider the API. If you are working in the API, please note that you will need to maintain backwards compatibility. If you plan to rename a function or make it more generic, you must provide an alias in the [chocolateyInstaller.psm1](https://github.com/chocolatey/choco/blob/master/src/chocolatey.resources/helpers/chocolateyInstaller.psm1) as part of what gets exported. You should not remove or reorder parameters, only add optional parameters to the end. They should be named and not positional (we are moving away from positional parameters as much as possible).

If you reformat code or hit core functionality without an approval from a person on the Chocolatey Team, it's likely that no matter how awesome it looks afterwards, it will probably not get accepted. Reformatting code makes it harder for us to evaluate exactly what was changed.
Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@ Apache 2.0 - see [LICENSE](https://github.com/chocolatey/choco/blob/master/LICEN

## Submitting Issues

If you have found an issue with the client (choco.exe), this is the place to submit. If it is an issue with the website, please submit the issue to the [Chocolatey.org repo](https://github.com/chocolatey/chocolatey.org). If you are having issue with a package and it is the package itself, please submit the issue directly to the package maintainer(s).
![submitting issues](https://cloud.githubusercontent.com/assets/63502/12534427/9c4c608a-c21e-11e5-9369-89b94322602c.png)

* If you have found an issue with the client (choco.exe), this is the place to submit.
* If it is an issue with the website (the community feed aka https://chocolatey.org), please submit the issue to the [Chocolatey.org repo](https://github.com/chocolatey/chocolatey.org).
* If you are having issue with a package and it is the package itself, please see [Request Package Fixes or Updates / Become a maintainer of an existing package](https://github.com/chocolatey/choco/wiki/PackageTriageProcess).

Observe the following help for submitting an issue:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ Example:
Accept = 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8';
'Accept-Charset' = 'ISO-8859-1,utf-8;q=0.7,*;q=0.3';
'Accept-Language' = 'en-GB,en-US;q=0.8,en;q=0.6';
Cookie = '[email protected]';
Referer = 'http://submain.com/download/ghostdoc/';
Cookie = 'requiredinfo=info';
Referer = 'https://somelocation.com/';
}
}
Get-ChocolateyWebFile 'ghostdoc' 'http://submain.com/download/GhostDoc_v4.0.zip' -options $options
Get-ChocolateyWebFile 'package' 'https://somelocation.com/thefile.exe' -options $options
.EXAMPLE
Install-ChocolateyZipPackage '__NAME__' 'URL' "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
Expand Down
3 changes: 2 additions & 1 deletion src/chocolatey/infrastructure.app/services/FilesService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ namespace chocolatey.infrastructure.app.services
using domain;
using filesystem;
using infrastructure.services;
using logging;
using results;

public sealed class FilesService : IFilesService
Expand Down Expand Up @@ -127,7 +128,7 @@ public PackageFiles capture_package_files(string directory, ChocolateyConfigurat
public PackageFile get_package_file(string file)
{
var hash = _hashProvider.hash_file(file);
this.Log().Debug(() => " Found '{0}'{1} with checksum '{2}'".format_with(file, Environment.NewLine, hash));
this.Log().Debug(ChocolateyLoggers.Verbose,() => " Found '{0}'{1} with checksum '{2}'".format_with(file, Environment.NewLine, hash));

return new PackageFile { Path = file, Checksum = hash };
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ public bool run_action(ChocolateyConfiguration configuration, PackageResult pack
var urlKey = CryptoHashProvider.hash_value(downloadCache.OriginalUrl, CryptoHashProviderType.Sha256).Replace("=",string.Empty);
Environment.SetEnvironmentVariable("CacheFile_{0}".format_with(urlKey), downloadCache.FileName);
Environment.SetEnvironmentVariable("CacheChecksum_{0}".format_with(urlKey), downloadCache.Checksum);
//Environment.SetEnvironmentVariable("CacheChecksumType_{0}".format_with(urlKey), "md5");
Environment.SetEnvironmentVariable("CacheChecksumType_{0}".format_with(urlKey), "sha512");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public void generate(ChocolateyConfiguration configuration)
generate_file_from_template(configuration, tokens, NuspecTemplate.Template, _fileSystem.combine_paths(packageLocation, "{0}.nuspec".format_with(tokens.PackageNameLower)), Encoding.UTF8);
generate_file_from_template(configuration, tokens, ChocolateyInstallTemplate.Template, _fileSystem.combine_paths(packageToolsLocation, "chocolateyinstall.ps1"), Encoding.UTF8);
generate_file_from_template(configuration, tokens, ChocolateyUninstallTemplate.Template, _fileSystem.combine_paths(packageToolsLocation, "chocolateyuninstall.ps1"), Encoding.UTF8);
generate_file_from_template(configuration, tokens, ChocolateyReadMeTemplate.Template, _fileSystem.combine_paths(packageToolsLocation, "ReadMe.md"), Encoding.UTF8);
generate_file_from_template(configuration, tokens, ChocolateyReadMeTemplate.Template, _fileSystem.combine_paths(packageLocation, "ReadMe.md"), Encoding.UTF8);
}
else
{
Expand Down
35 changes: 18 additions & 17 deletions src/chocolatey/infrastructure/filesystem/DotNetFileSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ namespace chocolatey.infrastructure.filesystem
using System.Threading;
using adapters;
using app;
using logging;
using platforms;
using tolerance;
using Assembly = adapters.Assembly;
Expand Down Expand Up @@ -221,7 +222,7 @@ public bool is_system_file(FileInfo file)
}
else
{
this.Log().Debug(() => "File \"{0}\" is a system file.".format_with(file.FullName));
this.Log().Debug(ChocolateyLoggers.Verbose, () => "File \"{0}\" is a system file.".format_with(file.FullName));
}

return isSystemFile;
Expand All @@ -238,7 +239,7 @@ public bool is_readonly_file(FileInfo file)
}
else
{
this.Log().Debug(() => "File \"{0}\" is a readonly file.".format_with(file.FullName));
this.Log().Debug(ChocolateyLoggers.Verbose, () => "File \"{0}\" is a readonly file.".format_with(file.FullName));
}

return isReadOnlyFile;
Expand All @@ -255,7 +256,7 @@ public bool is_hidden_file(FileInfo file)
}
else
{
this.Log().Debug(() => "File \"{0}\" is a hidden file.".format_with(file.FullName));
this.Log().Debug(ChocolateyLoggers.Verbose, () => "File \"{0}\" is a hidden file.".format_with(file.FullName));
}

return isHiddenFile;
Expand All @@ -264,7 +265,7 @@ public bool is_hidden_file(FileInfo file)
public bool is_encrypted_file(FileInfo file)
{
bool isEncrypted = ((file.Attributes & FileAttributes.Encrypted) == FileAttributes.Encrypted);
this.Log().Debug(() => "Is file \"{0}\" an encrypted file? {1}".format_with(file.FullName, isEncrypted.to_string()));
this.Log().Debug(ChocolateyLoggers.Verbose, () => "Is file \"{0}\" an encrypted file? {1}".format_with(file.FullName, isEncrypted.to_string()));
return isEncrypted;
}

Expand All @@ -283,7 +284,7 @@ public void move_file(string filePath, string newFilePath)

public void copy_file(string sourceFilePath, string destinationFilePath, bool overwriteExisting)
{
this.Log().Debug(() => "Attempting to copy \"{0}\"{1} to \"{2}\".".format_with(sourceFilePath, Environment.NewLine, destinationFilePath));
this.Log().Debug(ChocolateyLoggers.Verbose, () => "Attempting to copy \"{0}\"{1} to \"{2}\".".format_with(sourceFilePath, Environment.NewLine, destinationFilePath));
create_directory_if_not_exists(get_directory_name(destinationFilePath), ignoreError: true);

allow_retries(() => File.Copy(sourceFilePath, destinationFilePath, overwriteExisting));
Expand All @@ -297,7 +298,7 @@ public bool copy_file_unsafe(string sourceFilePath, string destinationFilePath,
return true;
}

this.Log().Debug(() => "Attempting to copy from \"{0}\" to \"{1}\".".format_with(sourceFilePath, destinationFilePath));
this.Log().Debug(ChocolateyLoggers.Verbose, () => "Attempting to copy from \"{0}\" to \"{1}\".".format_with(sourceFilePath, destinationFilePath));
create_directory_if_not_exists(get_directory_name(destinationFilePath), ignoreError: true);

//Private Declare Function apiCopyFile Lib "kernel32" Alias "CopyFileA" _
Expand Down Expand Up @@ -329,7 +330,7 @@ _In_ BOOL bFailIfExists

public void delete_file(string filePath)
{
this.Log().Debug(() => "Attempting to delete file \"{0}\".".format_with(filePath));
this.Log().Debug(ChocolateyLoggers.Verbose, () => "Attempting to delete file \"{0}\".".format_with(filePath));
if (file_exists(filePath))
{
allow_retries(() => File.Delete(filePath));
Expand Down Expand Up @@ -433,7 +434,7 @@ public DirectoryInfo get_directory_info_from_file_path(string filePath)

public void create_directory(string directoryPath)
{
this.Log().Debug(() => "Attempting to create directory \"{0}\".".format_with(get_full_path(directoryPath)));
this.Log().Debug(ChocolateyLoggers.Verbose, () => "Attempting to create directory \"{0}\".".format_with(get_full_path(directoryPath)));
allow_retries(() => Directory.CreateDirectory(directoryPath));
}

Expand All @@ -444,12 +445,12 @@ public void move_directory(string directoryPath, string newDirectoryPath)

try
{
this.Log().Debug("Moving '{0}'{1} to '{2}'".format_with(directoryPath, Environment.NewLine, newDirectoryPath));
this.Log().Debug(ChocolateyLoggers.Verbose, "Moving '{0}'{1} to '{2}'".format_with(directoryPath, Environment.NewLine, newDirectoryPath));
allow_retries(() => Directory.Move(directoryPath, newDirectoryPath));
}
catch (Exception ex)
{
this.Log().Warn("Move failed with message:{0} {1}{0} Attempting backup move method.".format_with(Environment.NewLine, ex.Message));
this.Log().Warn(ChocolateyLoggers.Verbose, "Move failed with message:{0} {1}{0} Attempting backup move method.".format_with(Environment.NewLine, ex.Message));

create_directory_if_not_exists(newDirectoryPath, ignoreError: true);
foreach (var file in get_files(directoryPath, "*.*", SearchOption.AllDirectories).or_empty_list_if_null())
Expand All @@ -458,7 +459,7 @@ public void move_directory(string directoryPath, string newDirectoryPath)
if (file_exists(destinationFile)) delete_file(destinationFile);

create_directory_if_not_exists(get_directory_name(destinationFile), ignoreError: true);
this.Log().Debug("Moving '{0}'{1} to '{2}'".format_with(file, Environment.NewLine, destinationFile));
this.Log().Debug(ChocolateyLoggers.Verbose, "Moving '{0}'{1} to '{2}'".format_with(file, Environment.NewLine, destinationFile));
move_file(file, destinationFile);
}

Expand All @@ -477,7 +478,7 @@ public void copy_directory(string sourceDirectoryPath, string destinationDirecto
{
var destinationFile = file.Replace(sourceDirectoryPath, destinationDirectoryPath);
create_directory_if_not_exists(get_directory_name(destinationFile), ignoreError: true);
//this.Log().Debug("Copying '{0}' {1} to '{2}'".format_with(file, Environment.NewLine, destinationFile));
//this.Log().Debug(ChocolateyLoggers.Verbose, "Copying '{0}' {1} to '{2}'".format_with(file, Environment.NewLine, destinationFile));
copy_file(file, destinationFile, overwriteExisting);
}

Expand Down Expand Up @@ -531,7 +532,7 @@ public void delete_directory(string directoryPath, bool recursive, bool override
}
}

this.Log().Debug(() => "Attempting to delete directory \"{0}\".".format_with(get_full_path(directoryPath)));
this.Log().Debug(ChocolateyLoggers.Verbose, () => "Attempting to delete directory \"{0}\".".format_with(get_full_path(directoryPath)));
allow_retries(() => Directory.Delete(directoryPath, recursive));
}

Expand All @@ -557,7 +558,7 @@ public void ensure_file_attribute_set(string path, FileAttributes attributes)
var directoryInfo = get_directory_info_for(path);
if ((directoryInfo.Attributes & attributes) != attributes)
{
this.Log().Debug(() => "Adding '{0}' attribute(s) to '{1}'.".format_with(attributes.to_string(), path));
this.Log().Debug(ChocolateyLoggers.Verbose, () => "Adding '{0}' attribute(s) to '{1}'.".format_with(attributes.to_string(), path));
directoryInfo.Attributes |= attributes;
}
}
Expand All @@ -566,7 +567,7 @@ public void ensure_file_attribute_set(string path, FileAttributes attributes)
var fileInfo = get_file_info_for(path);
if ((fileInfo.Attributes & attributes) != attributes)
{
this.Log().Debug(() => "Adding '{0}' attribute(s) to '{1}'.".format_with(attributes.to_string(), path));
this.Log().Debug(ChocolateyLoggers.Verbose, () => "Adding '{0}' attribute(s) to '{1}'.".format_with(attributes.to_string(), path));
fileInfo.Attributes |= attributes;
}
}
Expand All @@ -579,7 +580,7 @@ public void ensure_file_attribute_removed(string path, FileAttributes attributes
var directoryInfo = get_directory_info_for(path);
if ((directoryInfo.Attributes & attributes) == attributes)
{
this.Log().Debug(() => "Removing '{0}' attribute(s) from '{1}'.".format_with(attributes.to_string(), path));
this.Log().Debug(ChocolateyLoggers.Verbose, () => "Removing '{0}' attribute(s) from '{1}'.".format_with(attributes.to_string(), path));
directoryInfo.Attributes &= ~attributes;
}
}
Expand All @@ -588,7 +589,7 @@ public void ensure_file_attribute_removed(string path, FileAttributes attributes
var fileInfo = get_file_info_for(path);
if ((fileInfo.Attributes & attributes) == attributes)
{
this.Log().Debug(() => "Removing '{0}' attribute(s) from '{1}'.".format_with(attributes.to_string(), path));
this.Log().Debug(ChocolateyLoggers.Verbose, () => "Removing '{0}' attribute(s) from '{1}'.".format_with(attributes.to_string(), path));
fileInfo.Attributes &= ~attributes;
}
}
Expand Down

0 comments on commit f9e0420

Please sign in to comment.