gem-path 0.6.2 → 1.0.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 1e2e0c0438bf3d62b91111d9b60dcad158520503
4
- data.tar.gz: 923a754d023996b109f68e39fca432d9d31d411d
2
+ SHA256:
3
+ metadata.gz: 4786a967e6d67052d64ae4a5bb5264d21afe2a57fca6d3b3eff326c16da5a325
4
+ data.tar.gz: 7f4b5583b9c2ae3cb4361bab1d2447549f5be2f097ade91deb9555fcc09e5b70
5
5
  SHA512:
6
- metadata.gz: a4a72b830609426ff2de8afd351a2ddfcb42aeb2fe01a42397d94e6616240378550aef709d07ab26c20066663c00406421a4783dfc13b4ecc917744348f246df
7
- data.tar.gz: 2f2b5cabae2aa78dfac58949552143e485ef343fc40693063b1d3212f5d93bdb1e4f8c1bcfe5a5f748ba47b2a4a9835e2e821afb5bcdc9599e09c34f37a8874d
6
+ metadata.gz: fc857e7a5176cc260bfd5a9825e8a2938f56d4432120901f7c2ac541a6530bbf99143a407406f5eab3d7c91d693684fc3001b6bdcefe1caa24a82327866f2b1e
7
+ data.tar.gz: 972fae17e38c6feaccabbc73e9a5e865784fd3c5a1833ddf090a2b795efe04fcd1e620a25c263c52fb53e4b3dd92079552077a04652b12ccaa4398e350964942
data/.gitmodules CHANGED
@@ -1,3 +1,3 @@
1
1
  [submodule "task"]
2
2
  path = task
3
- url = git://github.com/godfat/gemgem.git
3
+ url = https://github.com/godfat/gemgem.git
data/CHANGES.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # CHANGES
2
2
 
3
+ ## gem-path 1.0.0 -- 2024-08-01
4
+
5
+ * Fixed looking up local gems specified in bundler.
6
+
7
+ ## gem-path 0.7.0 -- 2021-08-11
8
+
9
+ * Fixed finding gems like google-protobuf again on Mac where it may not be
10
+ using `x86_64-darwin20` but `universal-darwin`.
11
+
3
12
  ## gem-path 0.6.2 -- 2017-03-23
4
13
 
5
14
  * Fixed finding gems like google-protobuf which could have platform postfix.
data/README.md CHANGED
@@ -24,7 +24,7 @@ Or checkout [gem-eit][], [gem-grep][] for shorthands.
24
24
 
25
25
  ## REQUIREMENTS:
26
26
 
27
- * Tested with MRI (official CRuby) 1.9.3, 2.0.0, Rubinius and JRuby.
27
+ * Tested with MRI (official CRuby) and JRuby.
28
28
 
29
29
  ## INSTALLATION:
30
30
 
@@ -62,9 +62,9 @@ This was extracted from [eit-gem][].
62
62
 
63
63
  ## LICENSE:
64
64
 
65
- Apache License 2.0 (Apache-2)
65
+ Apache License 2.0 (Apache-2.0)
66
66
 
67
- Copyright (c) 2013-2017, Lin Jen-Shin (godfat)
67
+ Copyright (c) 2013-2024, Lin Jen-Shin (godfat)
68
68
 
69
69
  Licensed under the Apache License, Version 2.0 (the "License");
70
70
  you may not use this file except in compliance with the License.
data/Rakefile CHANGED
@@ -8,5 +8,5 @@ end
8
8
 
9
9
  Gemgem.init(__dir__) do |s|
10
10
  s.name = 'gem-path'
11
- s.version = '0.6.2'
11
+ s.version = '1.0.0'
12
12
  end
data/gem-path.gemspec CHANGED
@@ -1,14 +1,14 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: gem-path 0.6.2 ruby lib
2
+ # stub: gem-path 1.0.0 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "gem-path".freeze
6
- s.version = "0.6.2"
6
+ s.version = "1.0.0".freeze
7
7
 
8
8
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
9
9
  s.require_paths = ["lib".freeze]
10
10
  s.authors = ["Lin Jen-Shin (godfat)".freeze]
11
- s.date = "2017-03-23"
11
+ s.date = "2024-08-01"
12
12
  s.description = "Find the path for a given gem or require path for editing or greping.\n\nFor examples, under [fish](http://fishshell.com/):\n\n cd (gem path gem-path)\n vim (gem path gem-path)\n grep require -R (gem path gem-path)\n\nOr checkout [gem-eit][], [gem-grep][] for shorthands.\n\n[gem-eit]: https://github.com/godfat/gem-eit\n[gem-grep]: https://github.com/godfat/gem-grep".freeze
13
13
  s.email = ["godfat (XD) godfat.org".freeze]
14
14
  s.files = [
@@ -26,7 +26,7 @@ Gem::Specification.new do |s|
26
26
  "task/gemgem.rb".freeze,
27
27
  "test/test.rb".freeze]
28
28
  s.homepage = "https://github.com/godfat/gem-path".freeze
29
- s.licenses = ["Apache-2".freeze]
30
- s.rubygems_version = "2.6.10".freeze
29
+ s.licenses = ["Apache-2.0".freeze]
30
+ s.rubygems_version = "3.5.16".freeze
31
31
  s.summary = "Find the path for a given gem or require path for editing or greping.".freeze
32
32
  end
@@ -34,8 +34,12 @@ class Gem::Commands::PathCommand < Gem::Command
34
34
  def find_gem_path name
35
35
  gem_path = Gem.path.find do |base|
36
36
  gem_path = $LOAD_PATH.find do |path|
37
- platforms = Gem.platforms.
38
- map(&:to_s).map(&Regexp.method(:escape)).join('|')
37
+ platforms = [
38
+ 'ruby',
39
+ sitearch,
40
+ *univeral_darwin
41
+ ].map(&Regexp.method(:escape)).join('|')
42
+
39
43
  gem_path = path[
40
44
  %r{\A#{base}/
41
45
  (?:bundler/)?
@@ -44,10 +48,15 @@ class Gem::Commands::PathCommand < Gem::Command
44
48
  }x
45
49
  ]
46
50
  break gem_path if gem_path
51
+
52
+ if Object.const_defined?(:Bundler)
53
+ gem_path = bundler_gem_name_to_path[name]
54
+ break gem_path if gem_path
55
+ end
47
56
  end
48
57
  break gem_path if gem_path
49
58
  end
50
- gem_path.chop if gem_path
59
+ gem_path.chomp('/') if gem_path
51
60
  end
52
61
 
53
62
  private
@@ -62,4 +71,22 @@ class Gem::Commands::PathCommand < Gem::Command
62
71
  args # this could be a require path, go on searching
63
72
  end
64
73
  end
74
+
75
+ def bundler_gem_name_to_path
76
+ @bundler_gem_name_to_path ||= Bundler.load.
77
+ requested_specs.inject({}) do |result, spec|
78
+ result[spec.name] = spec.full_gem_path
79
+ result
80
+ end
81
+ end
82
+
83
+ def sitearch
84
+ @sitearch ||= RbConfig::CONFIG['sitearch']
85
+ end
86
+
87
+ def univeral_darwin
88
+ if sitearch.include?('darwin')
89
+ 'universal-darwin'
90
+ end
91
+ end
65
92
  end
data/task/README.md CHANGED
@@ -13,11 +13,11 @@ Provided tasks:
13
13
 
14
14
  ## REQUIREMENTS:
15
15
 
16
- * Tested with MRI (official CRuby), Rubinius and JRuby.
16
+ * Tested with MRI (official CRuby) and JRuby.
17
17
 
18
18
  ## INSTALLATION:
19
19
 
20
- git submodule add git://github.com/godfat/gemgem.git task
20
+ git submodule add https://github.com/godfat/gemgem.git task
21
21
 
22
22
  And in Rakefile:
23
23
 
@@ -39,13 +39,13 @@ end
39
39
 
40
40
  Apache License 2.0 (Apache-2.0)
41
41
 
42
- Copyright (c) 2011-2017, Lin Jen-Shin (godfat)
42
+ Copyright (c) 2011-2023, Lin Jen-Shin (godfat)
43
43
 
44
44
  Licensed under the Apache License, Version 2.0 (the "License");
45
45
  you may not use this file except in compliance with the License.
46
46
  You may obtain a copy of the License at
47
47
 
48
- <http://www.apache.org/licenses/LICENSE-2.0>
48
+ <https://www.apache.org/licenses/LICENSE-2.0>
49
49
 
50
50
  Unless required by applicable law or agreed to in writing, software
51
51
  distributed under the License is distributed on an "AS IS" BASIS,
data/task/gemgem.rb CHANGED
@@ -42,6 +42,7 @@ module Gemgem
42
42
 
43
43
  def gem_install
44
44
  require 'rubygems/commands/install_command'
45
+ require 'rubygems/package'
45
46
  # read ~/.gemrc
46
47
  Gem.use_paths(Gem.configuration[:gemhome], Gem.configuration[:gempath])
47
48
  Gem::Command.extra_args = Gem.configuration[:gem]
@@ -51,7 +52,8 @@ module Gemgem
51
52
  cmd.handle_options([])
52
53
 
53
54
  # install
54
- install = Gem::Installer.new(gem_path, cmd.options)
55
+ gem_package = Gem::Package.new(gem_path)
56
+ install = Gem::Installer.new(gem_package, cmd.options)
55
57
  install.install
56
58
  puts "\e[35mGem installed: \e[33m#{strip_path(install.gem_dir)}\e[0m"
57
59
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gem-path
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lin Jen-Shin (godfat)
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-23 00:00:00.000000000 Z
11
+ date: 2024-08-01 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |-
14
14
  Find the path for a given gem or require path for editing or greping.
@@ -44,9 +44,9 @@ files:
44
44
  - test/test.rb
45
45
  homepage: https://github.com/godfat/gem-path
46
46
  licenses:
47
- - Apache-2
47
+ - Apache-2.0
48
48
  metadata: {}
49
- post_install_message:
49
+ post_install_message:
50
50
  rdoc_options: []
51
51
  require_paths:
52
52
  - lib
@@ -61,9 +61,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
61
61
  - !ruby/object:Gem::Version
62
62
  version: '0'
63
63
  requirements: []
64
- rubyforge_project:
65
- rubygems_version: 2.6.10
66
- signing_key:
64
+ rubygems_version: 3.5.16
65
+ signing_key:
67
66
  specification_version: 4
68
67
  summary: Find the path for a given gem or require path for editing or greping.
69
68
  test_files: []