vsclean 1.0.4 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 150ef2accc42de50614346ff12e166710e05b2ba
4
- data.tar.gz: b0d4deb2274b28f8e90a3bb4abebd9bfb3aa88fc
3
+ metadata.gz: d1e059aa7fc5cc0d7fa8ac5c6f6a971337a4cddc
4
+ data.tar.gz: 31f08c3a8c0181ad6aa2d1a4236a11ead7498b0d
5
5
  SHA512:
6
- metadata.gz: 906d7f0d8ce82dd34c2ec1323fe91e8bddac340f66155269d9bf6aa15808fa053eeb54329d45ad78989c42a7e4502ffee385fe5371560782d90b3cdabac2f33d
7
- data.tar.gz: 928d97b27707953c60834978a49439b374bb0d99779a7bd3605c1bdbcbcbc8026e29b1c753ef84a397ea3f6b72372240c608d8075ca55aee5328220465063efa
6
+ metadata.gz: ce729eafc0605d7be15589a1badc4d7e2ef56207bb7348a5242c861d346d9c92e732f5b6d9f8999f96e61142740bb9929c00c51651844aa39530ad157afb7d93
7
+ data.tar.gz: 1a0b9a68e045bf567e5ec252c60fef5f518bf347de5898f3379ab0a51b8cd01b66198470d014d911fb8823ac9edc9e22e0b84c0463275cbf9a9e3cd1f8d54832
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require "clean"
3
+ require "commands/commands"
4
4
 
5
- VsClean::Clean.run(ARGV)
5
+ VsClean::Command.run(ARGV)
@@ -0,0 +1,64 @@
1
+ require "claide"
2
+ require "info"
3
+ require "console"
4
+ require "fileutils"
5
+
6
+ module VsClean
7
+ class Command < CLAide::Command
8
+ self.command = "vsclean"
9
+ self.version = VsClean::VERSION
10
+ self.description = VsClean::DESCRIPTION
11
+
12
+ def self.options
13
+ [
14
+ ['[--global]', 'Delete global caches and temporary files'],
15
+ ['[--dry-run]', 'Simulate deletion (list all files and directories that would be deleted)']
16
+ ].concat(super)
17
+ end
18
+
19
+ def initialize(argv)
20
+ @dryrun = argv.flag?("dry-run")
21
+ @global = argv.flag?("global")
22
+ super
23
+ end
24
+
25
+ def run
26
+ paths = @global ? collect_global_paths : collect_local_paths
27
+
28
+ if paths.none?
29
+ Console.log_step("All good... nothing to clean!")
30
+ return
31
+ end
32
+
33
+ Console.log_step("Cleaning...")
34
+ paths.each { |d| @dryrun ? simulate_delete(d) : delete(d) }
35
+ Console.log_step("Done!")
36
+ end
37
+
38
+ def collect_global_paths
39
+ home = File.expand_path("~")
40
+ paths = Dir.glob(home + "/AppData/Local/JetBrains/**/SolutionCaches").select { |f| File.directory?(f) }
41
+ paths.push(home + "/AppData/Microsoft/WebsiteCache")
42
+ paths.push(*Dir.glob(home + "/AppData/Local/Microsoft/**/ComponentModelCache"))
43
+ end
44
+
45
+ def collect_local_paths
46
+ # bin and obj directories
47
+ paths = Dir.glob("**/{bin,obj}").select { |f| File.directory?(f) }
48
+
49
+ # .suo files (can cause Intellisense errors, solution load issues and more)
50
+ paths.push(*Dir.glob("**/.vs/**/.suo"))
51
+ end
52
+
53
+ def simulate_delete(path)
54
+ Console.log_substep("Would delete '#{path}'")
55
+ end
56
+
57
+ def delete(path)
58
+ FileUtils.rm_r(path)
59
+ Console.log_substep("Deleted '#{path}'")
60
+ rescue StandardError => e
61
+ Console.log_error("Could not delete '#{path}': #{e.message}")
62
+ end
63
+ end
64
+ end
@@ -0,0 +1 @@
1
+ require_relative "command.rb"
@@ -1,5 +1,5 @@
1
1
  module VsClean
2
2
  NAME = "vsclean"
3
- VERSION = "1.0.4"
4
- DESCRIPTION = %q{Recursively delete temporary Visual Studio files from the current directory}
3
+ VERSION = "1.0.5"
4
+ DESCRIPTION = %q{A recursive delete of temporary Visual Studio and ReSharper output files, vsclean performs.}
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vsclean
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michaël Fortin
@@ -90,7 +90,8 @@ files:
90
90
  - README.md
91
91
  - Rakefile
92
92
  - bin/vsclean
93
- - lib/clean.rb
93
+ - lib/commands/command.rb
94
+ - lib/commands/commands.rb
94
95
  - lib/console.rb
95
96
  - lib/info.rb
96
97
  - vsclean.gemspec
@@ -117,5 +118,6 @@ rubyforge_project:
117
118
  rubygems_version: 2.2.3
118
119
  signing_key:
119
120
  specification_version: 4
120
- summary: Recursively delete temporary Visual Studio files from the current directory
121
+ summary: A recursive delete of temporary Visual Studio and ReSharper output files,
122
+ vsclean performs.
121
123
  test_files: []
@@ -1,42 +0,0 @@
1
- require "claide"
2
- require "info"
3
- require "console"
4
- require "fileutils"
5
-
6
- module VsClean
7
- class Clean < CLAide::Command
8
- self.command = "vsclean"
9
- self.version = VsClean::VERSION
10
- self.description = VsClean::DESCRIPTION
11
-
12
- def initialize(argv)
13
- super
14
- end
15
-
16
- def run
17
- # Delete bin and obj directories
18
- paths = Dir.glob("**/{bin,obj}").select { |f| File.directory?(f) }
19
-
20
- # Delete .suo files (can cause Intellisense errors, among other things)
21
- paths.push(*Dir.glob("**/.vs/**/.suo"))
22
-
23
- if paths.none?
24
- Console.log_step("All is well with the world... nothing to clean!")
25
- return
26
- end
27
-
28
- Console.log_step("Cleaning...")
29
-
30
- paths.each { |d| delete(d) }
31
-
32
- Console.log_step("Done!")
33
- end
34
-
35
- def delete(path)
36
- FileUtils.rm_r(path)
37
- Console.log_substep("Deleted ./#{path}")
38
- rescue StandardError => e
39
- Console.log_error("Could not delete './#{path}': #{e.message}")
40
- end
41
- end
42
- end