Skip to content
This repository has been archived by the owner on Dec 18, 2017. It is now read-only.

Adding dnu clearcache command #2742

Closed
wants to merge 5 commits into from
Closed

Adding dnu clearcache command #2742

wants to merge 5 commits into from

Conversation

muratg
Copy link
Contributor

@muratg muratg commented Sep 18, 2015

Implements #2401

@dnfclas
Copy link

dnfclas commented Sep 18, 2015

Hi @muratg, I'm your friendly neighborhood .NET Foundation Pull Request Bot (You can call me DNFBOT). Thanks for your contribution!
You've already signed the contribution license agreement. Thanks!

The agreement was validated by .NET Foundation and real humans are currently evaluating your PR.

TTYL, DNFBOT;

{
public Reports Reports { get; }
public string HttpCacheDirectory { get; }
public ClearCacheCommand(Reports reports, string httpCacheDirectory)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix all the formatting please 😄 Empty line above the ctor.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

{
public static void Register(CommandLineApplication cmdApp, ReportsFactory reportsFactory)
{
cmdApp.Command("clearcache", c =>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clear-cache

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 looks like we hyphenate multi-word commands in dnu in general.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually :-1/2: because it looks like we randomly do things in random places 😄

 -s|--source <FEED>
 -f|--fallbacksource <FEED>
 -p|--proxy <ADDRESS>
 --no-cache
 --packages
 --ignore-failed-sources
 --quiet
 --parallel
 -?|-h|--help

--fallbacksource is one word, but --ignore-failed-sources is multi-word.

Do whatever you want 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer hyphenating. If we need to change other things to be consistent (eventually) so be it.

}
public void DeleteDirectoryRecursively(string baseDirectory, bool deleteBaseDirectory)
{
var files = Directory.GetFiles(baseDirectory);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be safe to delete the base directory.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, restore creates it if it doesn't exist. I was thinking to keep it safe if we change the restore behavior in the future though.

But fair enough, I'll make the change to simplify the code.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason we wrote a helper to do something the BCL already does?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/aspnet/dnx/blob/dev/src/Microsoft.Dnx.Tooling/Utils/FileOperationUtils.cs#L15

There used to be logic that marked readonly files as not readonly I think.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, will switch to the helper. As dnu restore creates the cache directory if it doesn't exist, it is safe to do.

@Eilon
Copy link
Member

Eilon commented Sep 22, 2015

:shipit:

try
{
FileOperationUtils.DeleteFolder(HttpCacheDirectory);
Reports.Information.WriteLine("Cache cleared.");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we have some extension methods for Reports to write information directly.

@muratg
Copy link
Contributor Author

muratg commented Sep 24, 2015

Fixed: 3d0edc0

@muratg muratg closed this Sep 24, 2015
@muratg muratg deleted the muratg/dnucache branch October 7, 2015 21:32
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants