gem-path 0.5.1 → 0.6.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
2
  SHA1:
3
- metadata.gz: 7c02bbe30c19779d0ed58d7a5d555825cef64ba7
4
- data.tar.gz: 49cedbebd2932c7600e7bb0abdcb4035ee7d6903
3
+ metadata.gz: ae9408f537853fbba1b13e2283c7fd1d1545a134
4
+ data.tar.gz: ea23cd0ae24f747fb4d09474e37def12f0c1e7ca
5
5
  SHA512:
6
- metadata.gz: fde3f4884832c4f263304c5468f5dd91747abfa1c8ba70a12c5df171cfe77cbb6d35f4cf19217b178e3c6de159822ef65007224c47944848ed3587a7c78aaf4f
7
- data.tar.gz: 35d3470a139d8449d74e348e58445b676eb4de9ffb5f55f29e2bbd60eb10c8d71b5055b86f71393c70e4a8a7452014dbbb76f610e5fb4b0167ac9c780950759a
6
+ metadata.gz: f8e8f10c218d05320453a9cfdaaccaf6007adaa589793a53d3701f660ae36c32580114382ca72eeeb430fb00152099281f3bfb515a32a54c6f6d36e98c607fe2
7
+ data.tar.gz: 9ede3b311b7bd4767f4deef0ce3de874323dfe89f1a3276d01a79cd4abb7d283c091a9932217db4a484a917ae65de6a57a3acf41178b468d24c63720385de0ed
data/CHANGES.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # CHANGES
2
2
 
3
+ ## gem-path 0.6.0 -- 2014-10-27
4
+
5
+ * Internal cleanup and make find_gem_path a public method.
6
+
3
7
  ## gem-path 0.5.1 -- 2013-11-22
4
8
 
5
9
  * Fixed a bug where it cannot find a gem if the version is not specified.
data/README.md CHANGED
@@ -17,9 +17,8 @@ For examples, under [fish](http://fishshell.com/):
17
17
  vim (gem path gem-path)
18
18
  grep require -R (gem path gem-path)
19
19
 
20
- Or checkout [gem-cd][], [gem-eit][], [gem-grep][] for shorthands.
20
+ Or checkout [gem-eit][], [gem-grep][] for shorthands.
21
21
 
22
- [gem-cd]: https://github.com/godfat/gem-cd
23
22
  [gem-eit]: https://github.com/godfat/gem-eit
24
23
  [gem-grep]: https://github.com/godfat/gem-grep
25
24
 
@@ -65,7 +64,7 @@ This was extracted from [eit-gem][].
65
64
 
66
65
  Apache License 2.0
67
66
 
68
- Copyright (c) 2013, Lin Jen-Shin (godfat)
67
+ Copyright (c) 2013-2014, Lin Jen-Shin (godfat)
69
68
 
70
69
  Licensed under the Apache License, Version 2.0 (the "License");
71
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.5.1'
11
+ s.version = '0.6.0'
12
12
  end
@@ -1,14 +1,15 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: gem-path 0.5.1 ruby lib
2
+ # stub: gem-path 0.6.0 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "gem-path"
6
- s.version = "0.5.1"
6
+ s.version = "0.6.0"
7
7
 
8
8
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
9
+ s.require_paths = ["lib"]
9
10
  s.authors = ["Lin Jen-Shin (godfat)"]
10
- s.date = "2013-11-22"
11
- 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-cd][], [gem-eit][], [gem-grep][] for shorthands.\n\n[gem-cd]: https://github.com/godfat/gem-cd\n[gem-eit]: https://github.com/godfat/gem-eit\n[gem-grep]: https://github.com/godfat/gem-grep"
11
+ s.date = "2014-10-27"
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"
12
13
  s.email = ["godfat (XD) godfat.org"]
13
14
  s.files = [
14
15
  ".gitignore",
@@ -22,10 +23,10 @@ Gem::Specification.new do |s|
22
23
  "lib/rubygems/commands/path_command.rb",
23
24
  "lib/rubygems_plugin.rb",
24
25
  "task/README.md",
25
- "task/gemgem.rb"]
26
+ "task/gemgem.rb",
27
+ "test/test.rb"]
26
28
  s.homepage = "https://github.com/godfat/gem-path"
27
29
  s.licenses = ["Apache License 2.0"]
28
- s.require_paths = ["lib"]
29
- s.rubygems_version = "2.1.11"
30
+ s.rubygems_version = "2.4.2"
30
31
  s.summary = "Find the path for a given gem or require path for editing or greping."
31
32
  end
@@ -12,16 +12,16 @@ class Gem::Commands::PathCommand < Gem::Command
12
12
  name, version = extract!(options[:args])
13
13
 
14
14
  # find the exact gem
15
- if path_gem = find_path_gem(name)
16
- say(path_gem)
15
+ if gem_path = find_gem_path(name)
16
+ say(gem_path)
17
17
 
18
18
  # find the require file
19
19
  elsif path = Gem.find_files("#{name}.rb").first
20
20
  # favor gem first (e.g. rake gem)
21
- if path_gem = Gem.path.find{ |p|
21
+ if gem_path = Gem.path.find{ |p|
22
22
  break $1 if path =~ %r{(#{p}(/[^/]+){2})}
23
23
  }
24
- say(path_gem)
24
+ say(gem_path)
25
25
  else
26
26
  say(path)
27
27
  end
@@ -31,6 +31,17 @@ class Gem::Commands::PathCommand < Gem::Command
31
31
  end
32
32
  end
33
33
 
34
+ def find_gem_path name
35
+ gem_path = Gem.path.find do |base|
36
+ gem_path = $LOAD_PATH.find do |path|
37
+ gem_path = path[%r{#{base}/gems/#{name}\-[^/-]+/}]
38
+ break gem_path if gem_path
39
+ end
40
+ break gem_path if gem_path
41
+ end
42
+ gem_path[0...-1] if gem_path
43
+ end
44
+
34
45
  private
35
46
  def extract! args
36
47
  gem(*args)
@@ -43,15 +54,4 @@ class Gem::Commands::PathCommand < Gem::Command
43
54
  args # this could be a require path, go on searching
44
55
  end
45
56
  end
46
-
47
- def find_path_gem name
48
- path_gem = Gem.path.find do |base|
49
- path_gem = $LOAD_PATH.find do |path|
50
- path_gem = path[%r{#{base}/gems/#{name}\-[^/-]+/}]
51
- break path_gem if path_gem
52
- end
53
- break path_gem if path_gem
54
- end
55
- path_gem[0...-1] if path_gem
56
- end
57
57
  end
@@ -34,7 +34,7 @@ module Gemgem
34
34
  s.executables = bin_files
35
35
  end
36
36
  spec_create.call(spec)
37
- spec.homepage = "https://github.com/godfat/#{spec.name}"
37
+ spec.homepage ||= "https://github.com/godfat/#{spec.name}"
38
38
  self.spec = spec
39
39
  end
40
40
 
@@ -154,14 +154,8 @@ module Gemgem
154
154
  def expand_patterns pathes
155
155
  # http://git-scm.com/docs/gitignore
156
156
  pathes.flat_map{ |path|
157
- case path
158
- when %r{\*}
159
- Regexp.escape(path).gsub(/\\\*/, '[^/]*')
160
- when %r{^/}
161
- "^#{Regexp.escape(path[1..-1])}"
162
- else # we didn't implement negative pattern for now
163
- Regexp.escape(path)
164
- end
157
+ # we didn't implement negative pattern for now
158
+ Regexp.escape(path).sub(%r{^/}, '^').gsub(/\\\*/, '[^/]*')
165
159
  }
166
160
  end
167
161
 
@@ -233,10 +227,6 @@ end # of gem namespace
233
227
  desc 'Run tests'
234
228
  task :test do
235
229
  next if Gemgem.test_files.empty?
236
-
237
- require 'bacon'
238
- Bacon.extend(Bacon::TestUnitOutput)
239
- Bacon.summary_on_exit
240
230
  Gemgem.test_files.each{ |file| require "#{Gemgem.dir}/#{file[0..-4]}" }
241
231
  end
242
232
 
@@ -0,0 +1,7 @@
1
+
2
+ eit-gem rib/version
3
+ eit-gem rib/version '~>1.0.0'
4
+ eit-gem rib
5
+ eit-gem rib 1.0.0
6
+ eit-gem yaml
7
+ eit-gem yaml/store
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.5.1
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lin Jen-Shin (godfat)
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-22 00:00:00.000000000 Z
11
+ date: 2014-10-27 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.
@@ -19,9 +19,8 @@ description: |-
19
19
  vim (gem path gem-path)
20
20
  grep require -R (gem path gem-path)
21
21
 
22
- Or checkout [gem-cd][], [gem-eit][], [gem-grep][] for shorthands.
22
+ Or checkout [gem-eit][], [gem-grep][] for shorthands.
23
23
 
24
- [gem-cd]: https://github.com/godfat/gem-cd
25
24
  [gem-eit]: https://github.com/godfat/gem-eit
26
25
  [gem-grep]: https://github.com/godfat/gem-grep
27
26
  email:
@@ -30,9 +29,9 @@ executables: []
30
29
  extensions: []
31
30
  extra_rdoc_files: []
32
31
  files:
33
- - .gitignore
34
- - .gitmodules
35
- - .travis.yml
32
+ - ".gitignore"
33
+ - ".gitmodules"
34
+ - ".travis.yml"
36
35
  - CHANGES.md
37
36
  - LICENSE
38
37
  - README.md
@@ -42,6 +41,7 @@ files:
42
41
  - lib/rubygems_plugin.rb
43
42
  - task/README.md
44
43
  - task/gemgem.rb
44
+ - test/test.rb
45
45
  homepage: https://github.com/godfat/gem-path
46
46
  licenses:
47
47
  - Apache License 2.0
@@ -52,17 +52,17 @@ require_paths:
52
52
  - lib
53
53
  required_ruby_version: !ruby/object:Gem::Requirement
54
54
  requirements:
55
- - - '>='
55
+ - - ">="
56
56
  - !ruby/object:Gem::Version
57
57
  version: '0'
58
58
  required_rubygems_version: !ruby/object:Gem::Requirement
59
59
  requirements:
60
- - - '>='
60
+ - - ">="
61
61
  - !ruby/object:Gem::Version
62
62
  version: '0'
63
63
  requirements: []
64
64
  rubyforge_project:
65
- rubygems_version: 2.1.11
65
+ rubygems_version: 2.4.2
66
66
  signing_key:
67
67
  specification_version: 4
68
68
  summary: Find the path for a given gem or require path for editing or greping.