gem-ext-cleaner 0.0.2 → 0.1.1

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
  SHA256:
3
- metadata.gz: 760320c93bfc30499f74c87aef23af8c93d02f4eeea2ad386e95e84b1ee8bbbb
4
- data.tar.gz: 81f6acb573637084dfc91e5158168ce7a4d3b4583c50a1ad4814821469dcebfa
3
+ metadata.gz: 73c77011b33a102341408753f7320f664811a8f757cecb461545cc525e9eacfc
4
+ data.tar.gz: 894d7f4f5b2bbd325de370ca8862ba80bf2d31fa56e356022d3cf239e7a0a3ab
5
5
  SHA512:
6
- metadata.gz: 65bfd08c9370320c3b59843dc40dbd3ec098a41d5256190155357bcaeb329e7bdb7cbe14b3d8c046c81b4d47ab3f63d8a19c37b95132370cbbdc4e8c2d22686c
7
- data.tar.gz: 555c1dd7de34e832068f624d634f5e6a4a322c08ddaaea297aab9bf91a25f8286f39cf2d18127cb7e8370bb29c87301a4af32756fe07be3b19c0117d21fee91f
6
+ metadata.gz: a4fc14d2abd9276c650ac6248f09546c4974aa209fe0d481ef45a0f14c2288d436a95441fb618d4bd1d4b8b11f76b3b3c34402e0a2c31ef6e11c6480d7461c38
7
+ data.tar.gz: 516d9c5d70390ea730c1c43b7c30bdff95a54a827637ad2927d2d5f5240ffb135256b598148f9d44c7176a46a4124f0ae78c11d484cad434fdee40ea6be3760d
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "gem-ext-cleaner"
4
+
5
+ Gem::Specification.each do |spec|
6
+ next if spec.extensions.empty?
7
+ GemExtCleaner.clean(spec)
8
+ end
@@ -0,0 +1,19 @@
1
+ require "rbconfig"
2
+ require "pathname"
3
+
4
+ module GemExtCleaner
5
+ def self.clean(spec)
6
+ (spec.full_require_paths - [spec.extension_dir]).each do |path|
7
+ Dir.glob(File.join(path, "**/*")).each do |file|
8
+ # Prevent deleting files in versioned directories like google-protobuf, nokogiri
9
+ next if file =~ /(\d+\.\d+\/)/
10
+
11
+ if Pathname(file).extname == ".#{RbConfig::CONFIG["DLEXT"]}"
12
+ File.delete(file)
13
+ puts "Delete #{file}"
14
+ end
15
+ end
16
+ rescue Errno::EPERM
17
+ end
18
+ end
19
+ end
@@ -1,18 +1,5 @@
1
- # このプラグインは gem のインストール後に実行される
2
- # このプラグインは `lib` の下にコピーされた foo.so や foo.bundle などのファイルを削除する
3
-
4
- require "rbconfig"
5
- require "pathname"
1
+ require "gem-ext-cleaner"
6
2
 
7
3
  Gem.post_install do |installer|
8
- (installer.spec.full_require_paths - [installer.spec.extension_dir]).each do |path|
9
- Dir.glob(File.join(path, "**/*")).each do |file|
10
- next if file =~ /\/\d+\.\d\// # for fat gem
11
- if Pathname(file).extname == ".#{RbConfig::CONFIG["DLEXT"]}"
12
- File.delete(file)
13
- puts "Delete #{file}"
14
- end
15
- end
16
- end
17
- rescue Errno::EPERM
4
+ GemExtCleaner.clean(installer.spec)
18
5
  end
metadata CHANGED
@@ -1,22 +1,24 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gem-ext-cleaner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hiroshi SHIBATA
8
- autorequire:
9
- bindir: bin
8
+ bindir: exe
10
9
  cert_chain: []
11
- date: 2023-11-08 00:00:00.000000000 Z
10
+ date: 2024-05-28 00:00:00.000000000 Z
12
11
  dependencies: []
13
12
  description: Clean up unnecessary extension files for gem command.
14
13
  email:
15
14
  - hsbt@ruby-lang.org
16
- executables: []
15
+ executables:
16
+ - gem-ext-cleaner
17
17
  extensions: []
18
18
  extra_rdoc_files: []
19
19
  files:
20
+ - exe/gem-ext-cleaner
21
+ - lib/gem-ext-cleaner.rb
20
22
  - lib/rubygems_plugin.rb
21
23
  homepage: https://github.com/hsbt/gem-ext-cleaner
22
24
  licenses:
@@ -25,7 +27,6 @@ licenses:
25
27
  metadata:
26
28
  homepage_uri: https://github.com/hsbt/gem-ext-cleaner
27
29
  source_code_uri: https://github.com/hsbt/gem-ext-cleaner
28
- post_install_message:
29
30
  rdoc_options: []
30
31
  require_paths:
31
32
  - lib
@@ -40,8 +41,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
40
41
  - !ruby/object:Gem::Version
41
42
  version: '0'
42
43
  requirements: []
43
- rubygems_version: 3.5.0.dev
44
- signing_key:
44
+ rubygems_version: 3.6.0.dev
45
45
  specification_version: 4
46
46
  summary: Clean up unnecessary extension files for gem command.
47
47
  test_files: []