filander 0.5.1 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -12,16 +12,14 @@ module Filander
12
12
  end
13
13
  report :install, report_name
14
14
  unless Filander.behavior == :pretend
15
- begin
16
- if version
17
- gem name, version
18
- else
19
- gem name
20
- end
21
- rescue Gem::LoadError
22
- system "gem install #{gem_install_args}"
23
- end
15
+ system "gem install #{gem_install_args}" unless gem_exists?(name, version)
24
16
  end
25
17
  end
18
+
19
+ private
20
+
21
+ def gem_exists?(name, version)
22
+ Gem.path.map { |p| File.join(p, 'gems', "#{name}-#{version || '*'}") }.any? { |p| Dir[p].size > 0 }
23
+ end
26
24
  end
27
25
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 5
8
- - 1
9
- version: 0.5.1
8
+ - 2
9
+ version: 0.5.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Johannes J. Schmidt
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-04-08 00:00:00 +02:00
17
+ date: 2010-04-09 00:00:00 +02:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency