gem_require 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rubygems/commands/require_command.rb +15 -16
- metadata +4 -4
@@ -76,28 +76,27 @@ and installs them if necessary.
|
|
76
76
|
private
|
77
77
|
|
78
78
|
def require_gem(name, version, installer_options)
|
79
|
-
if installed_version = gem_uptodate?(name, version)
|
80
|
-
say "#{name} (#{installed_version}) is already installed"
|
81
|
-
else
|
82
|
-
say "Installing #{name} ..."
|
83
|
-
install_gem(name, version, installer_options)
|
84
|
-
end
|
85
|
-
end
|
86
79
|
|
87
|
-
def gem_uptodate?(name, version)
|
88
80
|
dependency = Gem::Dependency.new(name, version)
|
89
|
-
installed =
|
90
|
-
|
91
|
-
|
92
|
-
|
81
|
+
installed = Gem.source_index.search(dependency).last
|
82
|
+
|
83
|
+
if installed && options[:latest]
|
84
|
+
latest_version = latest_available_version_of(dependency)
|
85
|
+
if installed.version < latest_version
|
86
|
+
installed = nil
|
87
|
+
version = latest_version
|
93
88
|
end
|
94
89
|
end
|
95
|
-
end
|
96
90
|
|
97
|
-
|
98
|
-
|
91
|
+
if installed
|
92
|
+
say "#{name} (#{installed.version}) is already installed"
|
93
|
+
else
|
94
|
+
say "Installing #{name} (#{version}) ..."
|
95
|
+
install_gem(name, version, installer_options)
|
96
|
+
end
|
97
|
+
|
99
98
|
end
|
100
|
-
|
99
|
+
|
101
100
|
def latest_available_version_of(dependency)
|
102
101
|
Gem::SpecFetcher.fetcher.fetch(dependency).map { |x| x.first.version }.max
|
103
102
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gem_require
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 3
|
10
|
+
version: 0.0.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Mike Williams
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-12-
|
18
|
+
date: 2010-12-06 00:00:00 +11:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|