gem-reset 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/gem-reset +40 -0
- metadata +67 -0
data/bin/gem-reset
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
module Reset
|
3
|
+
class Gem < Struct.new(:name, :version)
|
4
|
+
def uninstall!
|
5
|
+
command = "yes | gem uninstall #{name} -v #{version} 2> /dev/null"
|
6
|
+
system(command) || globally(command)
|
7
|
+
end
|
8
|
+
def to_s
|
9
|
+
"#{name} (#{version})\n"
|
10
|
+
end
|
11
|
+
|
12
|
+
def globally command
|
13
|
+
puts command = "rvm gemset use global && #{command}"
|
14
|
+
system command
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.parse(cli_output)
|
18
|
+
[].tap do |gems|
|
19
|
+
cli_output.scan(/(\S+) \((.*)\)/) do |name, versions|
|
20
|
+
versions.split(', ').each do |version|
|
21
|
+
gems << new(name, version)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
bundled_gems = Reset::Gem.parse(`bundle show`)
|
30
|
+
gemset_gems = Reset::Gem.parse(`gem list`)
|
31
|
+
|
32
|
+
keepers = %w[bundler gem-reset]
|
33
|
+
|
34
|
+
extra_gems = gemset_gems.reject do |gem|
|
35
|
+
bundled_gems.include?(gem) || keepers.include?(gem.name)
|
36
|
+
end
|
37
|
+
|
38
|
+
puts 'extra gems:', extra_gems
|
39
|
+
|
40
|
+
extra_gems.each(&:uninstall!)
|
metadata
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: gem-reset
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 27
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
- 0
|
10
|
+
version: 0.1.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Brian Dunn
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-09-20 00:00:00 -05:00
|
19
|
+
default_executable:
|
20
|
+
dependencies: []
|
21
|
+
|
22
|
+
description:
|
23
|
+
email: brianpatrickdunn@gmail.com
|
24
|
+
executables:
|
25
|
+
- gem-reset
|
26
|
+
extensions: []
|
27
|
+
|
28
|
+
extra_rdoc_files: []
|
29
|
+
|
30
|
+
files:
|
31
|
+
- bin/gem-reset
|
32
|
+
has_rdoc: true
|
33
|
+
homepage: http://github.com/briandunn/gem-reset
|
34
|
+
licenses: []
|
35
|
+
|
36
|
+
post_install_message:
|
37
|
+
rdoc_options: []
|
38
|
+
|
39
|
+
require_paths:
|
40
|
+
- lib
|
41
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
hash: 3
|
47
|
+
segments:
|
48
|
+
- 0
|
49
|
+
version: "0"
|
50
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
hash: 3
|
56
|
+
segments:
|
57
|
+
- 0
|
58
|
+
version: "0"
|
59
|
+
requirements: []
|
60
|
+
|
61
|
+
rubyforge_project:
|
62
|
+
rubygems_version: 1.3.7
|
63
|
+
signing_key:
|
64
|
+
specification_version: 3
|
65
|
+
summary: Synchronizes gemset with bundle
|
66
|
+
test_files: []
|
67
|
+
|