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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5bbd464c2b3d70cadf8d22c16ce97f71e46100ac
4
- data.tar.gz: adf762ac6cf0e8f1464d279f310e5677b045a8ff
3
+ metadata.gz: 6e95c7d9f5a3ad3d3b2c3c64b05695d8067c933e
4
+ data.tar.gz: aea259f50208ba37c9a71328e0f8d52cbd280836
5
5
  SHA512:
6
- metadata.gz: bd55f20814bb45071438411ebe2497ccfb3802b79f121aa24c470dd46cef8d42cf02ea0c43874cbd531e13ba89219dafa44bbdeb69a12b5a8855391ba1d1acff
7
- data.tar.gz: f652c969af148314324ba57d28f6980c8b7ab3e01e84eb5a4d21d7efdbdf5bd38ded637a6cc3eee1951c724cf38f5f6151afb2f857b227531ac84ad3a21803c1
6
+ metadata.gz: ff48a0076fce3b01c3e86accfce9578cdcba1ae0b9c1fcec25a2af03115456b735ae61c3fd4dfa7c441ab4d4e481e96178fce768bec17678e1b9293a046b883e
7
+ data.tar.gz: f07ba85d0e1d28bbe7d5fd53bce01e05e6bd6e4145200c2f948512012d08a140dc4431b9813fec3c772b574b98ae7e10b159d2fc731bc8674264ad82ee903b8c
@@ -1,13 +1,14 @@
1
1
  language: ruby
2
2
  rvm:
3
- - jruby
4
- - rbx
5
- - ruby-head
6
3
  - 1.8.7
7
4
  - 1.9.2
8
5
  - 1.9.3
9
6
  - 2.0.0
10
- - 2.1.0
7
+ - 2.1
8
+ - 2.2
9
+ - ruby-head
10
+ - jruby
11
+ - rbx
11
12
  notifications:
12
13
  irc:
13
14
  channels:
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Gem wrappers
1
+ # Gem empty
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/gem-empty.png)](http://rubygems.org/gems/gem-empty)
4
4
  [![Code Climate](https://codeclimate.com/github/rvm/gem-empty.png)](https://codeclimate.com/github/rvm/gem-empty)
@@ -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-wrappers"
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")
@@ -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(options = {})
30
- options = {:force => true, :executables => true }.merge(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( Gem.dir, 'gems', spec.full_name ) )
54
+ File.exists?( File.join( options[:install_dir], 'gems', spec.full_name ) )
48
55
  end
49
56
  end
50
57
 
@@ -1,3 +1,3 @@
1
1
  module GemEmpty
2
- VERSION = "1.0.0"
2
+ VERSION = "1.1.0"
3
3
  end
@@ -25,15 +25,19 @@ describe EmptyCommand do
25
25
  subject.program_name.class.must_equal(String)
26
26
  end
27
27
 
28
- describe "wrappers" do
28
+ describe "gem-empty" do
29
29
  before do
30
- file = Tempfile.new('command-wrappers')
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
- @found_rake = Gem::Specification.find_by_name('rake')
36
- installer = Gem::Installer.new(@found_rake.cache_file, :version => @found_rake.version, :install_dir => @test_path)
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", @found_rake.full_name)).must_equal(true)
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", @found_rake.full_name)).must_equal(false)
56
+ File.exist?(File.join(@test_path, "gems", @found_minitest.full_name)).must_equal(false)
53
57
  @ui.output.must_match(
54
- /Removing rake\nSuccessfully uninstalled rake-/
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, "bin") )
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", @found_rake.full_name)).must_equal(true)
65
- File.chmod(0755, File.join(@test_path, "bin") )
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.send(:gem_dir_specs).map{|spec| spec.name}.must_include('minitest')
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
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.0.0
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: 2013-12-20 00:00:00.000000000 Z
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-wrappers/command_test.rb
61
- - test/gem-wrappers/specification_and_version_test.rb
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-wrappers
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.0.14
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-wrappers/command_test.rb
89
- - test/gem-wrappers/specification_and_version_test.rb
88
+ - test/gem-empty/command_test.rb
89
+ - test/gem-empty/specification_and_version_test.rb
90
90
  - test/test_helper.rb