outdated-gems 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.1.0
@@ -0,0 +1,11 @@
1
+ require 'monster_mash'
2
+ require 'json'
3
+
4
+ class GemcutterJson < MonsterMash::Base
5
+ get(:latest_gem_version) do |name|
6
+ uri "http://gemcutter.org/api/v1/gems/#{name}.json"
7
+ handler do |response|
8
+ JSON.parse(response.body)['version']
9
+ end
10
+ end
11
+ end
data/lib/outdated-gems.rb CHANGED
@@ -1,7 +1,6 @@
1
1
  require 'yaml'
2
- require 'json'
3
- require 'rest_client'
4
2
  require 'versionomy'
3
+ require 'gemcutter_json'
5
4
 
6
5
  file = File.join(Dir.pwd, 'Gemfile.lock')
7
6
 
@@ -10,14 +9,31 @@ if File.exists?(file)
10
9
  gems = gemfile['specs'].inject({}) do |gems, g|
11
10
  g = g.to_a[0]
12
11
  name = g[0]
13
- v = g[1]['version']
14
- v_latest = JSON.parse(RestClient.get("http://gemcutter.org/api/v1/gems/#{name}.json"))['version']
15
- if Versionomy.parse(v) < Versionomy.parse(v_latest)
16
- gems[name] = "#{v} => #{v_latest}"
17
- end
12
+ version = g[1]['version']
13
+ gems[name] = version
18
14
  gems
19
15
  end
20
- gems.each do |name, change|
16
+
17
+ outdated_gems = {}
18
+
19
+ hydra = Typhoeus::Hydra.new(:max_concurrency => 20)
20
+ gemcutter = GemcutterJson.new(hydra)
21
+
22
+ gems.each do |name, v_current|
23
+ gemcutter.latest_gem_version(name) do |v_latest, error|
24
+ if error
25
+ raise "Error fetching version for #{name} gem."
26
+ else
27
+ if Versionomy.parse(v_current) < Versionomy.parse(v_latest)
28
+ outdated_gems[name] = "#{v_current} => #{v_latest}"
29
+ end
30
+ end
31
+ end
32
+ end
33
+
34
+ hydra.run
35
+
36
+ outdated_gems.each do |name, change|
21
37
  puts "#{name}: #{change}"
22
38
  end
23
39
  end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{outdated-gems}
8
- s.version = "0.0.1"
8
+ s.version = "0.1.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Aaron Gibralter"]
12
- s.date = %q{2010-05-06}
12
+ s.date = %q{2010-05-07}
13
13
  s.default_executable = %q{outdated_gems}
14
14
  s.description = %q{Run `outdated_gems` in a directory containing a Gemfile.lock and it will print the results.}
15
15
  s.email = %q{aaron.gibralter@gmail.com}
@@ -21,6 +21,7 @@ Gem::Specification.new do |s|
21
21
  "README",
22
22
  "VERSION",
23
23
  "bin/outdated_gems",
24
+ "lib/gemcutter_json.rb",
24
25
  "lib/outdated-gems.rb",
25
26
  "outdated-gems.gemspec"
26
27
  ]
@@ -36,16 +37,16 @@ Gem::Specification.new do |s|
36
37
 
37
38
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
38
39
  s.add_runtime_dependency(%q<json>, [">= 1.4.0"])
39
- s.add_runtime_dependency(%q<rest-client>, [">= 1.5.0"])
40
+ s.add_runtime_dependency(%q<monster_mash>, [">= 0.1.0"])
40
41
  s.add_runtime_dependency(%q<versionomy>, [">= 0.3.0"])
41
42
  else
42
43
  s.add_dependency(%q<json>, [">= 1.4.0"])
43
- s.add_dependency(%q<rest-client>, [">= 1.5.0"])
44
+ s.add_dependency(%q<monster_mash>, [">= 0.1.0"])
44
45
  s.add_dependency(%q<versionomy>, [">= 0.3.0"])
45
46
  end
46
47
  else
47
48
  s.add_dependency(%q<json>, [">= 1.4.0"])
48
- s.add_dependency(%q<rest-client>, [">= 1.5.0"])
49
+ s.add_dependency(%q<monster_mash>, [">= 0.1.0"])
49
50
  s.add_dependency(%q<versionomy>, [">= 0.3.0"])
50
51
  end
51
52
  end
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 0
8
7
  - 1
9
- version: 0.0.1
8
+ - 0
9
+ version: 0.1.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Aaron Gibralter
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-05-06 00:00:00 -04:00
17
+ date: 2010-05-07 00:00:00 -04:00
18
18
  default_executable: outdated_gems
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -32,17 +32,17 @@ dependencies:
32
32
  type: :runtime
33
33
  version_requirements: *id001
34
34
  - !ruby/object:Gem::Dependency
35
- name: rest-client
35
+ name: monster_mash
36
36
  prerelease: false
37
37
  requirement: &id002 !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - ">="
40
40
  - !ruby/object:Gem::Version
41
41
  segments:
42
+ - 0
42
43
  - 1
43
- - 5
44
44
  - 0
45
- version: 1.5.0
45
+ version: 0.1.0
46
46
  type: :runtime
47
47
  version_requirements: *id002
48
48
  - !ruby/object:Gem::Dependency
@@ -71,6 +71,7 @@ files:
71
71
  - README
72
72
  - VERSION
73
73
  - bin/outdated_gems
74
+ - lib/gemcutter_json.rb
74
75
  - lib/outdated-gems.rb
75
76
  - outdated-gems.gemspec
76
77
  has_rdoc: true