gem-nuke 1.0.1

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: eeede57208a3d0b6425833f685a21a1af7b5b82480bf60248591c89bb8e7de96
4
+ data.tar.gz: 2874ab4be9a1e419ca7d5f4edd4289e879ef047be252c4bae5182e886cc6d79c
5
+ SHA512:
6
+ metadata.gz: 1a0f6753f3185d9de2fa3838c952430df14551e512e102930d55ccf6f54f42472c2be0aa74dc40e05eb7bc66a16d87c73c6c104b5e475396c295755f00288d66
7
+ data.tar.gz: 3d1adf2f666e6673885a4900e32d0ce79fe9d926ed0e7ce28ffa9b2822671bdc1bcf95290413fa6041e33cef237ce9d6e88f520dd4c4f24c0aba2eb4d03ff29d
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2017 Sergii Ovcharenko
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,27 @@
1
+ # gem-nuke
2
+ Plugin for gem that will allow you to uninstall all gems except for those that are 'vaulted'.
3
+
4
+ ## Installation
5
+ ```
6
+ $ gem install gem-nuke
7
+ ```
8
+
9
+ ## Usage
10
+ ```
11
+ $ gem nuke
12
+ ```
13
+ This will uninstall all gems including gem-nuke itself.
14
+
15
+ ```
16
+ $ gem nuke --vault bundler,gem-nuke,...
17
+
18
+ ```
19
+ This will uninstall all gems except for bundler, gem-nuke and others specified as comma separated gem names.
20
+
21
+ If you don't want to supply `--vault` option every time you run `gem nuke` or just to avoid accidental `nuke` of important gems,
22
+ you can set default value for this option by editing your `~/.gemrc` and adding
23
+
24
+ ```
25
+ nuke: --vault gem-nuke,bundler,and_or_other_gems
26
+
27
+ ```
@@ -0,0 +1,3 @@
1
+ module GemNuke
2
+ VERSION = '1.0.1'.freeze
3
+ end
@@ -0,0 +1,51 @@
1
+ require 'rubygems/version_option'
2
+ require 'rubygems/uninstaller'
3
+
4
+ module Gem
5
+ module Commands
6
+ class NukeCommand < Gem::Command
7
+ def initialize
8
+ super 'nuke', description
9
+
10
+ add_option('-v', '--vault gemname1,gemname2', Array,
11
+ "Gems in vault that'll survive this command") do |vault, options|
12
+ options[:vault] = vault
13
+ end
14
+ end
15
+
16
+ def arguments # :nodoc:
17
+ ''
18
+ end
19
+
20
+ def usage # :nodoc:
21
+ program_name.to_s
22
+ end
23
+
24
+ def defaults_str # :nodoc:
25
+ ''
26
+ end
27
+
28
+ def description # :nodoc:
29
+ 'Nukes gems. The ones in vault will survive.'
30
+ end
31
+
32
+ def execute
33
+ options[:vault] ||= []
34
+
35
+ specs_to_uninstall = Gem::Specification.reject { |spec| options[:vault].include?(spec.name) }
36
+
37
+ specs_to_uninstall.each do |spec|
38
+ begin
39
+ Gem::Uninstaller.new(spec.name, {
40
+ force: true,
41
+ executables: true
42
+ }).uninstall
43
+ puts spec.name
44
+ rescue StandardError
45
+ # ignored
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,3 @@
1
+ require 'rubygems/commands/nuke_command'
2
+
3
+ Gem::CommandManager.instance.register_command :nuke
metadata ADDED
@@ -0,0 +1,118 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gem-nuke
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Sergii Ovcharenko
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-12-04 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec_junit_formatter
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rubocop
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description:
84
+ email: developer@sovcharenko.com
85
+ executables: []
86
+ extensions: []
87
+ extra_rdoc_files: []
88
+ files:
89
+ - LICENSE
90
+ - README.md
91
+ - lib/gem_nuke/version.rb
92
+ - lib/rubygems/commands/nuke_command.rb
93
+ - lib/rubygems_plugin.rb
94
+ homepage: https://github.com/sovcharenko/gem-nuke
95
+ licenses:
96
+ - MIT
97
+ metadata: {}
98
+ post_install_message:
99
+ rdoc_options: []
100
+ require_paths:
101
+ - lib
102
+ required_ruby_version: !ruby/object:Gem::Requirement
103
+ requirements:
104
+ - - ">="
105
+ - !ruby/object:Gem::Version
106
+ version: '0'
107
+ required_rubygems_version: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - ">="
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
112
+ requirements: []
113
+ rubyforge_project:
114
+ rubygems_version: 2.7.3
115
+ signing_key:
116
+ specification_version: 4
117
+ summary: Gem command to remove all installed gems.
118
+ test_files: []