rubygems-desc 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/Rakefile +1 -0
  2. data/VERSION +1 -1
  3. data/lib/rubygems_plugin.rb +27 -18
  4. metadata +11 -1
data/Rakefile CHANGED
@@ -10,6 +10,7 @@ begin
10
10
  gem.email = "chad@chadfowler.com"
11
11
  gem.homepage = "http://github.com/chad/rubygems-desc"
12
12
  gem.authors = ["Chad Fowler"]
13
+ gem.add_dependency "httparty"
13
14
  gem.add_development_dependency "thoughtbot-shoulda"
14
15
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
15
16
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.0
1
+ 1.2.0
@@ -1,4 +1,22 @@
1
1
  require 'rubygems/command'
2
+ require 'httparty'
3
+
4
+ class RemoteGem
5
+ attr_accessor :name, :version, :authors, :info, :downloads, :rubyforge_project
6
+ include HTTParty
7
+ format :json
8
+ def self.info_for(name)
9
+ data = get("http://gemcutter.org/api/v1/gems/#{name}.json")
10
+ data.code == 404 ? nil : new(data)
11
+ end
12
+
13
+ def initialize(hash)
14
+ hash.each do |key, value|
15
+ __send__("#{key}=", value)
16
+ end
17
+ end
18
+ end
19
+
2
20
 
3
21
  class Gem::Commands::DescCommand < Gem::Command
4
22
 
@@ -18,25 +36,16 @@ class Gem::Commands::DescCommand < Gem::Command
18
36
 
19
37
  def execute
20
38
  name = get_one_gem_name
21
-
22
- dep = Gem::Dependency.new name, options[:version]
23
- specs = Gem.source_index.search dep
24
-
25
- if specs.empty? then
26
- #try remote
27
- fetcher = Gem::SpecFetcher.fetcher
28
- specs = (fetcher.fetch dep, false, false, false)
29
- specs = specs.first
30
- if specs.nil? || specs.empty?
31
- alert_error "No gem found: #{dep}"
32
- terminate_interaction 1
33
- end
34
- specs = [specs.first]
39
+ remote_gem = RemoteGem.info_for(name)
40
+ if remote_gem
41
+ say "version: #{remote_gem.version}"
42
+ say "authors: #{remote_gem.authors}"
43
+ say "downloads: #{remote_gem.downloads}"
44
+ say ""
45
+ say "\t#{remote_gem.info}"
46
+ else
47
+ say "Couldn't find #{name} in repository"
35
48
  end
36
-
37
- spec = specs.last
38
- say "#{spec.name}"
39
- say "\t#{spec.description}"
40
49
  end
41
50
 
42
51
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubygems-desc
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chad Fowler
@@ -12,6 +12,16 @@ cert_chain: []
12
12
  date: 2009-11-24 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: httparty
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "0"
24
+ version:
15
25
  - !ruby/object:Gem::Dependency
16
26
  name: thoughtbot-shoulda
17
27
  type: :development