bundle_outdated 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md ADDED
@@ -0,0 +1,7 @@
1
+ ## 0.0.2 (2011-05-06)
2
+
3
+ * Explicit requirement for RubyGems 1.6.0 or later.
4
+
5
+ ## 0.0.1 (2011-05-05)
6
+
7
+ * Initial release
data/README.md CHANGED
@@ -10,6 +10,12 @@ and thus could potentially be updated.
10
10
 
11
11
  $ gem install bundle_outdated
12
12
 
13
+ It currently requires RubyGems 1.6.0 or newer, which can be installed/updated with:
14
+
15
+ $ gem update --system [version]
16
+
17
+ (The version argument is not available on really old versions.)
18
+
13
19
  ## Usage
14
20
 
15
21
  From your Ruby project directory or your `Rails.root`:
data/bin/bundle-outdated CHANGED
@@ -19,4 +19,15 @@ fallback_load_path(File.join(File.dirname(__FILE__), '..', 'lib')) do
19
19
  require 'bundle_outdated'
20
20
  end
21
21
 
22
- BundleOutdated.search!
22
+ begin
23
+ BundleOutdated.search!
24
+ rescue NoMethodError => e
25
+ if e.message =~ /latest_version_for/
26
+ puts "ERROR: Please upgrade to at least RubyGems version 1.6.0 to use this tool."
27
+ puts "\n $ gem update --system"
28
+ puts
29
+ else
30
+ raise
31
+ end
32
+ end
33
+
@@ -14,7 +14,9 @@ Gem::Specification.new do |s|
14
14
 
15
15
  s.rubyforge_project = "bundle_outdated"
16
16
 
17
- s.add_dependency 'rr', '~> 1.0'
17
+ s.add_development_dependency 'rr', '~> 1.0'
18
+ s.required_rubygems_version = ">= 1.6.0"
19
+
18
20
 
19
21
  s.files = `git ls-files`.split("\n")
20
22
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
@@ -0,0 +1,42 @@
1
+ module BundleOutdated
2
+ class GemDependency
3
+ attr_reader :name, :version, :handwaving
4
+
5
+ VERSION_REGEXP = /^(['"])([~><=]*)\s*(.+?)\1$/
6
+ GEMNAME_REGEXP = /gem\s(['"])(.+?)\1/
7
+
8
+ def initialize(gemfile_string)
9
+ self.name, self.version = gemfile_string.split(/,\s*/)
10
+ end
11
+
12
+ def name=(new_name)
13
+ @name = nil
14
+ if new_name && new_name.match(GEMNAME_REGEXP)
15
+ @name = $2
16
+ end
17
+ end
18
+
19
+ def version=(new_version)
20
+ @version = nil
21
+ if new_version && new_version.match(VERSION_REGEXP)
22
+ @handwaving = !$2.empty? && $2
23
+ @version = Gem::Version.new($3)
24
+ end
25
+ end
26
+
27
+ def handwaving?; !!handwaving; end
28
+
29
+ def to_s
30
+ "#{name}, Version: #{ version || 'Any' }"
31
+ end
32
+
33
+ def latest_version
34
+ @latest_version ||= Gem.latest_version_for(name)
35
+ end
36
+
37
+ def outdated?
38
+ return false unless version
39
+ version < latest_version
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,52 @@
1
+ module BundleOutdated
2
+ class Searcher
3
+ class GemfileNotFound < StandardError; end
4
+
5
+ def search!
6
+ puts "Finding outdated gems.."
7
+
8
+ unless outdated_gems.empty?
9
+ puts "\nNewer versions found for:"
10
+ outdated_gems.each do |gem|
11
+ puts " #{gem.name} (#{gem.latest_version} > #{gem.version})"
12
+ end
13
+
14
+ puts "\nLock bundle to these versions by putting the following in your Gemfile:"
15
+ outdated_gems.each do |gem|
16
+ puts " gem '#{gem.name}', '#{gem.latest_version}'"
17
+ end
18
+ end
19
+
20
+ unless handwaving_gems.empty?
21
+ puts "\nYou may try to update non-specific dependencies via:"
22
+ puts " $ bundle update #{handwaving_gems.collect(&:name).join(' ')}"
23
+ puts "\nHandwaving specifications:"
24
+ handwaving_gems.collect do |g|
25
+ puts " #{g.name}: #{ [ g.handwaving, g.version ].join(' ') }"
26
+ end
27
+ end
28
+ end
29
+
30
+ def outdated_gems
31
+ @outdated_gems ||= all_gems.find_all(&:outdated?)
32
+ end
33
+
34
+ def handwaving_gems
35
+ @handwaving_gems ||= all_gems.find_all(&:handwaving?)
36
+ end
37
+
38
+ def gemfile
39
+ unless File.exists?('Gemfile')
40
+ raise GemfileNotFound, 'Gemfile not found! Please re-run in your Ruby project directory.'
41
+ end
42
+
43
+ @gemfile ||= File.read('Gemfile').split(/\n/)
44
+ end
45
+
46
+ def all_gems
47
+ @all_gems ||= gemfile.grep(/^\s*gem\b/).collect do |gem|
48
+ GemDependency.new gem
49
+ end
50
+ end
51
+ end
52
+ end
@@ -1,3 +1,3 @@
1
1
  module BundleOutdated
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -1,97 +1,9 @@
1
+ require 'rubygems'
2
+ require 'bundle_outdated/gem_dependency'
3
+ require 'bundle_outdated/searcher'
4
+
1
5
  module BundleOutdated
2
6
  def self.search!
3
7
  Searcher.new.search!
4
8
  end
5
-
6
- class GemDependency
7
- attr_reader :name, :version, :handwaving
8
-
9
- VERSION_REGEXP = /^(['"])([~><=]*)\s*(.+?)\1$/
10
- GEMNAME_REGEXP = /gem\s(['"])(.+?)\1/
11
-
12
- def initialize(gemfile_string)
13
- self.name, self.version = gemfile_string.split(/,\s*/)
14
- end
15
-
16
- def name=(new_name)
17
- @name = nil
18
- if new_name && new_name.match(GEMNAME_REGEXP)
19
- @name = $2
20
- end
21
- end
22
-
23
- def version=(new_version)
24
- @version = nil
25
- if new_version && new_version.match(VERSION_REGEXP)
26
- @handwaving = !$2.empty? && $2
27
- @version = Gem::Version.new($3)
28
- end
29
- end
30
-
31
- def handwaving?; !!handwaving; end
32
-
33
- def to_s
34
- "#{name}, Version: #{ version || 'Any' }"
35
- end
36
-
37
- def latest_version
38
- @latest_version ||= Gem.latest_version_for(name)
39
- end
40
-
41
- def outdated?
42
- return false unless version
43
- version < latest_version
44
- end
45
- end
46
-
47
- class Searcher
48
- class GemfileNotFound < StandardError; end
49
-
50
- def search!
51
- puts "Finding outdated gems.."
52
-
53
- unless outdated_gems.empty?
54
- puts "\nNewer versions found for:"
55
- outdated_gems.each do |gem|
56
- puts " #{gem.name} (#{gem.latest_version} > #{gem.version})"
57
- end
58
-
59
- puts "\nLock bundle to these versions by putting the following in your Gemfile:"
60
- outdated_gems.each do |gem|
61
- puts " gem '#{gem.name}', '#{gem.latest_version}'"
62
- end
63
- end
64
-
65
- unless handwaving_gems.empty?
66
- puts "\nYou may try to update non-specific dependencies via:"
67
- puts " $ bundle update #{handwaving_gems.collect(&:name).join(' ')}"
68
- puts "\nHandwaving specifications:"
69
- handwaving_gems.collect do |g|
70
- puts " #{g.name}: #{ [ g.handwaving, g.version ].join(' ') }"
71
- end
72
- end
73
- end
74
-
75
- def outdated_gems
76
- @outdated_gems ||= all_gems.find_all(&:outdated?)
77
- end
78
-
79
- def handwaving_gems
80
- @handwaving_gems ||= all_gems.find_all(&:handwaving?)
81
- end
82
-
83
- def gemfile
84
- unless File.exists?('Gemfile')
85
- raise GemfileNotFound, 'Gemfile not found! Please re-run in your Ruby project directory.'
86
- end
87
-
88
- @gemfile ||= File.read('Gemfile').split(/\n/)
89
- end
90
-
91
- def all_gems
92
- @all_gems ||= gemfile.grep(/^\s*gem\b/).collect do |gem|
93
- GemDependency.new gem
94
- end
95
- end
96
- end
97
9
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bundle_outdated
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Patrick Lenz
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-05-05 00:00:00 Z
18
+ date: 2011-05-06 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: rr
@@ -30,7 +30,7 @@ dependencies:
30
30
  - 1
31
31
  - 0
32
32
  version: "1.0"
33
- type: :runtime
33
+ type: :development
34
34
  version_requirements: *id001
35
35
  description: Find out which gems in your bundle are outdated.
36
36
  email:
@@ -43,6 +43,7 @@ extra_rdoc_files: []
43
43
 
44
44
  files:
45
45
  - .gitignore
46
+ - CHANGELOG.md
46
47
  - Gemfile
47
48
  - LICENSE
48
49
  - README.md
@@ -50,6 +51,8 @@ files:
50
51
  - bin/bundle-outdated
51
52
  - bundle_outdated.gemspec
52
53
  - lib/bundle_outdated.rb
54
+ - lib/bundle_outdated/gem_dependency.rb
55
+ - lib/bundle_outdated/searcher.rb
53
56
  - lib/bundle_outdated/version.rb
54
57
  - test/bundle_outdated_test.rb
55
58
  - test/gem_dependency_test.rb
@@ -77,10 +80,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
77
80
  requirements:
78
81
  - - ">="
79
82
  - !ruby/object:Gem::Version
80
- hash: 3
83
+ hash: 15
81
84
  segments:
85
+ - 1
86
+ - 6
82
87
  - 0
83
- version: "0"
88
+ version: 1.6.0
84
89
  requirements: []
85
90
 
86
91
  rubyforge_project: bundle_outdated