update_hints 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,7 @@
1
+ === 1.0.1 / 2011-05-25
2
+
3
+ * End the last line of output with a newline (doh!)
4
+
1
5
  === 1.0.0 / 2011-05-25
2
6
 
3
7
  * 1 major enhancement
data/Manifest.txt CHANGED
@@ -1,7 +1,7 @@
1
1
  .autotest
2
2
  History.txt
3
3
  Manifest.txt
4
- README.txt
4
+ README.rdoc
5
5
  Rakefile
6
6
  lib/update_hints.rb
7
7
  test/sample.xml
File without changes
data/Rakefile CHANGED
@@ -4,6 +4,9 @@ require 'rubygems'
4
4
  require 'hoe'
5
5
 
6
6
  Hoe.spec 'update_hints' do | s |
7
+ s.readme_file = 'README.rdoc'
8
+ s.extra_rdoc_files = FileList['*.rdoc'] + FileList['*.txt']
9
+
7
10
  s.developer('Julik Tarkhanov', 'me@julik.nl')
8
11
  s.extra_dev_deps = {"flexmock" => ">=0"}
9
12
  end
data/lib/update_hints.rb CHANGED
@@ -4,7 +4,7 @@ require "timeout"
4
4
  require "rexml/document"
5
5
 
6
6
  module UpdateHints
7
- VERSION = '1.0.0'
7
+ VERSION = '1.0.1'
8
8
  GEMCUTTER_URI = "http://rubygems.org/api/v1/gems/%s.xml"
9
9
 
10
10
  # Checks whether rubygems.org has a new version of this specific gem
@@ -13,19 +13,23 @@ module UpdateHints
13
13
  # reason the method is run while the app is offline
14
14
  def self.version_check(gem_name, present_version_str, destination = $stderr)
15
15
  begin
16
- latest_version = extract_version_from_xml(open(GEMCUTTER_URI % gem_name))
17
- int_present, int_available = Version.new(present_version_str), Version.new(latest_version)
18
- if int_available > int_present
19
- destination << "Your version of #{gem_name} is probably out of date\n"
20
- destination << "(the current version is #{latest_version}, but you have #{present_version_str}).\n"
21
- destination << "Please consider updating (run `gem update #{gem_name}`)"
22
- end
16
+ version_check_without_exception_suppression(gem_name, present_version_str, destination)
23
17
  rescue Exception
24
18
  end
25
19
  end
26
20
 
27
21
  private
28
22
 
23
+ def self.version_check_without_exception_suppression(gem_name, present_version_str, destination)
24
+ latest_version = extract_version_from_xml(open(GEMCUTTER_URI % gem_name))
25
+ int_present, int_available = Version.new(present_version_str), Version.new(latest_version)
26
+ if int_available > int_present
27
+ destination << "Your version of #{gem_name} is probably out of date\n"
28
+ destination << "(the current version is #{latest_version}, but you have #{present_version_str}).\n"
29
+ destination << "Please consider updating (run `gem update #{gem_name}`)\n"
30
+ end
31
+ end
32
+
29
33
  # For stubbing
30
34
  def self.open(*any)
31
35
  super
@@ -15,7 +15,7 @@ class TestUpdateHints < Test::Unit::TestCase
15
15
  flexmock(UpdateHints).should_receive(:open).with("http://rubygems.org/api/v1/gems/tracksperanto.xml").once.and_return(xml)
16
16
 
17
17
  UpdateHints.version_check("tracksperanto", "1.2.3", output)
18
- assert_equal "Your version of tracksperanto is probably out of date\n(the current version is 2.4.1, but you have 1.2.3).\nPlease consider updating (run `gem update tracksperanto`)", output
18
+ assert_equal "Your version of tracksperanto is probably out of date\n(the current version is 2.4.1, but you have 1.2.3).\nPlease consider updating (run `gem update tracksperanto`)\n", output
19
19
  end
20
20
 
21
21
  def test_version_check_stays_silent_on_success
metadata CHANGED
@@ -1,13 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: update_hints
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
5
4
  prerelease:
6
- segments:
7
- - 1
8
- - 0
9
- - 0
10
- version: 1.0.0
5
+ version: 1.0.1
11
6
  platform: ruby
12
7
  authors:
13
8
  - Julik Tarkhanov
@@ -15,8 +10,7 @@ autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
12
 
18
- date: 2011-05-25 00:00:00 +02:00
19
- default_executable:
13
+ date: 2011-07-28 00:00:00 Z
20
14
  dependencies:
21
15
  - !ruby/object:Gem::Dependency
22
16
  name: flexmock
@@ -26,9 +20,6 @@ dependencies:
26
20
  requirements:
27
21
  - - ">="
28
22
  - !ruby/object:Gem::Version
29
- hash: 3
30
- segments:
31
- - 0
32
23
  version: "0"
33
24
  type: :development
34
25
  version_requirements: *id001
@@ -38,14 +29,9 @@ dependencies:
38
29
  requirement: &id002 !ruby/object:Gem::Requirement
39
30
  none: false
40
31
  requirements:
41
- - - ">="
32
+ - - ~>
42
33
  - !ruby/object:Gem::Version
43
- hash: 41
44
- segments:
45
- - 2
46
- - 9
47
- - 1
48
- version: 2.9.1
34
+ version: "2.10"
49
35
  type: :development
50
36
  version_requirements: *id002
51
37
  description: Quickly checks rubygems.org for a new version o a given gem and advises the user on STDERR to install an update
@@ -58,25 +44,24 @@ extensions: []
58
44
  extra_rdoc_files:
59
45
  - History.txt
60
46
  - Manifest.txt
61
- - README.txt
47
+ - README.rdoc
62
48
  files:
63
49
  - .autotest
64
50
  - History.txt
65
51
  - Manifest.txt
66
- - README.txt
52
+ - README.rdoc
67
53
  - Rakefile
68
54
  - lib/update_hints.rb
69
55
  - test/sample.xml
70
56
  - test/test_update_hints.rb
71
57
  - .gemtest
72
- has_rdoc: true
73
58
  homepage: http://github.com/julik/update_hints
74
59
  licenses: []
75
60
 
76
61
  post_install_message:
77
62
  rdoc_options:
78
63
  - --main
79
- - README.txt
64
+ - README.rdoc
80
65
  require_paths:
81
66
  - lib
82
67
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -84,23 +69,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
84
69
  requirements:
85
70
  - - ">="
86
71
  - !ruby/object:Gem::Version
87
- hash: 3
88
- segments:
89
- - 0
90
72
  version: "0"
91
73
  required_rubygems_version: !ruby/object:Gem::Requirement
92
74
  none: false
93
75
  requirements:
94
76
  - - ">="
95
77
  - !ruby/object:Gem::Version
96
- hash: 3
97
- segments:
98
- - 0
99
78
  version: "0"
100
79
  requirements: []
101
80
 
102
81
  rubyforge_project: update_hints
103
- rubygems_version: 1.4.1
82
+ rubygems_version: 1.8.5
104
83
  signing_key:
105
84
  specification_version: 3
106
85
  summary: Quickly checks rubygems.org for a new version o a given gem and advises the user on STDERR to install an update