current_gem 0.0.3 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/README CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  == VERSION
4
4
 
5
- This documentation refers to current_gem version 0.0.3
5
+ This documentation refers to current_gem version 0.0.5
6
6
 
7
7
 
8
8
  == DESCRIPTION
data/Rakefile CHANGED
@@ -10,7 +10,9 @@ begin
10
10
  :summary => %q{Maintain symlinks to the most recent versions of installed RubyGems.},
11
11
  :author => %q{Jens Wille},
12
12
  :email => %q{jens.wille@uni-koeln.de},
13
- :homepage => :blackwinter
13
+ :homepage => :blackwinter,
14
+
15
+ :required_rubygems_version => '>= 1.8.0'
14
16
  }
15
17
  }}
16
18
  rescue LoadError => err
@@ -4,7 +4,7 @@ module CurrentGem
4
4
 
5
5
  MAJOR = 0
6
6
  MINOR = 0
7
- TINY = 3
7
+ TINY = 5
8
8
 
9
9
  class << self
10
10
 
data/lib/current_gem.rb CHANGED
@@ -51,9 +51,7 @@ module CurrentGem
51
51
  alias_method :[], :find
52
52
 
53
53
  def path_for(arg)
54
- return unless can_symlink?
55
-
56
- spec = find(arg)
54
+ spec = find(arg) if can_symlink?
57
55
  current_path_for(spec) if spec
58
56
  end
59
57
 
@@ -63,9 +61,7 @@ module CurrentGem
63
61
  end
64
62
 
65
63
  def update(inst_or_uninst)
66
- return unless can_symlink?
67
-
68
- symlink(find(inst_or_uninst))
64
+ symlink(find(inst_or_uninst)) if can_symlink?
69
65
  end
70
66
 
71
67
  def update_all(gem_dir = Gem.dir)
@@ -74,16 +70,16 @@ module CurrentGem
74
70
  path = base_path_for(gem_dir)
75
71
  FU.rm_r(path) if File.directory?(path)
76
72
 
77
- Gem.source_index.latest_specs.each { |spec| symlink(spec, path) }
73
+ Gem::Specification.latest_specs.each { |spec| symlink(spec, path) }
78
74
  end
79
75
 
80
76
  def can_symlink?
81
77
  if Gem.win_platform?
82
78
  warn 'WARNING: Unable to use symlinks on Windows, skipping...'
83
- return false
79
+ false
80
+ else
81
+ true
84
82
  end
85
-
86
- true
87
83
  end
88
84
 
89
85
  ##############################################################################
@@ -105,14 +101,13 @@ module CurrentGem
105
101
  end
106
102
 
107
103
  def find_by_name(name, ver = Gem::Requirement.default)
108
- Gem.source_index.find_name(name.to_s, ver).reject { |spec|
104
+ Gem::Specification.find_all_by_name(name.to_s, ver).reject { |spec|
109
105
  spec.version.prerelease?
110
106
  }.last
111
107
  end
112
108
 
113
109
  def symlink(spec, path = base_path_for(spec))
114
- return unless can_symlink?
115
- return if spec.version.prerelease?
110
+ return unless can_symlink? && !spec.version.prerelease?
116
111
 
117
112
  FU.mkdir_p(path) unless File.exists?(path)
118
113
  raise Gem::FilePermissionError, path unless File.writable?(path) || ENV['DRY_RUN']
@@ -125,7 +120,7 @@ module CurrentGem
125
120
  end
126
121
 
127
122
  def base_path_for(gem_dir)
128
- gem_dir = gem_dir.installation_path if gem_dir.is_a?(Gem::Specification)
123
+ gem_dir = gem_dir.base_dir if gem_dir.is_a?(Gem::Specification)
129
124
  File.join(gem_dir, 'current')
130
125
  end
131
126
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: current_gem
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 21
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 3
10
- version: 0.0.3
9
+ - 5
10
+ version: 0.0.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jens Wille
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-04-29 00:00:00 Z
18
+ date: 2011-05-05 00:00:00 Z
19
19
  dependencies: []
20
20
 
21
21
  description: Maintain symlinks to the most recent versions of installed RubyGems.
@@ -44,14 +44,14 @@ licenses: []
44
44
 
45
45
  post_install_message:
46
46
  rdoc_options:
47
- - --charset
48
- - UTF-8
49
- - --title
50
- - current_gem Application documentation (v0.0.3)
47
+ - --line-numbers
51
48
  - --main
52
49
  - README
53
- - --line-numbers
54
50
  - --all
51
+ - --charset
52
+ - UTF-8
53
+ - --title
54
+ - current_gem Application documentation (v0.0.5)
55
55
  require_paths:
56
56
  - lib
57
57
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -68,14 +68,16 @@ required_rubygems_version: !ruby/object:Gem::Requirement
68
68
  requirements:
69
69
  - - ">="
70
70
  - !ruby/object:Gem::Version
71
- hash: 3
71
+ hash: 55
72
72
  segments:
73
+ - 1
74
+ - 8
73
75
  - 0
74
- version: "0"
76
+ version: 1.8.0
75
77
  requirements: []
76
78
 
77
79
  rubyforge_project:
78
- rubygems_version: 1.7.2
80
+ rubygems_version: 1.8.0
79
81
  signing_key:
80
82
  specification_version: 3
81
83
  summary: Maintain symlinks to the most recent versions of installed RubyGems.