gem-sweep 0.2.0 → 0.3.0
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 +4 -4
- data/lib/rubygems/commands/sweep_command.rb +38 -3
- metadata +2 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fd5a57bc6db687ea41705adf2f4103a13cf51f66f6b600243f5e2901f4431a5c
|
|
4
|
+
data.tar.gz: 708f1394e2518fd0c79219fb467d9e13c808587a3f58a390a535ab567c2d3409
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 26b5d563cb49a3cdb2d41c2b1e1f210d17736ab8ae812bfbd7de39726b29d37d00d6d7843f3d7d91ecee39866d48d4f2873447919470093ca76d64b3b8851e9c
|
|
7
|
+
data.tar.gz: d5fdafe503f9087114b053554db76a6957c7157acce2838505008ec8c59ab5b5e77fbbeaff931bb7eec626d8c767014c3d09baf2f3a55227c59b66bbf03b72ec
|
|
@@ -46,6 +46,33 @@ module GemSweep
|
|
|
46
46
|
targets
|
|
47
47
|
end
|
|
48
48
|
|
|
49
|
+
def self.uninstall_missing_extensions(dryrun: false)
|
|
50
|
+
specs = Gem::Specification.select do |spec|
|
|
51
|
+
spec.respond_to?(:missing_extensions?) && spec.missing_extensions?
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
if specs.empty?
|
|
55
|
+
puts "No gems with missing extensions found"
|
|
56
|
+
return
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
require "rubygems/uninstaller"
|
|
60
|
+
|
|
61
|
+
specs.each do |spec|
|
|
62
|
+
if dryrun
|
|
63
|
+
puts "Would uninstall #{spec.full_name} (missing extensions)"
|
|
64
|
+
else
|
|
65
|
+
begin
|
|
66
|
+
uninstaller = Gem::Uninstaller.new(spec.name, version: spec.version, executables: true)
|
|
67
|
+
uninstaller.uninstall
|
|
68
|
+
puts "Uninstalled #{spec.full_name} (missing extensions)"
|
|
69
|
+
rescue Gem::InstallError => e
|
|
70
|
+
puts "Could not uninstall #{spec.full_name}: #{e.message}"
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
|
|
49
76
|
def self.remove_targets(targets, dryrun: false)
|
|
50
77
|
targets.each do |path|
|
|
51
78
|
begin
|
|
@@ -74,6 +101,10 @@ class Gem::Commands::SweepCommand < Gem::Command
|
|
|
74
101
|
add_option("-n", "--dryrun", "Show what would be deleted without actually deleting") do |value, options|
|
|
75
102
|
options[:dryrun] = true
|
|
76
103
|
end
|
|
104
|
+
|
|
105
|
+
add_option("--missing-extensions", "Uninstall gems with missing C extensions") do |value, options|
|
|
106
|
+
options[:missing_extensions] = true
|
|
107
|
+
end
|
|
77
108
|
end
|
|
78
109
|
|
|
79
110
|
def execute
|
|
@@ -85,9 +116,13 @@ class Gem::Commands::SweepCommand < Gem::Command
|
|
|
85
116
|
puts
|
|
86
117
|
end
|
|
87
118
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
119
|
+
if options[:missing_extensions]
|
|
120
|
+
GemSweep.uninstall_missing_extensions(dryrun: dryrun)
|
|
121
|
+
else
|
|
122
|
+
Gem::Specification.each do |spec|
|
|
123
|
+
if aggressive || !spec.extensions.empty?
|
|
124
|
+
GemSweep.clean(spec, aggressive: aggressive, dryrun: dryrun)
|
|
125
|
+
end
|
|
91
126
|
end
|
|
92
127
|
end
|
|
93
128
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: gem-sweep
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Hiroshi SHIBATA
|
|
@@ -20,8 +20,7 @@ files:
|
|
|
20
20
|
- lib/rubygems_plugin.rb
|
|
21
21
|
homepage: https://github.com/hsbt/gem-sweep
|
|
22
22
|
licenses:
|
|
23
|
-
-
|
|
24
|
-
- BSD-2-Clause
|
|
23
|
+
- MIT
|
|
25
24
|
metadata:
|
|
26
25
|
homepage_uri: https://github.com/hsbt/gem-sweep
|
|
27
26
|
source_code_uri: https://github.com/hsbt/gem-sweep
|