gem-empty 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +5 -4
- data/README.md +1 -1
- data/gem-empty.gemspec +1 -1
- data/lib/gem-empty/command.rb +10 -3
- data/lib/gem-empty/version.rb +1 -1
- data/test/{gem-wrappers → gem-empty}/command_test.rb +26 -11
- data/test/{gem-wrappers → gem-empty}/specification_and_version_test.rb +0 -0
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6e95c7d9f5a3ad3d3b2c3c64b05695d8067c933e
|
4
|
+
data.tar.gz: aea259f50208ba37c9a71328e0f8d52cbd280836
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff48a0076fce3b01c3e86accfce9578cdcba1ae0b9c1fcec25a2af03115456b735ae61c3fd4dfa7c441ab4d4e481e96178fce768bec17678e1b9293a046b883e
|
7
|
+
data.tar.gz: f07ba85d0e1d28bbe7d5fd53bce01e05e6bd6e4145200c2f948512012d08a140dc4431b9813fec3c772b574b98ae7e10b159d2fc731bc8674264ad82ee903b8c
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
data/gem-empty.gemspec
CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |s|
|
|
8
8
|
s.version = GemEmpty::VERSION
|
9
9
|
s.authors = ["Michal Papis"]
|
10
10
|
s.email = ["mpapis@gmail.com"]
|
11
|
-
s.homepage = "https://github.com/rvm/gem-
|
11
|
+
s.homepage = "https://github.com/rvm/gem-empty"
|
12
12
|
s.summary = "Gem command to remove all gems from current GEM_HOME."
|
13
13
|
s.license = "Apache 2.0"
|
14
14
|
s.files = `git ls-files`.split("\n")
|
data/lib/gem-empty/command.rb
CHANGED
@@ -2,10 +2,14 @@ require 'gem-empty/specification'
|
|
2
2
|
require 'rubygems/command_manager'
|
3
3
|
require 'rubygems/uninstaller'
|
4
4
|
require 'rubygems/version'
|
5
|
+
require 'fileutils'
|
5
6
|
|
6
7
|
class EmptyCommand < Gem::Command
|
8
|
+
attr_reader :options
|
9
|
+
|
7
10
|
def initialize
|
8
11
|
super 'empty', 'Remove all gems from current GEM_HOME.'
|
12
|
+
@default_options = { :install_dir => Gem.dir, :force => true, :executables => true }
|
9
13
|
end
|
10
14
|
|
11
15
|
def arguments # :nodoc:
|
@@ -26,11 +30,14 @@ Remove all gems from current 'GEM_HOME'.
|
|
26
30
|
DOC
|
27
31
|
end
|
28
32
|
|
29
|
-
def execute(
|
30
|
-
options =
|
33
|
+
def execute(opts = {})
|
34
|
+
@options = @default_options.merge(opts)
|
31
35
|
uninstaller = Gem::Uninstaller.new(nil, options)
|
32
36
|
uninstaller.remove_all(gem_dir_specs)
|
33
37
|
|
38
|
+
# Remove any Git gems installed via bundler
|
39
|
+
FileUtils.rm_rf( File.join( options[:install_dir] ,'bundler','gems' ) )
|
40
|
+
|
34
41
|
rescue Gem::DependencyRemovalException,
|
35
42
|
Gem::InstallError,
|
36
43
|
Gem::GemNotInHomeException,
|
@@ -44,7 +51,7 @@ private
|
|
44
51
|
def gem_dir_specs
|
45
52
|
@gem_dir_specs ||=
|
46
53
|
GemEmpty::Specification.installed_gems.select do |spec|
|
47
|
-
File.exists?( File.join(
|
54
|
+
File.exists?( File.join( options[:install_dir], 'gems', spec.full_name ) )
|
48
55
|
end
|
49
56
|
end
|
50
57
|
|
data/lib/gem-empty/version.rb
CHANGED
@@ -25,15 +25,19 @@ describe EmptyCommand do
|
|
25
25
|
subject.program_name.class.must_equal(String)
|
26
26
|
end
|
27
27
|
|
28
|
-
describe "
|
28
|
+
describe "gem-empty" do
|
29
29
|
before do
|
30
|
-
file = Tempfile.new('command-
|
30
|
+
file = Tempfile.new('command-empty')
|
31
31
|
@test_path = file.path
|
32
32
|
file.close
|
33
33
|
file.unlink
|
34
34
|
@ui = Gem::MockGemUi.new
|
35
|
-
@
|
36
|
-
installer = Gem::Installer.new(@
|
35
|
+
@found_minitest = Gem::Specification.find_by_name('minitest')
|
36
|
+
installer = Gem::Installer.new(@found_minitest.cache_file, :version => @found_minitest.version, :install_dir => @test_path)
|
37
|
+
bundler_git_gems_path = File.join(@test_path,'bundler','gems')
|
38
|
+
FileUtils.mkdir_p(bundler_git_gems_path)
|
39
|
+
@git_gem_file = File.join(bundler_git_gems_path, 'git-test')
|
40
|
+
FileUtils.touch(@git_gem_file)
|
37
41
|
use_ui @ui do
|
38
42
|
installer.install
|
39
43
|
end
|
@@ -45,24 +49,33 @@ describe EmptyCommand do
|
|
45
49
|
end
|
46
50
|
|
47
51
|
it "removes gems" do
|
48
|
-
File.exist?(File.join(@test_path, "gems", @
|
52
|
+
File.exist?(File.join(@test_path, "gems", @found_minitest.full_name)).must_equal(true)
|
49
53
|
use_ui @ui do
|
50
54
|
subject.execute(:install_dir => @test_path)
|
51
55
|
end
|
52
|
-
File.exist?(File.join(@test_path, "gems", @
|
56
|
+
File.exist?(File.join(@test_path, "gems", @found_minitest.full_name)).must_equal(false)
|
53
57
|
@ui.output.must_match(
|
54
|
-
/
|
58
|
+
/Successfully uninstalled minitest-/
|
55
59
|
)
|
56
60
|
@ui.error.must_equal("")
|
57
61
|
end
|
58
62
|
|
63
|
+
it "removes git gems installed via bundler" do
|
64
|
+
File.exist?(@git_gem_file).must_equal(true)
|
65
|
+
use_ui @ui do
|
66
|
+
subject.execute(:install_dir => @test_path)
|
67
|
+
end
|
68
|
+
File.exist?(@git_gem_file).must_equal(false)
|
69
|
+
@ui.error.must_equal("")
|
70
|
+
end
|
71
|
+
|
59
72
|
it "fails gems" do
|
60
|
-
File.chmod(0500, File.join(@test_path
|
73
|
+
File.chmod(0500, File.join(@test_path) )
|
61
74
|
use_ui @ui do
|
62
75
|
subject.execute(:install_dir => @test_path)
|
63
76
|
end
|
64
|
-
File.exist?(File.join(@test_path, "gems", @
|
65
|
-
File.chmod(0755, File.join(@test_path
|
77
|
+
File.exist?(File.join(@test_path, "gems", @found_minitest.full_name)).must_equal(true)
|
78
|
+
File.chmod(0755, File.join(@test_path) )
|
66
79
|
@ui.output.must_equal("")
|
67
80
|
@ui.error.must_match(
|
68
81
|
/ERROR: Gem::FilePermissionError: You don't have write permissions for the .* directory/
|
@@ -72,7 +85,9 @@ describe EmptyCommand do
|
|
72
85
|
end
|
73
86
|
|
74
87
|
it "finds gem executables" do
|
75
|
-
subject.
|
88
|
+
subject.stub :options, {:install_dir => Gem.dir } do
|
89
|
+
subject.send(:gem_dir_specs).map{|spec| spec.name}.must_include('minitest')
|
90
|
+
end
|
76
91
|
end
|
77
92
|
|
78
93
|
end
|
File without changes
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gem-empty
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michal Papis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-04-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -57,10 +57,10 @@ files:
|
|
57
57
|
- lib/gem-empty/specification.rb
|
58
58
|
- lib/gem-empty/version.rb
|
59
59
|
- lib/rubygems_plugin.rb
|
60
|
-
- test/gem-
|
61
|
-
- test/gem-
|
60
|
+
- test/gem-empty/command_test.rb
|
61
|
+
- test/gem-empty/specification_and_version_test.rb
|
62
62
|
- test/test_helper.rb
|
63
|
-
homepage: https://github.com/rvm/gem-
|
63
|
+
homepage: https://github.com/rvm/gem-empty
|
64
64
|
licenses:
|
65
65
|
- Apache 2.0
|
66
66
|
metadata: {}
|
@@ -80,11 +80,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
80
80
|
version: '0'
|
81
81
|
requirements: []
|
82
82
|
rubyforge_project:
|
83
|
-
rubygems_version: 2.
|
83
|
+
rubygems_version: 2.4.3
|
84
84
|
signing_key:
|
85
85
|
specification_version: 4
|
86
86
|
summary: Gem command to remove all gems from current GEM_HOME.
|
87
87
|
test_files:
|
88
|
-
- test/gem-
|
89
|
-
- test/gem-
|
88
|
+
- test/gem-empty/command_test.rb
|
89
|
+
- test/gem-empty/specification_and_version_test.rb
|
90
90
|
- test/test_helper.rb
|