gem_locate 0.5.0 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.textile CHANGED
@@ -1,57 +1,3 @@
1
1
  h1. Gem Locate
2
2
 
3
- Searches gems by name, summary, and description in case you want to find a gem by what it is doing rather than it's name. Currently this only searches your *local* gems.
4
-
5
- _I think someone made something like this before...but I couldn't find it_
6
-
7
- h2. Install
8
-
9
- @[sudo] gem install gem_locate@
10
-
11
- h2. Usage
12
-
13
- pre.. $ gem help locate
14
- Usage: gem locate [STRING] [options]
15
- Options:
16
- -i, --[no-]installed Check for installed gem
17
- -v, --version VERSION Specify version of gem to locate
18
- -n, --name-matches REGEXP Name of gem(s) to query on matches the
19
- provided REGEXP
20
- -d, --[no-]details Display detailed information of gem(s)
21
- --[no-]versions Display only gem names
22
- -a, --all Display all gem versions
23
- --prerelease Display prerelease versions
24
-
25
- Local/Remote Options:
26
- -l, --local Restrict operations to the LOCAL domain
27
- -B, --bulk-threshold COUNT Threshold for switching to bulk
28
- synchronization (default 1000)
29
-
30
- Common Options:
31
- -h, --help Get help on this command
32
- -V, --[no-]verbose Set the verbose level of output
33
- -q, --quiet Silence commands
34
- --config-file FILE Use this config file instead of default
35
- --backtrace Show stack backtrace on errors
36
- --debug Turn on Ruby debugging
37
-
38
- Arguments:
39
- STRING fragment of gem name,summary, or description to search for
40
-
41
- Summary:
42
- Find all gems whose name, summary, or description match STRING
43
-
44
- Defaults:
45
- --local
46
-
47
- h1. Note on Patches/Pull Requests
48
-
49
- * Fork the project.
50
- * Make your feature addition or bug fix.
51
- * Commit, do not mess with rakefile, version, or history.
52
- (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
53
- * Send me a pull request :)
54
-
55
- h1. Copyright
56
-
57
- Copyright (c) 2010 Kabari Hendrick. See LICENSE for details.
3
+ Use this instead: http://rubygems.org/gems/rubypan
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.0
1
+ 0.5.2
@@ -2,7 +2,7 @@ class Gem::Commands::LocateCommand < Gem::Commands::QueryCommand
2
2
  def initialize
3
3
  super 'locate', 'Find all gems whose name, summary, or description match STRING'
4
4
 
5
- %w(-r -b --source -p -u).each{|com| remove_option com }
5
+ %w(-p -u).each{|com| remove_option com }
6
6
  end
7
7
 
8
8
  def arguments # :nodoc:
@@ -16,15 +16,15 @@ class Gem::Commands::LocateCommand < Gem::Commands::QueryCommand
16
16
  def usage # :nodoc:
17
17
  "#{program_name} [STRING]"
18
18
  end
19
-
19
+
20
20
  def execute
21
21
  string = get_one_optional_argument
22
- options[:name] = /#{string}/i
22
+ options[:name] = /#{string}/i
23
23
  exit_code = 0
24
-
24
+
25
25
  name = options[:name]
26
26
  prerelease = options[:prerelease]
27
-
27
+
28
28
  if options[:installed] then
29
29
  if name.source.empty? then
30
30
  alert_error "You must specify a gem name"
@@ -35,32 +35,36 @@ class Gem::Commands::LocateCommand < Gem::Commands::QueryCommand
35
35
  say "false"
36
36
  exit_code |= 1
37
37
  end
38
-
38
+
39
39
  raise Gem::SystemExitException, exit_code
40
40
  end
41
-
41
+
42
42
  dep = Gem::Dependency.new name, Gem::Requirement.default
43
-
44
- if prerelease and not both? then
45
- alert_warning "prereleases are always shown locally"
46
- end
47
-
48
- if ui.outs.tty? or both? then
49
- say
50
- say "*** LOCAL GEMS ***"
51
- say
43
+
44
+ if local? then
45
+ if prerelease and not both? then
46
+ alert_warning "prereleases are always shown locally"
47
+ end
48
+
49
+ if ui.outs.tty? or both? then
50
+ say
51
+ say "*** LOCAL GEMS ***"
52
+ say
53
+ end
54
+
55
+ specs = Gem.source_index.locate dep
56
+
57
+ spec_tuples = specs.map do |spec|
58
+ [[spec.name, spec.version, spec.original_platform, spec], :local]
59
+ end
60
+
61
+ output_query_results spec_tuples
62
+ options[:local] = options[:domain] = nil
52
63
  end
53
-
54
- specs = Gem.source_index.locate dep
55
-
56
- spec_tuples = specs.map do |spec|
57
- [[spec.name, spec.version, spec.original_platform, spec], :local]
64
+
65
+ if remote? then
66
+ super
58
67
  end
59
-
60
- output_query_results spec_tuples
61
-
62
- # TODO support remote gem search
63
68
  end
64
-
65
69
  end
66
70
 
@@ -15,7 +15,7 @@ class Gem::SourceIndex
15
15
  version_requirement = platform_only || Gem::Requirement.default
16
16
  when Gem::Dependency then
17
17
  only_platform = platform_only
18
- version_requirement = gem_pattern.version_requirements
18
+ version_requirement = (Gem::VERSION == '1.3.6') ? gem_pattern.requirement : gem_pattern.version_requirements
19
19
  gem_pattern = if Regexp === gem_pattern.name then
20
20
  gem_pattern.name
21
21
  elsif gem_pattern.name.empty? then
@@ -5,6 +5,8 @@ require 'rubygems/command'
5
5
  require 'rubygems/commands/query_command'
6
6
 
7
7
  require "commands/locate"
8
- require "gem_extension/source_index"
8
+ %w( source_index).each do |lib|
9
+ require File.join(File.dirname(__FILE__), "gem_extension", lib)
10
+ end
9
11
  # register gem command
10
12
  Gem::CommandManager.instance.register_command :locate
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gem_locate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 5
8
+ - 2
9
+ version: 0.5.2
5
10
  platform: ruby
6
11
  authors:
7
12
  - Kabari Hendrick
@@ -9,20 +14,22 @@ autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
16
 
12
- date: 2010-02-11 00:00:00 -06:00
17
+ date: 2010-02-26 00:00:00 -06:00
13
18
  default_executable:
14
19
  dependencies:
15
20
  - !ruby/object:Gem::Dependency
16
21
  name: yard
17
- type: :development
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
20
24
  requirements:
21
25
  - - ">="
22
26
  - !ruby/object:Gem::Version
27
+ segments:
28
+ - 0
23
29
  version: "0"
24
- version:
25
- description: Searches gems by name, summary, and description in case you want to find a gem by what it is doing rather than it's name.
30
+ type: :development
31
+ version_requirements: *id001
32
+ description: "Use this instead: http://rubygems.org/gems/rubypan"
26
33
  email: kabari@gmail.com
27
34
  executables: []
28
35
 
@@ -33,7 +40,6 @@ extra_rdoc_files:
33
40
  - README.textile
34
41
  files:
35
42
  - LICENSE
36
- - Rakefile
37
43
  - VERSION
38
44
  - lib/commands/locate.rb
39
45
  - lib/gem_extension/source_index.rb
@@ -61,20 +67,24 @@ required_ruby_version: !ruby/object:Gem::Requirement
61
67
  requirements:
62
68
  - - ">="
63
69
  - !ruby/object:Gem::Version
70
+ segments:
71
+ - 0
64
72
  version: "0"
65
- version:
66
73
  required_rubygems_version: !ruby/object:Gem::Requirement
67
74
  requirements:
68
75
  - - ">="
69
76
  - !ruby/object:Gem::Version
77
+ segments:
78
+ - 1
79
+ - 3
80
+ - 5
70
81
  version: 1.3.5
71
- version:
72
82
  requirements: []
73
83
 
74
84
  rubyforge_project:
75
- rubygems_version: 1.3.5
85
+ rubygems_version: 1.3.6
76
86
  signing_key:
77
87
  specification_version: 3
78
- summary: Same as 'gem search' but search description and summary also
88
+ summary: "Use this instead: http://rubygems.org/gems/rubypan"
79
89
  test_files: []
80
90
 
data/Rakefile DELETED
@@ -1,51 +0,0 @@
1
- require 'rubygems'
2
- require 'rake'
3
-
4
- begin
5
- require 'jeweler'
6
- Jeweler::Tasks.new do |gem|
7
- gem.name = "gem_locate"
8
- gem.summary = %Q{Same as 'gem search' but search description and summary also}
9
- gem.description = %Q{Searches gems by name, summary, and description in case you want to find a gem by what it is doing rather than it's name.}
10
- gem.email = "kabari@gmail.com"
11
- gem.homepage = "http://github.com/kabari/gem_locate"
12
- gem.authors = ["Kabari Hendrick"]
13
- gem.files = FileList["lib/rubygems_plugin.rb",
14
- "lib/commands/locate.rb",
15
- "lib/gem_extension/source_index.rb",
16
- "README.rdoc",
17
- "LICENSE",
18
- "VERSION",
19
- "Rakefile"]
20
- gem.test_files = []
21
- gem.executables = []
22
- gem.required_rubygems_version = Gem::Requirement.new(">= 1.3.5") if gem.respond_to? :required_rubygems_version=
23
- gem.post_install_message = <<MESSAGE
24
-
25
- ========================================================================
26
-
27
- Thanks for installing Gem Locate! You can now run:
28
-
29
- gem locate STRING Same as 'gem search' but search description and summary also
30
-
31
- ========================================================================
32
-
33
- MESSAGE
34
-
35
- gem.add_development_dependency "yard", ">= 0"
36
- end
37
- Jeweler::GemcutterTasks.new
38
- rescue LoadError
39
- puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
40
- end
41
-
42
- task :default => :check_dependencies
43
-
44
- begin
45
- require 'yard'
46
- YARD::Rake::YardocTask.new
47
- rescue LoadError
48
- task :yardoc do
49
- abort "YARD is not available. In order to run yardoc, you must: sudo gem install yard"
50
- end
51
- end